Beispiel #1
0
 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);
 }
Beispiel #2
0
        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());
            }
        }
Beispiel #3
0
 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);
     }
 }
Beispiel #4
0
 protected bool ValidateValue(SensorValue sensorValue, float min, float max) => ValidateValue(sensorValue.value, min, max);
Beispiel #5
0
 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);
 }
Beispiel #6
0
 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);
 }
Beispiel #7
0
 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);
 }
Beispiel #8
0
 public DebugSensor(byte sensorId, string sensorName) : base(sensorId, sensorName)
 {
     Value = new SensorValue(this, SensorValueType.pH);
 }
Beispiel #9
0
 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);
 }