public Task <BluetoothDeviceInfo> PickSingleDeviceAsync() { BluetoothDeviceInfo info = null; BLUETOOTH_SELECT_DEVICE_PARAMS p = new BLUETOOTH_SELECT_DEVICE_PARAMS(); p.Reset(); p.SetClassOfDevices(ClassOfDevices.ToArray()); p.fForceAuthentication = RequireAuthentication; p.hwndParent = NativeMethods.GetActiveWindow(); if (NativeMethods.BluetoothSelectDevices(ref p)) { info = new BluetoothDeviceInfo(p.Device); } return(Task.FromResult(info)); }
private async Task <BluetoothDeviceInfo> DoPickSingleDeviceAsync() { BLUETOOTH_SELECT_DEVICE_PARAMS p = new BLUETOOTH_SELECT_DEVICE_PARAMS(); p.Reset(); p.SetClassOfDevices(ClassOfDevices.ToArray()); p.fForceAuthentication = RequireAuthentication; bool success = NativeMethods.BluetoothSelectDevices(ref p); if (success) { return(new BluetoothDeviceInfo(p.Device)); } return(null); }
internal static extern bool BluetoothSelectDevicesFree( ref BLUETOOTH_SELECT_DEVICE_PARAMS pbtsdp);