Exemple #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();
 }
Exemple #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");
     }
 }
Exemple #3
0
        public async Task InitAsync()
        {
            var initialTarget = await base.ReadDesiredPropertyAsync <double>("targetTemperature");

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