int GetSetSuctionPressure(double?pressure = null)
 {
     lock (SuctionPressureLock)
     {
         //check if we're updating or reading.
         if (pressure == null)
         {
             return(_SuctionPressure);
         }
         _SuctionPressure  = (int)pressure.Value;
         _LastPressureDate = DateTime.UtcNow;
         CommsTimeout      = false;
     }
     OnPressureChange?.Invoke(pressure.Value);
     return((int)pressure.Value);
 }
Beispiel #2
0
        public override void ParseData(string command)
        {
            base.ParseData(command);

            var jObject = JObject.Parse(command);

            if (jObject["pressure"] == null || !float.TryParse(jObject["pressure"].ToString(), out float p))
            {
                return;
            }

            var newPressure = p / 100;

            if (Pressure == null || Temperature != null && Math.Abs(newPressure - Pressure.Value) > 0.01)
            {
                OnPressureChange?.Invoke(this, new PressureEventArgs(newPressure));
            }

            Pressure = newPressure;
        }