public ConnectedPeripheralsViewModel(ICentralManager centralManager) { this.Load = ReactiveCommand.CreateFromTask(async() => { var peripherals = await centralManager.GetConnectedPeripherals(); //peripherals.Select(x => x // TODO: get TBD connected devices too }); }
public void GetConnectedDevices() { _connectedDisposable = _centralManager.GetConnectedPeripherals().Subscribe(scanResult => { scanResult.ToList().ForEach( item => { if (!string.IsNullOrEmpty(item.Name)) { BluetoothDevices.Add(item); } }); _connectedDisposable?.Dispose(); }); if (_centralManager.IsScanning) { _centralManager.StopScan(); } }