Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
card10
firmware
Commits
1c4e9678
Commit
1c4e9678
authored
4 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
feat(ble): Add pretty event printing
parent
25626ba3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!390
Bonding dialog
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
epicardium/ble/ble_main.c
+117
-0
117 additions, 0 deletions
epicardium/ble/ble_main.c
with
117 additions
and
0 deletions
epicardium/ble/ble_main.c
+
117
−
0
View file @
1c4e9678
...
...
@@ -21,6 +21,7 @@
#include
"wsf_msg.h"
#include
"wsf_trace.h"
#include
"hci_api.h"
#include
"l2c_api.h"
#include
"dm_api.h"
#include
"att_api.h"
#include
"smp_api.h"
...
...
@@ -202,6 +203,109 @@ static dmConnId_t pair_connId = DM_CONN_ID_NONE;
static
uint32_t
pair_confirm_value
;
static
void
BleHandler
(
wsfEventMask_t
event
,
wsfMsgHdr_t
*
pMsg
);
static
const
char
*
const
att_events
[]
=
{
"ATTC_FIND_INFO_RSP"
,
"ATTC_FIND_BY_TYPE_VALUE_RSP"
,
"ATTC_READ_BY_TYPE_RSP"
,
"ATTC_READ_RSP"
,
"ATTC_READ_LONG_RSP"
,
"ATTC_READ_MULTIPLE_RSP"
,
"ATTC_READ_BY_GROUP_TYPE_RSP"
,
"ATTC_WRITE_RSP"
,
"ATTC_WRITE_CMD_RSP"
,
"ATTC_PREPARE_WRITE_RSP"
,
"ATTC_EXECUTE_WRITE_RSP"
,
"ATTC_HANDLE_VALUE_NTF"
,
"ATTC_HANDLE_VALUE_IND"
,
/* ATT server callback events */
"ATTS_HANDLE_VALUE_CNF"
,
"ATTS_CCC_STATE_IND"
,
"ATTS_DB_HASH_CALC_CMPL_IND"
,
/* ATT common callback events */
"ATT_MTU_UPDATE_IND"
};
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"
};
static
const
char
*
const
l2c_coc_events
[]
=
{
"L2C_COC_CONNECT_IND"
,
"L2C_COC_DISCONNECT_IND"
,
"L2C_COC_DATA_IND"
,
"L2C_COC_DATA_CNF"
};
/*************************************************************************************************/
/*!
* \brief Application DM callback.
...
...
@@ -656,12 +760,25 @@ static void BleHandler(wsfEventMask_t event, wsfMsgHdr_t *pMsg)
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 */
AppSlaveProcDmMsg
((
dmEvt_t
*
)
pMsg
);
/* process security-related messages */
AppSlaveSecProcDmMsg
((
dmEvt_t
*
)
pMsg
);
}
else
if
(
pMsg
->
event
>=
ATT_CBACK_START
&&
pMsg
->
event
<=
ATT_CBACK_END
)
{
LOG_INFO
(
"ble"
,
"Ble got evt %d: %s"
,
pMsg
->
event
,
att_events
[
pMsg
->
event
-
ATT_CBACK_START
]);
}
else
if
(
pMsg
->
event
>=
L2C_COC_CBACK_START
&&
pMsg
->
event
<=
L2C_COC_CBACK_CBACK_END
)
{
LOG_INFO
(
"ble"
,
"Ble got evt %d: %s"
,
pMsg
->
event
,
l2c_coc_events
[
pMsg
->
event
-
L2C_COC_CBACK_START
]);
}
else
{
LOG_INFO
(
"ble"
,
"Ble got evt %d"
,
pMsg
->
event
);
}
/* perform profile and user interface-related operations */
bleProcMsg
((
bleMsg_t
*
)
pMsg
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment