How do I know if Bluetooth Pairing Request was accepted?

Hi,


I am using Swift 5 to make an iOS application, which connects to the BLE device to read characteristic and also write to the characteristic. I am able to read and write conviniently when I hit 'Pair' to 'Bluetooth Pairing Request'. My questions related to this are:


  1. Can I avoid getting this Bluetooth Pairing request and have my app seamlessly connect to the BLE peripheral?
  2. If not, can I get the response of the user to this Bluetooth Pairing request (Cancel/Pair/No response)?
  3. Since my application needs authentication in order to read and write characteristic values, is there a way I can check if authentication is present? (For me calling CBCentralManager.connect(peripheral) connects to the BLE device irrespective or the authentication, but I am not able to read and write if 'Pair' button wasn't initially selected and I would get CBATTErrorDoman, Code=5 "Authentication is insufficient")
  4. I just want user to hit 'Pair', only then user should be able to access other features in the view, otherwise, app should check the authentication. If there is insufficient authentication, I can take it to different view (I can handle this after this point)

Replies

You'd better move your post to another part of the forum, dedicated to Bluetooth


https://forums.developer.apple.com/community/core-os/bluetooth


Good luck.

Thanks I just did

Thanks.


Could this help for your first question ?

https://stackoverflow.com/questions/37347488/auto-connect-to-ble-device-in-ios-app


And this for the second (there is no direct information)

https://stackoverflow.com/questions/47546690/ios-bluetooth-pairing-request-dialog-can-i-know-the-users-choice