This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

BLE_GAP_EVT_CONNECTED event and invalid role

Hello,

I use S132 on nRF52 and do multiple roles.

When event BLE_GAP_EVT_CONNECTED is fired, role is invalid (0). How to know that it was a device or central event ?

Code:
uint16_t conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
uint16_t role = ble_conn_state_role(conn_handle);

Execution:
conn_handle = 0
role = 0
Parents
  • It's likely that the code snippet you posted runs before the code that updates the application level states. The role should be available in p_ble_evt->evt.gap_evt.connected.role (or something to that effect), or you can make sure to pass the connected event to the proper handler before running ble_conn_state_role.

Reply
  • It's likely that the code snippet you posted runs before the code that updates the application level states. The role should be available in p_ble_evt->evt.gap_evt.connected.role (or something to that effect), or you can make sure to pass the connected event to the proper handler before running ble_conn_state_role.

Children
No Data
Related