This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

The difference between (dm_handle_t) "connection_id" and "conn_handle"

Hi all,

I want to clarify are there any deference between "connection_id" and "conn_handle" ?

I use a multilink central application with 8 possible peripherals devices and I can see that both this parameters all time have the same value.

Can I supposed that in my case the conn_handle == connection_id all time?

It will helps to avoid ugly functions like client_find(conn_handle).

Best regards, Ivan

Parents
  • Ok, Example "multilink central" SDK 10.0.0:

    uint32_t client_find(uint16_t conn_handle)
    {
        for (i = 0; i < MAX_CLIENTS; i++)
        {
            if (m_client[i].srv_db.conn_handle == conn_handle)
            {
                return i;
            }
        }
    }
    
    void db_discovery_evt_handler(ble_db_discovery_evt_t * p_evt)
    {
    	/* ... */
    	index = client_find(p_evt->conn_handle);
    	/* ... */
    }
    
    void client_handling_ble_evt_handler(ble_evt_t * p_ble_evt)
    {
    	/* ... */
        index = client_find(p_ble_evt->evt.gattc_evt.conn_handle);
    	/* ... */
    }
    
    uint32_t client_handling_create(const dm_handle_t * p_handle, uint16_t conn_handle)
    {
    	/* ALWAYS: p_handle->connection_id == conn_handle */
        m_client[p_handle->connection_id].srv_db.conn_handle = conn_handle;
    	/* ... */
    }
    

    client_find() - useless!

Reply
  • Ok, Example "multilink central" SDK 10.0.0:

    uint32_t client_find(uint16_t conn_handle)
    {
        for (i = 0; i < MAX_CLIENTS; i++)
        {
            if (m_client[i].srv_db.conn_handle == conn_handle)
            {
                return i;
            }
        }
    }
    
    void db_discovery_evt_handler(ble_db_discovery_evt_t * p_evt)
    {
    	/* ... */
    	index = client_find(p_evt->conn_handle);
    	/* ... */
    }
    
    void client_handling_ble_evt_handler(ble_evt_t * p_ble_evt)
    {
    	/* ... */
        index = client_find(p_ble_evt->evt.gattc_evt.conn_handle);
    	/* ... */
    }
    
    uint32_t client_handling_create(const dm_handle_t * p_handle, uint16_t conn_handle)
    {
    	/* ALWAYS: p_handle->connection_id == conn_handle */
        m_client[p_handle->connection_id].srv_db.conn_handle = conn_handle;
    	/* ... */
    }
    

    client_find() - useless!

Children
No Data
Related