//## Magnetometer async Task ReadMagnetometer() { byte[] rawData = await BLE_Utilities.ReadData(Sensor.Accelerometer); float[] vals = SensorConvert.convertAccelerometer(rawData); await this.Dispatcher.BeginInvoke((Action)(() => setMagnetometer(vals[0], vals[1], vals[2]))); }
async void NotifyTemperature(GattCharacteristic sender, GattValueChangedEventArgs args) { byte[] rawData = BLE_Utilities.getDataBytes(args); float temp = SensorConvert.convertTemperature(rawData); await this.Dispatcher.BeginInvoke((Action)(() => setTemperature(temp))); }
async void NotifyHumidity(GattCharacteristic sender, GattValueChangedEventArgs args) { byte[] rawData = BLE_Utilities.getDataBytes(args); float acthum = SensorConvert.convertHumidity(rawData); await this.Dispatcher.BeginInvoke((Action)(() => setHumidity(acthum))); }
//## Gyroscope async Task ReadGyroscope() { byte[] rawData = await BLE_Utilities.ReadData(Sensor.Gyroscope); float[] vals = SensorConvert.convertGyroscope(rawData); await this.Dispatcher.BeginInvoke((Action)(() => setGyroscope(vals[0], vals[1], vals[2]))); }
//##Temperature async Task ReadTemperature() { byte[] rawData = await BLE_Utilities.ReadData(Sensor.Temperature); float temp = SensorConvert.convertTemperature(rawData); await this.Dispatcher.BeginInvoke((Action)(() => setTemperature(temp))); }
//## Humidity async Task ReadHumidity() { byte[] rawData = await BLE_Utilities.ReadData(Sensor.Humidity); float acthum = SensorConvert.convertHumidity(rawData); await this.Dispatcher.BeginInvoke((Action)(() => setHumidity(acthum))); }
async void NotifyMagnetometer(GattCharacteristic sender, GattValueChangedEventArgs args) { byte[] rawData = BLE_Utilities.getDataBytes(args); float[] vals = SensorConvert.convertAccelerometer(rawData); await this.Dispatcher.BeginInvoke((Action)(() => setMagnetometer(vals[0], vals[1], vals[2]))); }