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
  • Hello,

    How do you determine that you continue to receive data after it has disconnected? That shouldn't be possible.

    Is it your central that is connected to multiple peripherals? How do you assign the conn_handles? I suggest that you look into the ble_app_multilink_central example to see how it is done here. Note that it requires some changes in ble_nus_c.c

    Also, the ble_nus_c_evt_handler() doesn't contain the conn_handle of which connection it came from. If you want this, then you must add it in on_hvx() in ble_nus_c.c

    Add the line:

    ble_nus_c_evt.conn_handle = p_ble_evt->evt.gattc_evt.conn_handle;

    before the line 

    p_ble_nus_c->evt_handler(p_ble_nus_c, &ble_nus_c_evt);

  • Hello,

    Thank you for your help. I already applied this fix (found in forum elsewhere). How can I get a strong index please ?

Reply Children
Related