public Dht22Sensor(int id, DHT22SensorKind kind, DHT22Accessor dht22Accessor) { _id = id; _kind = kind; _dht22Accessor = dht22Accessor ?? throw new ArgumentNullException(nameof(dht22Accessor)); dht22Accessor.ValuesUpdated += UpdateValue; }
public I2CHardwareBridge(string id, I2CSlaveAddress address, II2CBusService i2CBusService, ISchedulerService schedulerService) { if (schedulerService == null) { throw new ArgumentNullException(nameof(schedulerService)); } _address = address; _i2CBusService = i2CBusService ?? throw new ArgumentNullException(nameof(i2CBusService)); Id = id ?? throw new ArgumentNullException(nameof(id)); DHT22Accessor = new DHT22Accessor(this, schedulerService); }
public float GetValueInternal(int sensorId, DHT22Accessor dht22Accessor) { if (_kind == DHT22SensorKind.Temperature) { return(dht22Accessor.GetTemperature((byte)sensorId)); } if (_kind == DHT22SensorKind.Humidity) { return(dht22Accessor.GetHumidity((byte)sensorId)); } throw new NotSupportedException(); }