Closed massi-ang closed 4 years ago
@ravibhagavandas I have done few fixes addressing your comments.
Basically, after the connection to the BLE Gatt server is established, I perform a service discovery. When the service discovery is done I will try to read some characteristics (in initialize()
), but not send any other command. In case bonding has been enabled on FreeRTOS this triggers the pairing. The remaining initialization is done when a characteristic is first read successfully, which copes with both bonding enabled and disabled cases.
Devil's in the details. I need to read one single characteristic at first, otherwise if the pairing is cancelled, you get additional paring request for the other reads.
I have move the BLE_INITIALIZED state into the onMtuChanged callback and added a new BLE_INITIALIZING state to indicate that the initialization process has started.
Issue #, if available:
Description of changes: Fixing the way the the SDK manages BLE connect logic on Android based on information from https://medium.com/@martijn.van.welie/making-android-ble-work-part-2-47a3cdaade07
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.