Connection Handles

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

From what I've seen, for connection handles, you simply declare something along the lines of:

   

CYBLE_CONN_HANDLE_T  connectionHandle;

   

and it stores the connection handle when connected. My question is how do you differentiate connection handles? If I want to, for example, send a write request to another device, how do I put in the correct connection handle? 

0 Likes
1 Solution
Anonymous
Not applicable

That is not true. Simply declaring the connection handle will not store a value to it.

   

If you declare something like 'CYBLE_CONN_HANDLE_T  connectionHandle' and want to use 'connectionHandle', then you need to assign the connection handle value at every connection under 'CYBLE_EVT_GATT_CONNECT_IND' event in Event Handler function of BLE.

   

 

   

 case CYBLE_EVT_GATT_CONNECT_IND:
            connectionHandle = *(CYBLE_CONN_HANDLE_T *)eventParam;

   

 

   

Rather assigning the value in application and using it, you can use the stack variable 'cyBle_connHandle' directly as it is automatically updated by stack whenever a new connection is made.

View solution in original post

0 Likes
1 Reply
Anonymous
Not applicable

That is not true. Simply declaring the connection handle will not store a value to it.

   

If you declare something like 'CYBLE_CONN_HANDLE_T  connectionHandle' and want to use 'connectionHandle', then you need to assign the connection handle value at every connection under 'CYBLE_EVT_GATT_CONNECT_IND' event in Event Handler function of BLE.

   

 

   

 case CYBLE_EVT_GATT_CONNECT_IND:
            connectionHandle = *(CYBLE_CONN_HANDLE_T *)eventParam;

   

 

   

Rather assigning the value in application and using it, you can use the stack variable 'cyBle_connHandle' directly as it is automatically updated by stack whenever a new connection is made.

0 Likes