Ejemplo n.º 1
0
 public TemperatureSensor(DeviceClient client, string componentName, ILogger log) : base(client, componentName, log)
 {
     base.SetPnPDesiredPropertyHandlerAsync <double>(
         "targetTemperature",
         (newValue) => OnTargetTempReceived?.Invoke(this, new TemperatureEventArgs(newValue)),
         this).Wait();
 }
Ejemplo n.º 2
0
 private void TriggerEventIfValueIsDouble(object newValue)
 {
     if (newValue != null && double.TryParse(newValue.ToString(), out double target))
     {
         OnTargetTempReceived?.Invoke(this, new TemperatureEventArgs(target));
     }
     else
     {
         logger.LogWarning("!!!!!!!!!!!! value is not double, skipping event");
     }
 }
Ejemplo n.º 3
0
        public async Task InitAsync()
        {
            var initialTarget = await base.ReadDesiredPropertyAsync <double>("targetTemperature");

            OnTargetTempReceived?.Invoke(this, new TemperatureEventArgs(initialTarget));
        }