This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2640R2F: GAP_LINK_ESTABLISHED_EVENT pEvent->gap.hdr.status != SUCCESS

Part Number: CC2640R2F
Other Parts Discussed in Thread: BLE-STACK

Hi team,

We are looking at simple_central.c in the simple_central example and would like to know under what circumstances would we reach the else statement (line 881) in the GAP_LINK_ESTABLISHED_EVENT case (i.e. pEvent->gap.hdr.status != SUCCESS)?

Since this happens after the GAPCentralRole_EstablishLink(), will the stack continue to attempt to connect to the peripheral? If not, will the application call GAPCentralRole_EstablishLink() again to connect to the peripheral?

Also, will the stack send a GAP_LINK_TERMINATED_EVENT after the connection fails?

Regards,

Akash Patel 

  • Hi Akash,

    What SDK and BLE-Stack version are you using?

    For the central, pEvent->gap.hdr.status in GAP_LINK_ESTABLISHED_EVENT this message is sent to complete the Establish Link Request.

    For most fail cases, you would expect a fail return status of GAPCentralRole_EstablishLink(), not a fail status with GAP_LINK_ESTABLISHED_EVENT. However, if the slave never shows up for any connection events you will get GAP_LINK_ESTABLISHED_EVENT with a fail status to indicate this.

    The stack will not re-try to establish the connection (but you can implement this in your application).

    You will not get a GAP_LINK_TERMINATED_EVENT if the connection fails to be established.
  • Hi Marie,

    Thanks for the response. We are using SDK v1.50.00.58.

    Can we add GAPCentralRole_EstablishLink in the else block of the GAP_LINK_ESTABLISHED_EVENT?

    What should we do if the call to GAPCentralRole_EstablishLink fails?

    Regards,
    Akash Patel
  • Hi Akash,

    Yes you can add GAPCentralRole_EstablishLink in the else block of the GAP_LINK_ESTABLISHED_EVENT. However, both for the case of GAP_LINK_ESTABLISHED_EVENT and GAPCentralRole_EstablishLink () fails I would probably re-start device discovery instead.