예제 #1
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);
      }
    }