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.

LAUNCHXL-CC26X2R1: How to obtain currently active connection handle for Multiple connection on peripheral side

Part Number: LAUNCHXL-CC26X2R1


Hi

We use two phones to connect with LaunchPad simultaneous,  LaunchPad has notifications, and both phones are subscribed to notifications.

When LaunchPad want to transmit notifications to both phones. Do you have any methods to get currently active connection handle?

Thanks.

BR

Trevor

  • Hi Trevor,

    I have assigned an expert to comment on this. 

    Best Regards,
    Alec

  • Trevor,

    What SDK version are you using? Are you using an example project?

    In short, there isn't an API that will give you the active connection handles.

    However, my recommendation is that you start with our simple_peripheral example from your SDK.

    Here, you will see that, when a connection is established, the stack triggers a GAP_LINK_ESTABLISHED_EVENT. When you handle the event, you can keep track of connections (through their handles) as exemplified in function SimplePeripheral_addConn(uint16_t handle), from simple_peripheral. This function adds the connection to an array called connList.

    If you use simple_peripheral as a baseline, you can then use this connList to keep track of your connections.

    I recommend that you take a look at our SimpleLink Academy labs, such as the one on Connections. In particular, you can see how on Task 6 - Terminate the Connection, we show how you can iterate through the array. Something like this:

        uint8_t i;
        for(i = 0; i < MAX_NUM_BLE_CONNS; i++)
        {
            //For existing connections, terminate the link.
            if (connList[i].connHandle != 0xFFFF)
            {
                GAP_TerminateLinkReq(connList[i].connHandle, HCI_DISCONNECT_REMOTE_USER_TERM);
    
                Log_info0("Terminating connection(s).");
            }
        }

    I hope this helps.

    -Luis

  • Hi Luis,

    Thanks for your information, but it couldn't solve our questions.

    You could refer to following screenshot, if Launchpad have connected to 8 peers(Central).

    For example 1:

    When LaunchPad wants to transmit notifications to all centrals, if the currently active connection handle is peer1. we believe that using your method to iterate through the array can transmit notifications to all centrals. it should be work.

    For example 2:

    When LaunchPad wants to transmit notifications to all centrals, if the currently active connection handle is peer3. Using your method to iterate through the array, it doesn't work. Because the wrong connection handle was used.

    Regarding above state, just my opinion, do you have any comments for us?

    Thanks

    
    

    BR

    Trevor

  • Trevor,

    Can you please clarify what is your intent?

    Are you trying to send notifications to multiple phones? Are you planning to do this periodically?

    I need to do some research on how to do this. 

    Thanks,

    Luis

  • Hi Luis,

    Yes, we used the Clock Module(the period time is around 50ms) to transmit notifications to both phones.

    For example:

    LP transmit 240byte(#1) data to Multiple phones

    sleep 50ms

    LP transmit 240byte(#2) data to Multiple phones

    sleep 50ms

    LP transmit 240byte(#3) data to Multiple phones

    sleep 50ms

    LP transmit 240byte(#4) data to Multiple phones

    sleep 50ms

    LP transmit 240byte(#N) data to Multiple phones

    Thanks.

    BR

    Trevor

  • Hi Luis,

    Do you have any idea on our question? if the peripheral device can't obtain the currently active connection handle, do you know whether the central device has the capability of obtaining the currently active connection handle?

    Thanks.

    BR

    Trevor

  • Trevor,

    I believe that your use case is exemplified in our SimpleLink Academy Lab called "Custom Profile". I would recommend going through it.

    Now, very specifically, from your diagrams you could learn the "active connection handle" by registering for a callback from the stack when a connection event happens, using our GAP layer's API named GAP_RegisterConnEvtCb(), on which you will pass a pointer to a function that will receive as a parameter a structure that has the connection handle of the active connection. 

    Thanks,

    Luis

  • Hi Luis,

    About GAP_RegisterConnEvtCb(), we are worried that it may impact the system performance when peripheral connects to many peers.

    But there seems to be only this method.

    Thanks.

    BR

    Trevor