private async void GattCharacteristic_ValueChanged(GattCharacteristic sender, GattValueChangedEventArgs args) { Debug.WriteLine($"Sensor Page > {SupportedUuids.TranslateUuid(sender.Uuid)} : {SupportedUuids.FormatToString(args.CharacteristicValue)}"); await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { float value; switch (sender.Uuid.ToString()) { case SupportedUuids.UUID_SEN_TMP: if (float.TryParse(FormatToString(args.CharacteristicValue), out value)) { TempGauge.Value = value; } break; case SupportedUuids.UUID_SEN_HUM: if (float.TryParse(FormatToString(args.CharacteristicValue), out value)) { HumidityGauge.Value = value; } break; case SupportedUuids.UUID_SEN_BAR: if (float.TryParse(FormatToString(args.CharacteristicValue), out value)) { PressureGauge.Value = value / 100; } break; case SupportedUuids.UUID_SEN_AQI: if (float.TryParse(FormatToString(args.CharacteristicValue), out value)) { AirQualityGauge.Value = value; } break; default: break; } }); }
private async void GattCharacteristic_ValueChanged(GattCharacteristic sender, GattValueChangedEventArgs args) { Debug.WriteLine($"Config Page > {SupportedUuids.TranslateUuid(sender.Uuid)} : {SupportedUuids.FormatToString(args.CharacteristicValue)}"); await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { switch (sender.Uuid.ToString()) { case SupportedUuids.UUID_CON_WIFI_SCAN: await Task.Delay(2000); FoundSSIDs.Clear(); var ssids = (await node.Config.FetchSSIDs()).Split(',').ToList(); Debug.WriteLine($"Received {ssids.Count - 1} SSIDs "); foreach (var ssid in ssids) { Debug.WriteLine(ssid); if (!string.IsNullOrEmpty(ssid) && !FoundSSIDs.Contains(ssid)) { FoundSSIDs.Add(ssid); } } ScanningProgressRing.IsActive = false; ScanningStatusTextBox.Text = "WiFi scan is completed."; break; case SupportedUuids.UUID_CON_DEVI_CONN: var value = FormatToString(args.CharacteristicValue); await Dispatcher.RunAsync(CoreDispatcherPriority.Low, () => { UpdateConntionStatus(value); }); break; default: break; } }); }