9 years, 6 months ago.

About the callback function "onConnection"

Hello everybody,

When I use a callback function "onConnection" in my code as below:

void onConnection(Gap::Handle_t handle, Gap::addr_type_t peerAddrType, const Gap::address_t peerAddr, const Gap::ConnectionParams_t * connectionParams) { set the initial values of the characteristics (for every session) led_value = 0; onLedDataWritten(&led_value, 1); force LED's to be in off state } ... ... ... ble.onConnection(onConnection); ... ...

Then the compiler generate an error 167:

Error: Argument of type "void (*)(Gap::Handle_t, Gap::addr_type_t, const std::uint8_t *, const Gap::ConnectionParams_t *)" is incompatible with parameter of type "Gap::ConnectionEventCallback_t" in "main.cpp", Line: 198, Col: 24

Please tell me why? and How to remove it?

Thank you for your help!!

Question relating to:

try changing "const Gap::address_t peerAddr" to "const uint8_t* peerAddr" in the definition of your onConnection function

posted by Andy A 04 Jun 2015

Hi Andy, Thanks, but the error still be generated.

posted by Harry Hsiao 05 Jun 2015
Be the first to answer this question.