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

Multiple NUS_C and NUS configuration

Hello,

I use a configuration with multiple NUS_C and NUS links. When I receive events, how to know the index ?

I have seen mutiple exemples using conn_handle but in a only NUS_C configuration (not mixed).

I tried with conn_handle but sometimes, one of my NUS_C can continue to receive data after peer disconnected so I am not sure...

Parents Reply
  • Ok I found. I added a serial number in my transmissions and after disconnect BLE_NUS_C_EVT_NUS_TX_EVT continues to be called with the same frame.

    I did that in my nus_c event handler to fix it:

      case BLE_NUS_C_EVT_DISCONNECTED:
    			{			
    				p_ble_nus_c->conn_handle           = BLE_CONN_HANDLE_INVALID;
    				p_ble_nus_c->handles.nus_tx_handle = BLE_GATT_HANDLE_INVALID;
    				p_ble_nus_c->handles.nus_rx_handle = BLE_GATT_HANDLE_INVALID;
    			}
     

Children
Related