Exemple #1
0
 public SensorSubscriber(Address address, Sensor sensor, int interval, int expire) 
 {
     Address = address;
     Sensor = sensor;
     Interval = interval;
     Expire = expire;
     Time = interval;
 }
Exemple #2
0
    private static void readSensor(Sensor sensor)
    {
      Console.WriteLine("read sensor {0}...", sensor.Name);
      if (sensor.Address != _node.Address)
      {
        var data = FixedString.ToArray(sensor.Name, HBusSettings.NameLength);
        _bus.SendCommand(NodeCommands.CMD_READ_SENSOR, sensor.Address, data);

        Console.WriteLine("remote sensor {0} sent read command", sensor.Name);
      }
      else
      {
        var read = sensor.Read();

        Console.WriteLine("local sensor {0} read = {1} @ {2}", read.Name, read.Value, read.Time);
      }
    }