You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-12Lines changed: 15 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,10 @@
1
1
# BluetoothDevicePairing
2
2
Console utility to discover and pair Bluetooth and Bluetooth Low Energy devices.
3
-
4
-
# Note on connecting to Bluetooth devices
5
-
If you pair a device that is not already paired, the utility will also connect to it (this is the default behavior of Windows Bluetooth API)<br>
6
-
However, the pairing will fail if a device is paired but not connected.<br>
7
-
Unfortunately, it is impossible to simulate what the "Connect" button from Windows `Bluetooth and Other devices` dialog does.
8
-
More details can be found here: [How to connect to a paired audio Bluetooth device](https://stackoverflow.com/questions/62502414/how-to-connect-to-a-paired-audio-bluetooth-device-using-windows-uwp-api). Specifically, [here](https://github.com/inthehand/32feet/issues/132#issuecomment-1019786324) I have described my failed attempts to implement this functionality.<br>
3
+
The utility also allows to connect and disconnect from audio Bluetooth devices.
4
+
* If you pair a device that is not already paired, the utility will also connect to it (this is the default behavior of Windows Bluetooth API)<br>
5
+
* If you pair to an already paired audio Bluetooth device, the utility will connect to it.
6
+
* Managing Bluetooth devices by mac is much faster than by name, because it doesn't require device discovery.
7
+
* When managing Bluetooth devices by name, you can use the `--discovery-time` parameter to change the time spend on device discovery.
The BluetoothDevicePairing utility can be used in bat and PowerShell scripts.
@@ -70,11 +77,6 @@ if %ErrorLevel% NEQ 0 (
70
77
)
71
78
```
72
79
73
-
# How it works
74
-
The program uses
75
-
*[Windows.Devices.Enumeration API](https://docs.microsoft.com/en-us/uwp/api/Windows.Devices.Enumeration?redirectedfrom=MSDN&view=winrt-22000) to work with Bluetooth.
76
-
*[Costura Fody](https://github.com/Fody/Costura) to create a single file executable.
77
-
78
80
### Device pairing by name
79
81
To pair a device by name, the utility starts by discovering all available devices and tries to find a device with the required name. After a device is found, its Mac address is used to request pairing. The command will fail if there are several devices with the same name.
80
82
@@ -83,8 +85,9 @@ If the command fails, it returns the value `-1`. If it succeeds, it returns `0`.
83
85
84
86
# Build
85
87
* Use `Visual Studio 2022` to open the solution file and work with the code
86
-
* Run `.github/workflows/build.ps1` to build a release (to run this script, `git.exe` should be in your PATH)
88
+
* Run `build.ps1` to build a release (to run this script, `git.exe` should be in your PATH)
87
89
88
90
# References
89
91
*[Windows.Devices.Enumeration API usage examples](https://github.com/microsoft/Windows-universal-samples/tree/master/Samples/DeviceEnumerationAndPairing)
0 commit comments