public EnvironmentalDebugSensor(byte sensorId, string sensorName) : base(sensorId, sensorName) { Humidity = new SensorValue(this, SensorValueType.Humidity); Pressure = new SensorValue(this, SensorValueType.Pressure); Temperature = new SensorValue(this, SensorValueType.Temperature); CO2 = new SensorValue(this, SensorValueType.CO2); TVOC = new SensorValue(this, SensorValueType.TVOC); }
public SensorData(byte[] bytes) { Stream stream = new MemoryStream(bytes); using BinaryReader reader = new BinaryReader(stream); Timestamp = reader.ReadInt32(); Sensors = new SensorValue[(bytes.Length - 4) / 6]; for (int i = 0; i < Sensors.Length; i++) { Sensors[i] = new SensorValue(reader.ReadByte(), (SensorList.SensorValueType)reader.ReadByte(), reader.ReadSingle()); } }
public EnvironmentalSensor(byte sensorId, string sensorName, int bme280DeviceAddress, int ccs811deviceAddress, int busId = 1) : base(sensorId, sensorName, bme280DeviceAddress, 0, busId) { Humidity = new SensorValue(this, SensorValueType.Humidity); Pressure = new SensorValue(this, SensorValueType.Pressure); Temperature = new SensorValue(this, SensorValueType.Temperature); CO2 = new SensorValue(this, SensorValueType.CO2); TVOC = new SensorValue(this, SensorValueType.TVOC); if (Device == null) { return; } try { I2cBme280 = new Bme280(Device); } catch (Exception e) { Console.Write(e); } try { Ccs811Bme280 = new CCS811BME280Sensor(I2cDevice.Create(new I2cConnectionSettings(busId, ccs811deviceAddress))); Ccs811Bme280.Initialize(); } catch (Exception e) { Console.Write(e); } }
protected bool ValidateValue(SensorValue sensorValue, float min, float max) => ValidateValue(sensorValue.value, min, max);
public TemperatureSensor(byte sensorId, string sensorName, int deviceAddress, byte cmd, int busId = 1) : base(sensorId, sensorName, deviceAddress, cmd, busId) { Temperature = new SensorValue(this, SensorValueType.Temperature); }
public pHSensor(byte sensorId, string sensorName, int deviceAddress, byte cmd, int busId = 1) : base(sensorId, sensorName, deviceAddress, cmd, busId) { pH = new SensorValue(this, SensorValueType.pH); }
public LightSensor(byte sensorId, string sensorName, int deviceAddress, byte cmd, int busId = 1) : base(sensorId, sensorName, deviceAddress, cmd, busId) { Light = new SensorValue(this, SensorValueType.Light); }
public DebugSensor(byte sensorId, string sensorName) : base(sensorId, sensorName) { Value = new SensorValue(this, SensorValueType.pH); }
public FlowSensor(byte sensorId, string sensorName, int deviceAddress, byte cmd, int busId = 1) : base(sensorId, sensorName, deviceAddress, cmd, busId) { FlowRate = new SensorValue(this, SensorValueType.FlowRate); }