![](/img/trans.png)
[英]Is there any way to pair Bluetooth device in Windows programmatically
[英]Skipping confirmation popup or overriding for Bluetooth Device pair in windows from UWP app?
連接到任何藍牙設備時,會出現來自 windows 的是/否彈出窗口。
從應用程序中,有沒有辦法以編程方式跳過這個是/否彈出窗口?
檢查了一些文檔。
如果你只想連接到一個藍牙設備並且它是一個 BLE 設備,你可以看看這個文檔BluetoothLE GATT client 。
作為此處的示例代碼:
DeviceWatcher deviceWatcher =
DeviceInformation.CreateWatcher(
BluetoothLEDevice.GetDeviceSelectorFromPairingState(false),
requestedProperties,
DeviceInformationKind.AssociationEndpoint);
您可以看到DeviceWatcher
可以模擬甚至沒有配對的 BLE 設備。 然后您可以調用BluetoothLEDevice.FromIdAsync
來創建 BluetoothLEDevice 設備。
BluetoothLEDevice bluetoothLeDevice = await BluetoothLEDevice.FromIdAsync(deviceInfo.Id);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.