Example #1
0
 private void ReceivedOffline(MqttDataFormat newData)
 {
     Offline = true;
 }
Example #2
0
 private void Update(MqttDataFormat newData)
 {
     UpdatePeriod = (DateTime.Now - LastUpdated);
     Offline = false;
     LastUpdated = newData.ReceivedDt;
     LastValue = Convert.ToDouble(newData.Value.ToString(CultureInfo.InvariantCulture));
     Debug.WriteLine($"Period:{UpdatePeriod.ToAnimatedDuration()}");
 }
Example #3
0
 private void NewDataReceived(MqttDataFormat newData)
 {
     //if ((SensorDatas.Count>0)&&((DateTime.Now-SensorDatas[0].ReceivedDt).Hours > 1))
     //{
     //    SensorDatas.RemoveAt(0);
     //}
     SensorDatas.Add(new SensorData(newData.ReceivedDt, Convert.ToDouble(newData.Value.ToString(CultureInfo.InvariantCulture)), newData.Voltage));
     if (NewReading != null)
         NewReading(this,
             new Reading
             {
                 Location = newData.FullLocation,
                 Value = Convert.ToDouble(newData.Value.ToString(CultureInfo.InvariantCulture)),
                 SensorType = newData.SensorType
             });
 }