mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-04-29 06:48:41 +00:00
25 lines
508 B
C#
25 lines
508 B
C#
using Esiur.Resource;
|
|
|
|
/// <summary>
|
|
/// A simple observable sensor resource.
|
|
/// Property changes are automatically propagated to all attached peers.
|
|
/// </summary>
|
|
[Resource]
|
|
public class SensorResource : Resource
|
|
{
|
|
public int SensorId { get; set; }
|
|
|
|
private double _value;
|
|
|
|
[ResourceProperty]
|
|
public double Value
|
|
{
|
|
get => _value;
|
|
set
|
|
{
|
|
_value = value;
|
|
PropertyModified("Value"); // notifies Esiur runtime to propagate
|
|
}
|
|
}
|
|
}
|