Arm Mbed OS support forum


I am following an example code but I am getting the following error:

Error: Class “Gap” has no member “getConnectionHandle” in “main.cpp”,

this is the line:

connHandle =;

Is there any other way to know the connection Handle for a BLE connection in MBED?

@mreiscarneiro the easiest way to get hold of the connection handle is if you subscribe to the onConnectionComplete event. In the example below I have subscribed to the onConnectionComplete event and when this event is called you could store that connection handle for later use.

void TestClass::onConnectionComplete(const ble::ConnectionCompleteEvent &event)
        printf("Connection Handle: %d", event.getConnectionHandle());

Hope that helps.