1 Reply Latest reply on Aug 22, 2015 5:27 AM by rohit.kumar

    Connection Handles

    user_516327008

      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? 

        • 1. Re: Connection Handles
          rohit.kumar

          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.