OpenBluetoothToolbox / SimpleBLE

SimpleBLE - the all-in-one Bluetooth library for MacOS, iOS, Windows, Linux and Android.
https://www.simpleble.org
Other
660 stars 111 forks source link

[MacOS] Initial pairing attempts fail with service discovery error #224

Closed BlissChapman closed 1 year ago

BlissChapman commented 1 year ago

Steps to reproduce:

  1. Open a Macbook.
  2. Attempt to connect to a device that requires the user to hit the macOS popup to connect.
  3. If you don't hit the popup immediately, the service discovery process will time out in SimpleBLE and the connection will fail.
  4. Subsequently trying to connect will succeed because there is no popup that needs user action so the timing of the code is not thrown off.
eriklins commented 1 year ago

Would this be considered a bug? Pairing is done on the OS level and fully independent of SimpleBLE and hence pairing would need to be done prior to (attempting) to connect to the device. If not yet paired, it would be up to the device what to allow/expose to the client and if e.g., no services would be exposed and the client still tries to discovery these, then the above behaviour would be the result and actually not a bug.

kdewald commented 1 year ago

It is, the connection timeouts are too strict (also on Windows I think), causing an exception to be thrown too early in the process, while the user would still have time to finish it manually.

kdewald commented 1 year ago

Fixed in https://github.com/OpenBluetoothToolbox/SimpleBLE/pull/233