public async Task TestConnectionAsync(string serviceUuid, string characteristicUuid) { IsDeviceConnected = false; if (bluetoothLeService.ConnectedDevice != null) { if (await bluetoothLeService.WriteToServiceCharacteristicAsync("test#", serviceUuid, characteristicUuid)) { IsDeviceConnected = true; } else { await dialogService.DisplayDialogAsync("Connection failed", "Could not connect with device. Please check the connection and select the correct device.", "Ok"); } } RaisePropertyChanged(nameof(ConnectionStatus)); }
public override async Task RefreshAsync() { IsBusy = true; // Check BluetoothLE connection status if (bluetoothLeService.GetConnectionStatus()) { // Get a list of BluetoothLE devices var availableBluetoothDevices = await bluetoothLeService.ScanForDevicesAsync(); BluetoothDevices.ReplaceRange(availableBluetoothDevices); IsBusy = false; } else { IsBusy = false; // Bluetooth LE not available await dialogService.DisplayDialogAsync("Bluetooth not available", "Bluetooth is not available. Please check your Bluetooth settings and try again", "Ok"); } }