The RTT output screenshot shows messages for BLE_GAP_EVT_CONNECTED, BLE_GAP_EVT_DISCONNECTED, BLE_GAP_EVT_CONN_PARAM_UPDATE
The RTT output screenshot shows messages for BLE_GAP_EVT_CONNECTED, BLE_GAP_EVT_DISCONNECTED, BLE_GAP_EVT_CONN_PARAM_UPDATE
I would guess it's something like this:
case BLE_GAP_EVT_CONNECTED:
SEGGER_RTT_WriteString(0, "GAP Evt: BLE_GAP_EVT_CONNECTED\n");
SEGGER_RTT_printf(0, "\tConn handle: 0x%02x\n", p_ble_evt->evt.gap_evt.conn_handle);
SEGGER_RTT_printf(0, "\tMIN_CONN_INTERVAL: %d\n", p_ble_evt->evt.gap_evt.params.connected.conn_params.min_conn_interval);
SEGGER_RTT_printf(0, "\tCONN_SUP_TIMEOUT: %d\n", p_ble_evt->evt.gap_evt.params.connected.conn_params.conn_sup_timeout);
SEGGER_RTT_printf(0, "\tSLAVE_LATENCY: %d\n", p_ble_evt->evt.gap_evt.params.connected.conn_params.slave_latency);
break; // BLE_GAP_EVT_CONNECTED
case BLE_GAP_EVT_DISCONNECTED:
SEGGER_RTT_WriteString(0, "GAP Evt: BLE_GAP_EVT_DISCONNECTED\n");
SEGGER_RTT_printf(0, "\tConn handle: 0x%02x\n", p_ble_evt->evt.gap_evt.conn_handle);
SEGGER_RTT_printf(0, "\t%d\n", p_ble_evt->evt.gap_evt.params.disconnected.reason);
break; // BLE_GAP_EVT_DISCONNECTED
case BLE_GAP_EVT_CONN_PARAM_UPDATE:
SEGGER_RTT_WriteString(0, "GAP Evt: BLE_GAP_EVT_CONN_PARAM_UPDATE\n");
SEGGER_RTT_printf(0, "\tConn handle: 0x%02x\n", p_ble_evt->evt.gap_evt.conn_handle);
SEGGER_RTT_printf(0, "\tMIN_CONN_INTERVAL: %d\n", p_ble_evt->evt.gap_evt.params.conn_param_update.conn_params.min_conn_interval);
SEGGER_RTT_printf(0, "\tCONN_SUP_TIMEOUT: %d\n", p_ble_evt->evt.gap_evt.params.conn_param_update.conn_params.conn_sup_timeout);
SEGGER_RTT_printf(0, "\tSLAVE_LATENCY: %d\n", p_ble_evt->evt.gap_evt.params.conn_param_update.conn_params.slave_latency);
break; // BLE_GAP_EVT_CONN_PARAM_UPDATE
Note that this will only print the status number of the disconnect reason. You can compare it against this list.
Jørgen, thanks. I noticed that there are two files, msgs.c and msgs.h that has all these definitions, but it is not used by the tutorial. Is there a way to use / leverage that to do the printing to RTT? Any help appreciated.
Sorry, I did not see that file. Yes, you should be able to call print_evt()
in on_ble_evt()
handler if you include msgs.h in the application.
Jørgen, Thanks. Yes I added print_evt(p_ble_evt); // Call print_evt() in msgs.c Then at least the case BLE_GAP_EVT_DISCONNECTED: and case BLE_GAP_EVT_CONNECTED: print. There is no case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST: But that is OK for now.
Jørgen, Thanks. Yes I added print_evt(p_ble_evt); // Call print_evt() in msgs.c Then at least the case BLE_GAP_EVT_DISCONNECTED: and case BLE_GAP_EVT_CONNECTED: print. There is no case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST: But that is OK for now.