32feet
32feet copied to clipboard
Way to bypass Windows 10 pair device permission?
Context: I'm working on a Windows 10 app that will allow users to quickly connect to a Bluetooth device. Because the native API is difficult to work with, I'm using the 'In The Hand' library. Anyway, back to the point: whenever I make a connect request. Before allowing me to connect, I receive this Pair a device notification.
I'm wondering if I can set Windows to automatically accept this permission for connecting the device. Is there a method in the Windows API that I can use to accomplish this?
Link to my code: https://github.com/hasham7861/bluetooth-le-experiment/blob/master/Program.cs
BluetoothSecurity.PairRequest can automate the pairing process with a known PIN or numerical value.
Thank you @peterfoot one question though in the windows bluetooth settings, it says my headphones are connected but the device itself does not receive any notification that it is connected already. Is there a helper to communicate to signal the device that it is now connected.
My code is now this:
// pair of the device
BluetoothSecurity.PairRequest(device.deviceAddress, inputPin);
// categorize into audio section for windows
device.setServiceState(BluetoothService.Handsfree,true);