-
-
Notifications
You must be signed in to change notification settings - Fork 204
Description
I have what appears to be some kind of issue where when setting a custom gap handler by setting:
NimBLEDevice::setCustomGapHandler(customGapHandler, nullptr);
The problem is that not all BLE_GAP_EVENT_ events seem to be propagated to the custom handler.
So, to help see what's happening, I enable flags in nimconfig.h:
#define CONFIG_NIMBLE_CPP_LOG_LEVEL 4
#define CONFIG_NIMBLE_CPP_DEBUG_ASSERT_ENABLED 1
I also print a message marked with "Custom GAP EVENT:" as soon as the handler is called:
int customGapHandler(ble_gap_event *event, void *arg)
{
Serial.printf("\nCustom GAP EVENT: %s\n", NimBLEUtils::gapEventToString(event->type));
...
Then in this console log it can be seen, upon a pairing request, when the underlying BLE_GAP_EVENT_PASSKEY_ACTION and BLE_GAP_EVENT_PARING_COMPLETE events are received, they are not propagated on to the custom handler.
Custom GAP EVENT: BLE_GAP_EVENT_LINK_ESTAB
D NimBLEServer: >> handleGapEvent: BLE_GAP_EVENT_LINK_ESTAB
D NimBLEServer: << handleGapEvent
Custom GAP EVENT: BLE_GAP_EVENT_DATA_LEN_CHG
D NimBLEServer: >> handleGapEvent: BLE_GAP_EVENT_DATA_LEN_CHG
D NimBLEServer: << handleGapEvent
D NimBLEServer: >> handleGapEvent: BLE_GAP_EVENT_PASSKEY_ACTION
D NimBLEServer: << handleGapEvent
D NimBLEServer: >> handleGapEvent: BLE_GAP_EVENT_PARING_COMPLETE
D NimBLEServer: << handleGapEvent
Background to this is that I am attempting to create a BLE peripheral which properly handles the case where a peripheral is configured to only have Keyboard capability while the pairing partner has at least Display capability. The BT spec indicates an initiatee device allows the displayed passkey to be entered, but in lieu of this library supporting this, I'd like to figure out how I can enable this in the implementation.