public void RegisterSensorValue(ISensorValue sv) { lock (_list) { foreach (var dev in _list) { dev.RegisterSensorValue(sv); } } }
public void Check(ISensorValue sv) { if ((Host != sv.host) || (Pin != sv.sensorid) || (Type != sv.tipe)) return; int mapValue = ValueMapper.Map(Model, sv.sensor_value); LastValue = mapValue; switch (Operator) { case ">": Status = mapValue > Value; break; case "<": Status = mapValue < Value; break; case "=": Status = mapValue == Value; break; case ">=": Status = mapValue >= Value; break; case "<=": Status = mapValue <= Value; break; case "<>": Status = mapValue != Value; break; } }
public void RegisterSensorValue(ISensorValue sv) { lock (_conditions) { foreach (var c in _conditions) c.Check(sv); if (_conditions.Count == 0) { Status = false; return; } Status = _conditions.All(c => c.Status); } }