Bluetooth peak code for iOS

I have a BLE peripheral that requires a PIN. I am connecting to this peripheral using the Core Bluetooth CBCentralManager on iOS 7.

When I connect to this peripheral, the "didConnectPeripheral" (central delegate) gets called until the PIN authentication is successful.

iOS only displays the pin dialog after .'ConnectPeripheral 'is called.

I need to start communicating with the peripheral as soon as this PIN dialog is complete and the authentication process is complete. How can I tell when this happened?

The task is only to complete the post- authentication successfully, but:

  • iOS calls 'didFailToConnectPeripheral' earlier in the show dialog.
  • iOS no longer calls "didConnectPeripheral" if PIN authorization is successful.
  • iOS does not call "didFailToConnectPeripheral" again if PIN authentication fails.

From the above, I was unable to determine:

  • When the dialogue is over.
  • Whether the PIN authorization was successful.

Any help would be appreciated.

+3


source to share


1 answer


From my experience with CoreBluetooth, you will not get any information about whether you are authorized and when the PIN code authorization is complete until you attempt an unauthorized action that fails with one of three error responses:

InsufficientEncryption
InsufficientAuthentication
InsufficientAuthorization

      



The peripheral determines which error you return. (Technically they are defined by GATT in the BLE 4.X specs, but all implementation details are controlled on the peripheral side)

+1


source







All Articles