-
Notifications
You must be signed in to change notification settings - Fork 21
sdh: simplifications and improvements #388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
2b9ee6a
1e893a9
28089a4
a767014
c200b77
4229682
307d8e5
c8c251d
ab5e941
822882b
565a9cf
093c9f1
9431dee
a0bd9e2
39652c2
e07d39b
381bff5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -15,9 +15,10 @@ | |||||||
|
||||||||
LOG_MODULE_DECLARE(nrf_sdh, CONFIG_NRF_SDH_LOG_LEVEL); | ||||||||
|
||||||||
const char *gap_evt_tostr(int evt) | ||||||||
const char *ble_evt_tostr(int evt) | ||||||||
{ | ||||||||
switch (evt) { | ||||||||
/* GAP */ | ||||||||
case BLE_GAP_EVT_CONNECTED: | ||||||||
return "BLE_GAP_EVT_CONNECTED"; | ||||||||
Comment on lines
29
to
30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could do
Suggested change
to save some lines. But I guess returning from inside a macro is considered bad practice. Better to be explicit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I prefer the current implementation. Otherwise we start devolving into too much macro magic. |
||||||||
case BLE_GAP_EVT_DISCONNECTED: | ||||||||
|
@@ -70,6 +71,53 @@ const char *gap_evt_tostr(int evt) | |||||||
#endif | ||||||||
case BLE_GAP_EVT_ADV_SET_TERMINATED: | ||||||||
return "BLE_GAP_EVT_ADV_SET_TERMINATED"; | ||||||||
|
||||||||
/* GATTS */ | ||||||||
case BLE_GATTS_EVT_WRITE: | ||||||||
return "BLE_GATTS_EVT_WRITE"; | ||||||||
case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: | ||||||||
return "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST"; | ||||||||
case BLE_GATTS_EVT_SYS_ATTR_MISSING: | ||||||||
return "BLE_GATTS_EVT_SYS_ATTR_MISSING"; | ||||||||
case BLE_GATTS_EVT_HVC: | ||||||||
return "BLE_GATTS_EVT_HVC"; | ||||||||
case BLE_GATTS_EVT_SC_CONFIRM: | ||||||||
return "BLE_GATTS_EVT_SC_CONFIRM"; | ||||||||
case BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST: | ||||||||
return "BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST"; | ||||||||
case BLE_GATTS_EVT_TIMEOUT: | ||||||||
return "BLE_GATTS_EVT_TIMEOUT"; | ||||||||
case BLE_GATTS_EVT_HVN_TX_COMPLETE: | ||||||||
return "BLE_GATTS_EVT_HVN_TX_COMPLETE"; | ||||||||
|
||||||||
/* GATTC */ | ||||||||
case BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP: | ||||||||
return "BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP"; | ||||||||
case BLE_GATTC_EVT_REL_DISC_RSP: | ||||||||
return "BLE_GATTC_EVT_REL_DISC_RSP"; | ||||||||
case BLE_GATTC_EVT_CHAR_DISC_RSP: | ||||||||
return "BLE_GATTC_EVT_CHAR_DISC_RSP"; | ||||||||
case BLE_GATTC_EVT_DESC_DISC_RSP: | ||||||||
return "BLE_GATTC_EVT_DESC_DISC_RSP"; | ||||||||
case BLE_GATTC_EVT_ATTR_INFO_DISC_RSP: | ||||||||
return "BLE_GATTC_EVT_ATTR_INFO_DISC_RSP"; | ||||||||
case BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP: | ||||||||
return "BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP"; | ||||||||
case BLE_GATTC_EVT_READ_RSP: | ||||||||
return "BLE_GATTC_EVT_READ_RSP"; | ||||||||
case BLE_GATTC_EVT_CHAR_VALS_READ_RSP: | ||||||||
return "BLE_GATTC_EVT_CHAR_VALS_READ_RSP"; | ||||||||
case BLE_GATTC_EVT_WRITE_RSP: | ||||||||
return "BLE_GATTC_EVT_WRITE_RSP"; | ||||||||
case BLE_GATTC_EVT_HVX: | ||||||||
return "BLE_GATTC_EVT_HVX"; | ||||||||
case BLE_GATTC_EVT_EXCHANGE_MTU_RSP: | ||||||||
return "BLE_GATTC_EVT_EXCHANGE_MTU_RSP"; | ||||||||
case BLE_GATTC_EVT_TIMEOUT: | ||||||||
return "BLE_GATTC_EVT_TIMEOUT"; | ||||||||
case BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE: | ||||||||
return "BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE"; | ||||||||
|
||||||||
default: | ||||||||
return "unknown"; | ||||||||
} | ||||||||
|
@@ -298,7 +346,7 @@ static void ble_evt_poll(void *context) | |||||||
} | ||||||||
|
||||||||
if (IS_ENABLED(CONFIG_NRF_SDH_STR_TABLES)) { | ||||||||
LOG_DBG("BLE event: %s", gap_evt_tostr(ble_evt->header.evt_id)); | ||||||||
LOG_DBG("BLE event: %s", ble_evt_tostr(ble_evt->header.evt_id)); | ||||||||
} else { | ||||||||
LOG_DBG("BLE event: %#x", ble_evt->header.evt_id); | ||||||||
} | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.