Ble.onConnection(func) is imcopatinble type

14 Sep 2015

Hello everybody,

According to the API documentation if you want to get the event when I client is connecting to your mbed you can subcribe to the event

void onConnection (Gap::ConnectionEventCallback_t connectionCallback) Setup a callback for connection events.

So I did it:

ble.onConnection(connectionCallback);

void connectionCallback(Gap::ConnectionEventCallback_t connectionCallback) { if(debug) printf(" Conexion del cliente -- XXX\n"); led = 1; }

Why I get the below issue?

issue: Error: Argument of type "void (*)(Gap::ConnectionEventCallback_t)" is incompatible with parameter of type "Gap::ConnectionEventCallback_t" in "main.cpp", Line: 118, Col: 23

thanks in advance. Alarcón.

14 Sep 2015

Gap::ConnectionEventCallback_t is declared as a function which takes in a const ConnectionCallbackParams_t * (refer to https://github.com/ARMmbed/ble/blob/master/ble/Gap.h#L136)

your onConnection() takes Gap::ConnectionEventCallback_t, which is not how it is supposed to be.