Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 internal static extern bool BluetoothSelectDevicesFree(
     ref BLUETOOTH_SELECT_DEVICE_PARAMS pbtsdp);