Skip to content
Snippets Groups Projects
Commit 0dc0bb5c authored by schneider's avatar schneider
Browse files

feat(ble): Add pretty event printing

parent e8831dbb
Branches
Tags
No related merge requests found
...@@ -202,6 +202,80 @@ static dmConnId_t pair_connId = DM_CONN_ID_NONE; ...@@ -202,6 +202,80 @@ static dmConnId_t pair_connId = DM_CONN_ID_NONE;
static uint32_t pair_confirm_value; static uint32_t pair_confirm_value;
static void BleHandler(wsfEventMask_t event, wsfMsgHdr_t *pMsg); static void BleHandler(wsfEventMask_t event, wsfMsgHdr_t *pMsg);
static const char * const dm_events[] = {
"DM_RESET_CMPL_IND",
"DM_ADV_START_IND",
"DM_ADV_STOP_IND",
"DM_ADV_NEW_ADDR_IND",
"DM_SCAN_START_IND",
"DM_SCAN_STOP_IND",
"DM_SCAN_REPORT_IND",
"DM_CONN_OPEN_IND",
"DM_CONN_CLOSE_IND",
"DM_CONN_UPDATE_IND",
"DM_SEC_PAIR_CMPL_IND",
"DM_SEC_PAIR_FAIL_IND",
"DM_SEC_ENCRYPT_IND",
"DM_SEC_ENCRYPT_FAIL_IND",
"DM_SEC_AUTH_REQ_IND",
"DM_SEC_KEY_IND",
"DM_SEC_LTK_REQ_IND",
"DM_SEC_PAIR_IND",
"DM_SEC_SLAVE_REQ_IND",
"DM_SEC_CALC_OOB_IND",
"DM_SEC_ECC_KEY_IND",
"DM_SEC_COMPARE_IND",
"DM_SEC_KEYPRESS_IND",
"DM_PRIV_RESOLVED_ADDR_IND",
"DM_PRIV_GENERATE_ADDR_IND",
"DM_CONN_READ_RSSI_IND",
"DM_PRIV_ADD_DEV_TO_RES_LIST_IND",
"DM_PRIV_REM_DEV_FROM_RES_LIST_IND",
"DM_PRIV_CLEAR_RES_LIST_IND",
"DM_PRIV_READ_PEER_RES_ADDR_IND",
"DM_PRIV_READ_LOCAL_RES_ADDR_IND",
"DM_PRIV_SET_ADDR_RES_ENABLE_IND",
"DM_REM_CONN_PARAM_REQ_IND",
"DM_CONN_DATA_LEN_CHANGE_IND",
"DM_CONN_WRITE_AUTH_TO_IND",
"DM_CONN_AUTH_TO_EXPIRED_IND",
"DM_PHY_READ_IND",
"DM_PHY_SET_DEF_IND",
"DM_PHY_UPDATE_IND",
"DM_ADV_SET_START_IND",
"DM_ADV_SET_STOP_IND",
"DM_SCAN_REQ_RCVD_IND",
"DM_EXT_SCAN_START_IND",
"DM_EXT_SCAN_STOP_IND",
"DM_EXT_SCAN_REPORT_IND",
"DM_PER_ADV_SET_START_IND",
"DM_PER_ADV_SET_STOP_IND",
"DM_PER_ADV_SYNC_EST_IND",
"DM_PER_ADV_SYNC_EST_FAIL_IND",
"DM_PER_ADV_SYNC_LOST_IND",
"DM_PER_ADV_SYNC_TRSF_EST_IND",
"DM_PER_ADV_SYNC_TRSF_EST_FAIL_IND",
"DM_PER_ADV_SYNC_TRSF_IND",
"DM_PER_ADV_SET_INFO_TRSF_IND",
"DM_PER_ADV_REPORT_IND",
"DM_REMOTE_FEATURES_IND",
"DM_READ_REMOTE_VER_INFO_IND",
"DM_CONN_IQ_REPORT_IND",
"DM_CTE_REQ_FAIL_IND",
"DM_CONN_CTE_RX_SAMPLE_START_IND",
"DM_CONN_CTE_RX_SAMPLE_STOP_IND",
"DM_CONN_CTE_TX_CFG_IND",
"DM_CONN_CTE_REQ_START_IND",
"DM_CONN_CTE_REQ_STOP_IND",
"DM_CONN_CTE_RSP_START_IND",
"DM_CONN_CTE_RSP_STOP_IND",
"DM_READ_ANTENNA_INFO_IND",
"DM_L2C_CMD_REJ_IND",
"DM_ERROR_IND",
"DM_HW_ERROR_IND",
"DM_VENDOR_SPEC_IND"
};
/*************************************************************************************************/ /*************************************************************************************************/
/*! /*!
* \brief Application DM callback. * \brief Application DM callback.
...@@ -657,11 +731,14 @@ static void BleHandler(wsfEventMask_t event, wsfMsgHdr_t *pMsg) ...@@ -657,11 +731,14 @@ static void BleHandler(wsfEventMask_t event, wsfMsgHdr_t *pMsg)
if (pMsg->event >= DM_CBACK_START && pMsg->event <= DM_CBACK_END) if (pMsg->event >= DM_CBACK_START && pMsg->event <= DM_CBACK_END)
{ {
LOG_INFO("ble", "Ble got evt %d: %s", pMsg->event, dm_events[pMsg->event - DM_CBACK_START]);
/* process advertising and connection-related messages */ /* process advertising and connection-related messages */
AppSlaveProcDmMsg((dmEvt_t *) pMsg); AppSlaveProcDmMsg((dmEvt_t *) pMsg);
/* process security-related messages */ /* process security-related messages */
AppSlaveSecProcDmMsg((dmEvt_t *) pMsg); AppSlaveSecProcDmMsg((dmEvt_t *) pMsg);
} else {
LOG_INFO("ble", "Ble got evt %d", pMsg->event);
} }
/* perform profile and user interface-related operations */ /* perform profile and user interface-related operations */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment