示例#1
0
        //## 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])));
        }
示例#2
0
        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)));
        }
示例#3
0
        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)));
        }
示例#4
0
        //## 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])));
        }
示例#5
0
        //##Temperature
        async Task ReadTemperature()
        {
            byte[] rawData = await BLE_Utilities.ReadData(Sensor.Temperature);

            float temp = SensorConvert.convertTemperature(rawData);

            await this.Dispatcher.BeginInvoke((Action)(() => setTemperature(temp)));
        }
示例#6
0
        //## Humidity
        async Task ReadHumidity()
        {
            byte[] rawData = await BLE_Utilities.ReadData(Sensor.Humidity);

            float acthum = SensorConvert.convertHumidity(rawData);

            await this.Dispatcher.BeginInvoke((Action)(() => setHumidity(acthum)));
        }
示例#7
0
 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])));
 }