private bool IsReadingValid <T>(SensorReadingWrapper <T> data) { if (!data.IsValid) { return(false); } return(true); }
public async Task <SensorReadingWrapper <DhtReading> > ReadAsync() { var readingData = new SensorReadingWrapper <DhtReading>(d => d.IsValid); var controller = GpioController.GetDefault(); using (GpioPin pin = controller.OpenPin(4, GpioSharingMode.Exclusive)) { using (Dht11 dht11 = new Dht11(pin, GpioPinDriveMode.Input)) { readingData.Data = await dht11.GetReadingAsync().AsTask(); } } return(readingData); }