mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-10-18 03:07:56 +00:00
nimble/host: Remove protocols debug logging
BLE_MONITOR provides better ways of debugging HCI and BLE protocols traffic than (incomplete) debug host logs. Instead of duplicating functionality just remove debug logs.
This commit is contained in:
@@ -43,8 +43,6 @@ ble_att_clt_rx_error(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
|
||||
rsp = (struct ble_att_error_rsp *)(*rxom)->om_data;
|
||||
|
||||
BLE_ATT_LOG_CMD(0, "error rsp", conn_handle, ble_att_error_rsp_log, rsp);
|
||||
|
||||
ble_gattc_rx_err(conn_handle, le16toh(rsp->baep_handle),
|
||||
le16toh(rsp->baep_error_code));
|
||||
|
||||
@@ -96,8 +94,6 @@ ble_att_clt_tx_mtu(uint16_t conn_handle, uint16_t mtu)
|
||||
return rc;
|
||||
}
|
||||
|
||||
BLE_ATT_LOG_CMD(1, "mtu req", conn_handle, ble_att_mtu_cmd_log, req);
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
rc = ble_att_conn_chan_find(conn_handle, &conn, &chan);
|
||||
@@ -124,8 +120,6 @@ ble_att_clt_rx_mtu(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
if (rc == 0) {
|
||||
cmd = (struct ble_att_mtu_cmd *)(*rxom)->om_data;
|
||||
|
||||
BLE_ATT_LOG_CMD(0, "mtu rsp", conn_handle, ble_att_mtu_cmd_log, cmd);
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
rc = ble_att_conn_chan_find(conn_handle, NULL, &chan);
|
||||
@@ -172,9 +166,6 @@ ble_att_clt_tx_find_info(uint16_t conn_handle, uint16_t start_handle,
|
||||
req->bafq_start_handle = htole16(start_handle);
|
||||
req->bafq_end_handle = htole16(end_handle);
|
||||
|
||||
BLE_ATT_LOG_CMD(1, "find info req", conn_handle,
|
||||
ble_att_find_info_req_log, req);
|
||||
|
||||
return ble_att_tx(conn_handle, txom);
|
||||
}
|
||||
|
||||
@@ -247,9 +238,6 @@ ble_att_clt_rx_find_info(uint16_t conn_handle, struct os_mbuf **om)
|
||||
|
||||
rsp = (struct ble_att_find_info_rsp *)(*om)->om_data;
|
||||
|
||||
BLE_ATT_LOG_CMD(0, "find info rsp", conn_handle, ble_att_find_info_rsp_log,
|
||||
rsp);
|
||||
|
||||
/* Strip the response base from the front of the mbuf. */
|
||||
os_mbuf_adj((*om), sizeof(*rsp));
|
||||
|
||||
@@ -306,9 +294,6 @@ ble_att_clt_tx_find_type_value(uint16_t conn_handle, uint16_t start_handle,
|
||||
req->bavq_attr_type = htole16(attribute_type);
|
||||
memcpy(req->bavq_value, attribute_value, value_len);
|
||||
|
||||
BLE_ATT_LOG_CMD(1, "find type value req", conn_handle,
|
||||
ble_att_find_type_value_req_log, req);
|
||||
|
||||
return ble_att_tx(conn_handle, txom);
|
||||
}
|
||||
|
||||
@@ -344,8 +329,6 @@ ble_att_clt_rx_find_type_value(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
struct ble_att_find_type_value_hinfo hinfo;
|
||||
int rc;
|
||||
|
||||
BLE_ATT_LOG_EMPTY_CMD(0, "find type value rsp", conn_handle);
|
||||
|
||||
/* Parse the Handles-Information-List field, passing each entry to GATT. */
|
||||
rc = 0;
|
||||
while (OS_MBUF_PKTLEN(*rxom) > 0) {
|
||||
@@ -393,9 +376,6 @@ ble_att_clt_tx_read_type(uint16_t conn_handle, uint16_t start_handle,
|
||||
|
||||
ble_uuid_flat(uuid, req->uuid);
|
||||
|
||||
BLE_ATT_LOG_CMD(1, "read type req", conn_handle,
|
||||
ble_att_read_type_req_log, req);
|
||||
|
||||
return ble_att_tx(conn_handle, txom);
|
||||
}
|
||||
|
||||
@@ -419,9 +399,6 @@ ble_att_clt_rx_read_type(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
|
||||
rsp = (struct ble_att_read_type_rsp *)(*rxom)->om_data;
|
||||
|
||||
BLE_ATT_LOG_CMD(0, "read type rsp", conn_handle, ble_att_read_type_rsp_log,
|
||||
rsp);
|
||||
|
||||
data_len = rsp->batp_length;
|
||||
|
||||
/* Strip the response base from the front of the mbuf. */
|
||||
@@ -487,8 +464,6 @@ ble_att_clt_tx_read(uint16_t conn_handle, uint16_t handle)
|
||||
return rc;
|
||||
}
|
||||
|
||||
BLE_ATT_LOG_CMD(1, "read req", conn_handle, ble_att_read_req_log, req);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -499,8 +474,6 @@ ble_att_clt_rx_read(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
BLE_ATT_LOG_EMPTY_CMD(0, "read rsp", conn_handle);
|
||||
|
||||
/* Pass the Attribute Value field to GATT. */
|
||||
ble_gattc_rx_read_rsp(conn_handle, 0, rxom);
|
||||
return 0;
|
||||
@@ -538,9 +511,6 @@ ble_att_clt_tx_read_blob(uint16_t conn_handle, uint16_t handle, uint16_t offset)
|
||||
return rc;
|
||||
}
|
||||
|
||||
BLE_ATT_LOG_CMD(1, "read blob req", conn_handle,
|
||||
ble_att_read_blob_req_log, req);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -551,8 +521,6 @@ ble_att_clt_rx_read_blob(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
BLE_ATT_LOG_EMPTY_CMD(0, "read blob rsp", conn_handle);
|
||||
|
||||
/* Pass the Attribute Value field to GATT. */
|
||||
ble_gattc_rx_read_blob_rsp(conn_handle, 0, rxom);
|
||||
return 0;
|
||||
@@ -573,8 +541,6 @@ ble_att_clt_tx_read_mult(uint16_t conn_handle, const uint16_t *handles,
|
||||
struct os_mbuf *txom;
|
||||
int i;
|
||||
|
||||
BLE_ATT_LOG_EMPTY_CMD(1, "reqd mult req", conn_handle);
|
||||
|
||||
if (num_handles < 1) {
|
||||
return BLE_HS_EINVAL;
|
||||
}
|
||||
@@ -600,8 +566,6 @@ ble_att_clt_rx_read_mult(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
BLE_ATT_LOG_EMPTY_CMD(0, "read mult rsp", conn_handle);
|
||||
|
||||
/* Pass the Attribute Value field to GATT. */
|
||||
ble_gattc_rx_read_mult_rsp(conn_handle, 0, rxom);
|
||||
return 0;
|
||||
@@ -637,9 +601,6 @@ ble_att_clt_tx_read_group_type(uint16_t conn_handle,
|
||||
req->bagq_end_handle = htole16(end_handle);
|
||||
ble_uuid_flat(uuid, req->uuid);
|
||||
|
||||
BLE_ATT_LOG_CMD(1, "read group type req", conn_handle,
|
||||
ble_att_read_group_type_req_log, req);
|
||||
|
||||
return ble_att_tx(conn_handle, txom);
|
||||
}
|
||||
|
||||
@@ -686,9 +647,6 @@ ble_att_clt_rx_read_group_type(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
|
||||
rsp = (struct ble_att_read_group_type_rsp *)(*rxom)->om_data;
|
||||
|
||||
BLE_ATT_LOG_CMD(0, "read group type rsp", conn_handle,
|
||||
ble_att_read_group_type_rsp_log, rsp);
|
||||
|
||||
len = rsp->bagp_length;
|
||||
|
||||
/* Strip the base from the front of the response. */
|
||||
@@ -735,8 +693,6 @@ ble_att_clt_tx_write_req(uint16_t conn_handle, uint16_t handle,
|
||||
req->bawq_handle = htole16(handle);
|
||||
os_mbuf_concat(txom2, txom);
|
||||
|
||||
BLE_ATT_LOG_CMD(1, "write req", conn_handle, ble_att_write_req_log, req);
|
||||
|
||||
return ble_att_tx(conn_handle, txom2);
|
||||
}
|
||||
|
||||
@@ -774,8 +730,6 @@ ble_att_clt_tx_write_cmd(uint16_t conn_handle, uint16_t handle,
|
||||
cmd->handle = htole16(handle);
|
||||
os_mbuf_concat(txom2, txom);
|
||||
|
||||
BLE_ATT_LOG_CMD(1, "write cmd", conn_handle, ble_att_write_cmd_log, cmd);
|
||||
|
||||
return ble_att_tx(conn_handle, txom2);
|
||||
}
|
||||
|
||||
@@ -786,8 +740,6 @@ ble_att_clt_rx_write(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
BLE_ATT_LOG_EMPTY_CMD(0, "write rsp", conn_handle);
|
||||
|
||||
/* No payload. */
|
||||
ble_gattc_rx_write_rsp(conn_handle);
|
||||
return 0;
|
||||
@@ -835,9 +787,6 @@ ble_att_clt_tx_prep_write(uint16_t conn_handle, uint16_t handle,
|
||||
req->bapc_offset = htole16(offset);
|
||||
os_mbuf_concat(txom2, txom);
|
||||
|
||||
BLE_ATT_LOG_CMD(1, "prep write req", conn_handle,
|
||||
ble_att_prep_write_cmd_log, req);
|
||||
|
||||
return ble_att_tx(conn_handle, txom2);
|
||||
|
||||
err:
|
||||
@@ -866,8 +815,6 @@ ble_att_clt_rx_prep_write(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
}
|
||||
|
||||
rsp = (struct ble_att_prep_write_cmd *)(*rxom)->om_data;
|
||||
BLE_ATT_LOG_CMD(0, "prep write rsp", conn_handle,
|
||||
ble_att_prep_write_cmd_log, rsp);
|
||||
|
||||
handle = le16toh(rsp->bapc_handle);
|
||||
offset = le16toh(rsp->bapc_offset);
|
||||
@@ -908,9 +855,6 @@ ble_att_clt_tx_exec_write(uint16_t conn_handle, uint8_t flags)
|
||||
return rc;
|
||||
}
|
||||
|
||||
BLE_ATT_LOG_CMD(1, "exec write req", conn_handle,
|
||||
ble_att_exec_write_req_log, req);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -921,8 +865,6 @@ ble_att_clt_rx_exec_write(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
BLE_ATT_LOG_EMPTY_CMD(0, "exec write rsp", conn_handle);
|
||||
|
||||
ble_gattc_rx_exec_write_rsp(conn_handle, 0);
|
||||
return 0;
|
||||
}
|
||||
@@ -957,8 +899,6 @@ ble_att_clt_tx_notify(uint16_t conn_handle, uint16_t handle,
|
||||
req->banq_handle = htole16(handle);
|
||||
os_mbuf_concat(txom2, txom);
|
||||
|
||||
BLE_ATT_LOG_CMD(1, "notify req", conn_handle, ble_att_notify_req_log, req);
|
||||
|
||||
return ble_att_tx(conn_handle, txom2);
|
||||
|
||||
err:
|
||||
@@ -996,9 +936,6 @@ ble_att_clt_tx_indicate(uint16_t conn_handle, uint16_t handle,
|
||||
req->baiq_handle = htole16(handle);
|
||||
os_mbuf_concat(txom2, txom);
|
||||
|
||||
BLE_ATT_LOG_CMD(1, "indicate req", conn_handle, ble_att_indicate_req_log,
|
||||
req);
|
||||
|
||||
return ble_att_tx(conn_handle, txom2);
|
||||
|
||||
err:
|
||||
@@ -1013,8 +950,6 @@ ble_att_clt_rx_indicate(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
BLE_ATT_LOG_EMPTY_CMD(0, "indicate rsp", conn_handle);
|
||||
|
||||
/* No payload. */
|
||||
ble_gattc_rx_indicate_rsp(conn_handle);
|
||||
return 0;
|
||||
|
||||
@@ -136,13 +136,6 @@ ble_att_error_rsp_write(void *payload, int len,
|
||||
dst->baep_error_code = src->baep_error_code;
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_error_rsp_log(const struct ble_att_error_rsp *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "req_op=%d handle=0x%04x error_code=%d",
|
||||
cmd->baep_req_op, cmd->baep_handle, cmd->baep_error_code);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_mtu_req_parse(const void *payload, int len,
|
||||
struct ble_att_mtu_cmd *dst)
|
||||
@@ -190,12 +183,6 @@ ble_att_mtu_rsp_write(void *payload, int len,
|
||||
dst->bamc_mtu = htole16(src->bamc_mtu);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_mtu_cmd_log(const struct ble_att_mtu_cmd *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "mtu=%d", cmd->bamc_mtu);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_find_info_req_parse(const void *payload, int len,
|
||||
struct ble_att_find_info_req *dst)
|
||||
@@ -222,13 +209,6 @@ ble_att_find_info_req_write(void *payload, int len,
|
||||
dst->bafq_end_handle = htole16(src->bafq_end_handle);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_find_info_req_log(const struct ble_att_find_info_req *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "start_handle=0x%04x end_handle=0x%04x",
|
||||
cmd->bafq_start_handle, cmd->bafq_end_handle);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_find_info_rsp_parse(const void *payload, int len,
|
||||
struct ble_att_find_info_rsp *dst)
|
||||
@@ -253,12 +233,6 @@ ble_att_find_info_rsp_write(void *payload, int len,
|
||||
dst->bafp_format = src->bafp_format;
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_find_info_rsp_log(const struct ble_att_find_info_rsp *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "format=%d", cmd->bafp_format);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_find_type_value_req_parse(const void *payload, int len,
|
||||
struct ble_att_find_type_value_req *dst)
|
||||
@@ -287,14 +261,6 @@ ble_att_find_type_value_req_write(
|
||||
dst->bavq_attr_type = htole16(src->bavq_attr_type);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_find_type_value_req_log(const struct ble_att_find_type_value_req *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "start_handle=0x%04x end_handle=0x%04x attr_type=%d",
|
||||
cmd->bavq_start_handle, cmd->bavq_end_handle,
|
||||
cmd->bavq_attr_type);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_read_type_req_parse(const void *payload, int len,
|
||||
struct ble_att_read_type_req *dst)
|
||||
@@ -321,13 +287,6 @@ ble_att_read_type_req_write(void *payload, int len,
|
||||
dst->batq_end_handle = htole16(src->batq_end_handle);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_read_type_req_log(const struct ble_att_read_type_req *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "start_handle=0x%04x end_handle=0x%04x",
|
||||
cmd->batq_start_handle, cmd->batq_end_handle);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_read_type_rsp_parse(const void *payload, int len,
|
||||
struct ble_att_read_type_rsp *dst)
|
||||
@@ -352,12 +311,6 @@ ble_att_read_type_rsp_write(void *payload, int len,
|
||||
dst->batp_length = src->batp_length;
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_read_type_rsp_log(const struct ble_att_read_type_rsp *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "length=%d", cmd->batp_length);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_read_req_parse(const void *payload, int len,
|
||||
struct ble_att_read_req *dst)
|
||||
@@ -382,12 +335,6 @@ ble_att_read_req_write(void *payload, int len,
|
||||
dst->barq_handle = htole16(src->barq_handle);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_read_req_log(const struct ble_att_read_req *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "handle=0x%04x", cmd->barq_handle);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_read_blob_req_parse(const void *payload, int len,
|
||||
struct ble_att_read_blob_req *dst)
|
||||
@@ -414,13 +361,6 @@ ble_att_read_blob_req_write(void *payload, int len,
|
||||
dst->babq_offset = htole16(src->babq_offset);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_read_blob_req_log(const struct ble_att_read_blob_req *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "handle=0x%04x offset=%d", cmd->babq_handle,
|
||||
cmd->babq_offset);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_read_mult_req_parse(const void *payload, int len)
|
||||
{
|
||||
@@ -475,13 +415,6 @@ ble_att_read_group_type_req_write(
|
||||
dst->bagq_end_handle = htole16(src->bagq_end_handle);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_read_group_type_req_log(const struct ble_att_read_group_type_req *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "start_handle=0x%04x end_handle=0x%04x",
|
||||
cmd->bagq_start_handle, cmd->bagq_end_handle);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_read_group_type_rsp_parse(const void *payload, int len,
|
||||
struct ble_att_read_group_type_rsp *dst)
|
||||
@@ -506,12 +439,6 @@ ble_att_read_group_type_rsp_write(
|
||||
dst->bagp_length = src->bagp_length;
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_read_group_type_rsp_log(const struct ble_att_read_group_type_rsp *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "length=%d", cmd->bagp_length);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_write_req_parse(const void *payload, int len,
|
||||
struct ble_att_write_req *dst)
|
||||
@@ -557,18 +484,6 @@ ble_att_write_cmd_write(void *payload, int len,
|
||||
dst->bawq_handle = htole16(src->bawq_handle);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_write_cmd_log(const struct ble_att_write_cmd *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "handle=0x%04x", cmd->handle);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_write_req_log(const struct ble_att_write_req *req)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "handle=0x%04x", req->bawq_handle);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_prep_write_req_parse(const void *payload, int len,
|
||||
struct ble_att_prep_write_cmd *dst)
|
||||
@@ -621,13 +536,6 @@ ble_att_prep_write_rsp_write(void *payload, int len,
|
||||
dst->bapc_offset = htole16(src->bapc_offset);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_prep_write_cmd_log(const struct ble_att_prep_write_cmd *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "handle=0x%04x offset=%d", cmd->bapc_handle,
|
||||
cmd->bapc_offset);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_exec_write_req_parse(const void *payload, int len,
|
||||
struct ble_att_exec_write_req *dst)
|
||||
@@ -652,12 +560,6 @@ ble_att_exec_write_req_write(void *payload, int len,
|
||||
dst->baeq_flags = src->baeq_flags;
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_exec_write_req_log(const struct ble_att_exec_write_req *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "flags=0x%02x", cmd->baeq_flags);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_exec_write_rsp_parse(const void *payload, int len)
|
||||
{
|
||||
@@ -696,12 +598,6 @@ ble_att_notify_req_write(void *payload, int len,
|
||||
dst->banq_handle = htole16(src->banq_handle);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_notify_req_log(const struct ble_att_notify_req *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "handle=0x%04x", cmd->banq_handle);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_indicate_req_parse(const void *payload, int len,
|
||||
struct ble_att_indicate_req *dst)
|
||||
@@ -726,12 +622,6 @@ ble_att_indicate_req_write(void *payload, int len,
|
||||
dst->baiq_handle = htole16(src->baiq_handle);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_indicate_req_log(const struct ble_att_indicate_req *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "handle=0x%04x", cmd->baiq_handle);
|
||||
}
|
||||
|
||||
void
|
||||
ble_att_indicate_rsp_parse(const void *payload, int len)
|
||||
{
|
||||
|
||||
@@ -357,7 +357,6 @@ void ble_att_error_rsp_parse(const void *payload, int len,
|
||||
struct ble_att_error_rsp *rsp);
|
||||
void ble_att_error_rsp_write(void *payload, int len,
|
||||
const struct ble_att_error_rsp *rsp);
|
||||
void ble_att_error_rsp_log(const struct ble_att_error_rsp *cmd);
|
||||
void ble_att_mtu_req_parse(const void *payload, int len,
|
||||
struct ble_att_mtu_cmd *cmd);
|
||||
void ble_att_mtu_req_write(void *payload, int len,
|
||||
@@ -366,43 +365,34 @@ void ble_att_mtu_rsp_parse(const void *payload, int len,
|
||||
struct ble_att_mtu_cmd *cmd);
|
||||
void ble_att_mtu_rsp_write(void *payload, int len,
|
||||
const struct ble_att_mtu_cmd *cmd);
|
||||
void ble_att_mtu_cmd_log(const struct ble_att_mtu_cmd *cmd);
|
||||
void ble_att_find_info_req_parse(const void *payload, int len,
|
||||
struct ble_att_find_info_req *req);
|
||||
void ble_att_find_info_req_write(void *payload, int len,
|
||||
const struct ble_att_find_info_req *req);
|
||||
void ble_att_find_info_req_log(const struct ble_att_find_info_req *cmd);
|
||||
void ble_att_find_info_rsp_parse(const void *payload, int len,
|
||||
struct ble_att_find_info_rsp *rsp);
|
||||
void ble_att_find_info_rsp_write(void *payload, int len,
|
||||
const struct ble_att_find_info_rsp *rsp);
|
||||
void ble_att_find_info_rsp_log(const struct ble_att_find_info_rsp *cmd);
|
||||
void ble_att_find_type_value_req_parse(
|
||||
const void *payload, int len, struct ble_att_find_type_value_req *req);
|
||||
void ble_att_find_type_value_req_write(
|
||||
void *payload, int len, const struct ble_att_find_type_value_req *req);
|
||||
void ble_att_find_type_value_req_log(
|
||||
const struct ble_att_find_type_value_req *cmd);
|
||||
void ble_att_read_type_req_parse(const void *payload, int len,
|
||||
struct ble_att_read_type_req *req);
|
||||
void ble_att_read_type_req_write(void *payload, int len,
|
||||
const struct ble_att_read_type_req *req);
|
||||
void ble_att_read_type_req_log(const struct ble_att_read_type_req *cmd);
|
||||
void ble_att_read_type_rsp_parse(const void *payload, int len,
|
||||
struct ble_att_read_type_rsp *rsp);
|
||||
void ble_att_read_type_rsp_write(void *payload, int len,
|
||||
const struct ble_att_read_type_rsp *rsp);
|
||||
void ble_att_read_type_rsp_log(const struct ble_att_read_type_rsp *cmd);
|
||||
void ble_att_read_req_parse(const void *payload, int len,
|
||||
struct ble_att_read_req *req);
|
||||
void ble_att_read_req_write(void *payload, int len,
|
||||
const struct ble_att_read_req *req);
|
||||
void ble_att_read_req_log(const struct ble_att_read_req *cmd);
|
||||
void ble_att_read_blob_req_parse(const void *payload, int len,
|
||||
struct ble_att_read_blob_req *req);
|
||||
void ble_att_read_blob_req_write(void *payload, int len,
|
||||
const struct ble_att_read_blob_req *req);
|
||||
void ble_att_read_blob_req_log(const struct ble_att_read_blob_req *cmd);
|
||||
void ble_att_read_mult_req_parse(const void *payload, int len);
|
||||
void ble_att_read_mult_req_write(void *payload, int len);
|
||||
void ble_att_read_mult_rsp_parse(const void *payload, int len);
|
||||
@@ -411,14 +401,10 @@ void ble_att_read_group_type_req_parse(
|
||||
const void *payload, int len, struct ble_att_read_group_type_req *req);
|
||||
void ble_att_read_group_type_req_write(
|
||||
void *payload, int len, const struct ble_att_read_group_type_req *req);
|
||||
void ble_att_read_group_type_req_log(
|
||||
const struct ble_att_read_group_type_req *cmd);
|
||||
void ble_att_read_group_type_rsp_parse(
|
||||
const void *payload, int len, struct ble_att_read_group_type_rsp *rsp);
|
||||
void ble_att_read_group_type_rsp_write(
|
||||
void *payload, int len, const struct ble_att_read_group_type_rsp *rsp);
|
||||
void ble_att_read_group_type_rsp_log(
|
||||
const struct ble_att_read_group_type_rsp *cmd);
|
||||
void ble_att_write_req_parse(const void *payload, int len,
|
||||
struct ble_att_write_req *req);
|
||||
void ble_att_write_req_write(void *payload, int len,
|
||||
@@ -427,20 +413,16 @@ void ble_att_write_cmd_parse(const void *payload, int len,
|
||||
struct ble_att_write_req *req);
|
||||
void ble_att_write_cmd_write(void *payload, int len,
|
||||
const struct ble_att_write_req *req);
|
||||
void ble_att_write_cmd_log(const struct ble_att_write_cmd *cmd);
|
||||
void ble_att_write_req_log(const struct ble_att_write_req *req);
|
||||
void ble_att_prep_write_req_parse(const void *payload, int len,
|
||||
struct ble_att_prep_write_cmd *cmd);
|
||||
void ble_att_prep_write_req_write(void *payload, int len,
|
||||
const struct ble_att_prep_write_cmd *cmd);
|
||||
void ble_att_prep_write_cmd_log(const struct ble_att_prep_write_cmd *cmd);
|
||||
void ble_att_prep_write_rsp_parse(const void *payload, int len,
|
||||
struct ble_att_prep_write_cmd *cmd);
|
||||
void ble_att_prep_write_rsp_write(void *payload, int len,
|
||||
const struct ble_att_prep_write_cmd *cmd);
|
||||
void ble_att_exec_write_req_parse(const void *payload, int len,
|
||||
struct ble_att_exec_write_req *req);
|
||||
void ble_att_exec_write_req_log(const struct ble_att_exec_write_req *cmd);
|
||||
void ble_att_exec_write_req_write(void *payload, int len,
|
||||
const struct ble_att_exec_write_req *req);
|
||||
void ble_att_exec_write_rsp_parse(const void *payload, int len);
|
||||
@@ -449,14 +431,12 @@ void ble_att_notify_req_parse(const void *payload, int len,
|
||||
struct ble_att_notify_req *req);
|
||||
void ble_att_notify_req_write(void *payload, int len,
|
||||
const struct ble_att_notify_req *req);
|
||||
void ble_att_notify_req_log(const struct ble_att_notify_req *cmd);
|
||||
void ble_att_indicate_req_parse(const void *payload, int len,
|
||||
struct ble_att_indicate_req *req);
|
||||
void ble_att_indicate_req_write(void *payload, int len,
|
||||
const struct ble_att_indicate_req *req);
|
||||
void ble_att_indicate_rsp_parse(const void *payload, int len);
|
||||
void ble_att_indicate_rsp_write(void *payload, int len);
|
||||
void ble_att_indicate_req_log(const struct ble_att_indicate_req *cmd);
|
||||
|
||||
void *ble_att_cmd_prepare(uint8_t opcode, size_t len, struct os_mbuf *txom);
|
||||
void *ble_att_cmd_get(uint8_t opcode, size_t len, struct os_mbuf **txom);
|
||||
|
||||
@@ -170,12 +170,6 @@ void ble_att_set_peer_mtu(struct ble_l2cap_chan *chan, uint16_t peer_mtu);
|
||||
uint16_t ble_att_chan_mtu(const struct ble_l2cap_chan *chan);
|
||||
int ble_att_init(void);
|
||||
|
||||
#define BLE_ATT_LOG_CMD(is_tx, cmd_name, conn_handle, log_cb, cmd) \
|
||||
BLE_HS_LOG_CMD((is_tx), "att", (cmd_name), (conn_handle), (log_cb), (cmd))
|
||||
|
||||
#define BLE_ATT_LOG_EMPTY_CMD(is_tx, cmd_name, conn_handle) \
|
||||
BLE_HS_LOG_EMPTY_CMD((is_tx), "att", (cmd_name), (conn_handle))
|
||||
|
||||
/*** @svr */
|
||||
|
||||
int ble_att_svr_start(void);
|
||||
|
||||
@@ -577,8 +577,6 @@ ble_att_svr_tx_error_rsp(uint16_t conn_handle, struct os_mbuf *txom,
|
||||
rsp->baep_handle = htole16(handle);
|
||||
rsp->baep_error_code = error_code;
|
||||
|
||||
BLE_ATT_LOG_CMD(1, "error rsp", conn_handle, ble_att_error_rsp_log, rsp);
|
||||
|
||||
return ble_att_tx(conn_handle, txom);
|
||||
}
|
||||
|
||||
@@ -705,8 +703,6 @@ ble_att_svr_build_mtu_rsp(uint16_t conn_handle, struct os_mbuf **rxom,
|
||||
|
||||
cmd->bamc_mtu = htole16(mtu);
|
||||
|
||||
BLE_ATT_LOG_CMD(1, "mtu rsp", conn_handle, ble_att_mtu_cmd_log, cmd);
|
||||
|
||||
rc = 0;
|
||||
|
||||
done:
|
||||
@@ -734,7 +730,6 @@ ble_att_svr_rx_mtu(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
}
|
||||
|
||||
cmd = (struct ble_att_mtu_cmd *)(*rxom)->om_data;
|
||||
BLE_ATT_LOG_CMD(0, "mtu req", conn_handle, ble_att_mtu_cmd_log, cmd);
|
||||
|
||||
mtu = le16toh(cmd->bamc_mtu);
|
||||
|
||||
@@ -888,9 +883,6 @@ ble_att_svr_build_find_info_rsp(uint16_t conn_handle,
|
||||
goto done;
|
||||
}
|
||||
|
||||
BLE_ATT_LOG_CMD(1, "find info rsp", conn_handle, ble_att_find_info_rsp_log,
|
||||
rsp);
|
||||
|
||||
rc = 0;
|
||||
|
||||
done:
|
||||
@@ -926,9 +918,6 @@ ble_att_svr_rx_find_info(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
start_handle = le16toh(req->bafq_start_handle);
|
||||
end_handle = le16toh(req->bafq_end_handle);
|
||||
|
||||
BLE_ATT_LOG_CMD(0, "find info req", conn_handle, ble_att_find_info_req_log,
|
||||
req);
|
||||
|
||||
/* Tx error response if start handle is greater than end handle or is equal
|
||||
* to 0 (Vol. 3, Part F, 3.4.3.1).
|
||||
*/
|
||||
@@ -1201,8 +1190,6 @@ ble_att_svr_build_find_type_value_rsp(uint16_t conn_handle,
|
||||
goto done;
|
||||
}
|
||||
|
||||
BLE_ATT_LOG_EMPTY_CMD(1, "find type value rsp", conn_handle);
|
||||
|
||||
rc = 0;
|
||||
|
||||
done:
|
||||
@@ -1239,8 +1226,6 @@ ble_att_svr_rx_find_type_value(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
start_handle = le16toh(req->bavq_start_handle);
|
||||
end_handle = le16toh(req->bavq_end_handle);
|
||||
attr_type = (ble_uuid16_t) BLE_UUID16_INIT(le16toh(req->bavq_attr_type));
|
||||
BLE_ATT_LOG_CMD(0, "find type value req", conn_handle,
|
||||
ble_att_find_type_value_req_log, req);
|
||||
|
||||
/* Tx error response if start handle is greater than end handle or is equal
|
||||
* to 0 (Vol. 3, Part F, 3.4.3.3).
|
||||
@@ -1376,8 +1361,6 @@ done:
|
||||
|
||||
/* Fill the response base. */
|
||||
rsp->batp_length = htole16(sizeof(*data) + prev_attr_len);
|
||||
BLE_ATT_LOG_CMD(1, "read type rsp", conn_handle,
|
||||
ble_att_read_type_rsp_log, rsp);
|
||||
}
|
||||
|
||||
*out_txom = txom;
|
||||
@@ -1420,9 +1403,6 @@ ble_att_svr_rx_read_type(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
|
||||
req = (struct ble_att_read_type_req *)(*rxom)->om_data;
|
||||
|
||||
BLE_ATT_LOG_CMD(0, "read type req", conn_handle, ble_att_read_type_req_log,
|
||||
req);
|
||||
|
||||
start_handle = le16toh(req->batq_start_handle);
|
||||
end_handle = le16toh(req->batq_end_handle);
|
||||
|
||||
@@ -1480,7 +1460,6 @@ ble_att_svr_rx_read(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
}
|
||||
|
||||
req = (struct ble_att_read_req *)(*rxom)->om_data;
|
||||
BLE_ATT_LOG_CMD(0, "read req", conn_handle, ble_att_read_req_log, req);
|
||||
|
||||
err_handle = le16toh(req->barq_handle);
|
||||
|
||||
@@ -1530,8 +1509,6 @@ ble_att_svr_rx_read_blob(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
}
|
||||
|
||||
req = (struct ble_att_read_blob_req *)(*rxom)->om_data;
|
||||
BLE_ATT_LOG_CMD(0, "read blob req", conn_handle, ble_att_read_blob_req_log,
|
||||
req);
|
||||
|
||||
err_handle = le16toh(req->babq_handle);
|
||||
offset = le16toh(req->babq_offset);
|
||||
@@ -1553,8 +1530,6 @@ ble_att_svr_rx_read_blob(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
goto done;
|
||||
}
|
||||
|
||||
BLE_ATT_LOG_EMPTY_CMD(1, "read blob rsp", conn_handle);
|
||||
|
||||
rc = 0;
|
||||
|
||||
done:
|
||||
@@ -1617,7 +1592,6 @@ ble_att_svr_build_read_mult_rsp(uint16_t conn_handle,
|
||||
}
|
||||
}
|
||||
|
||||
BLE_ATT_LOG_EMPTY_CMD(1, "read mult rsp", conn_handle);
|
||||
rc = 0;
|
||||
|
||||
done:
|
||||
@@ -1637,8 +1611,6 @@ ble_att_svr_rx_read_mult(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
uint8_t att_err;
|
||||
int rc;
|
||||
|
||||
BLE_ATT_LOG_EMPTY_CMD(0, "read mult req", conn_handle);
|
||||
|
||||
/* Initialize some values in case of early error. */
|
||||
txom = NULL;
|
||||
err_handle = 0;
|
||||
@@ -1874,8 +1846,6 @@ done:
|
||||
}
|
||||
|
||||
if (rc == 0 || rc == BLE_HS_EMSGSIZE) {
|
||||
BLE_ATT_LOG_CMD(1, "read group type rsp", conn_handle,
|
||||
ble_att_read_group_type_rsp_log, rsp);
|
||||
rc = 0;
|
||||
}
|
||||
|
||||
@@ -1917,8 +1887,6 @@ ble_att_svr_rx_read_group_type(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
}
|
||||
|
||||
req = (struct ble_att_read_group_type_req *)(*rxom)->om_data;
|
||||
BLE_ATT_LOG_CMD(0, "read group type req", conn_handle,
|
||||
ble_att_read_group_type_req_log, req);
|
||||
|
||||
start_handle = le16toh(req->bagq_start_handle);
|
||||
end_handle = le16toh(req->bagq_end_handle);
|
||||
@@ -2016,9 +1984,6 @@ ble_att_svr_rx_write(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
|
||||
req = (struct ble_att_write_req *)(*rxom)->om_data;
|
||||
|
||||
BLE_ATT_LOG_CMD(0, "write req", conn_handle,
|
||||
ble_att_write_req_log, req);
|
||||
|
||||
handle = le16toh(req->bawq_handle);
|
||||
|
||||
/* Allocate the write response. This must be done prior to processing the
|
||||
@@ -2037,8 +2002,6 @@ ble_att_svr_rx_write(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
goto done;
|
||||
}
|
||||
|
||||
BLE_ATT_LOG_EMPTY_CMD(1, "write rsp", conn_handle);
|
||||
|
||||
rc = 0;
|
||||
|
||||
done:
|
||||
@@ -2065,8 +2028,6 @@ ble_att_svr_rx_write_no_rsp(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
}
|
||||
|
||||
req = (struct ble_att_write_req *)(*rxom)->om_data;
|
||||
BLE_ATT_LOG_CMD(0, "write cmd", conn_handle,
|
||||
ble_att_write_req_log, req);
|
||||
|
||||
handle = le16toh(req->bawq_handle);
|
||||
|
||||
@@ -2361,9 +2322,6 @@ ble_att_svr_rx_prep_write(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
|
||||
req = (struct ble_att_prep_write_cmd *)(*rxom)->om_data;
|
||||
|
||||
BLE_ATT_LOG_CMD(0, "prep write req", conn_handle,
|
||||
ble_att_prep_write_cmd_log, req);
|
||||
|
||||
err_handle = le16toh(req->bapc_handle);
|
||||
|
||||
attr_entry = ble_att_svr_find_by_handle(le16toh(req->bapc_handle));
|
||||
@@ -2411,9 +2369,6 @@ ble_att_svr_rx_prep_write(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
os_mbuf_prepend(txom, 1);
|
||||
txom->om_data[0] = BLE_ATT_OP_PREP_WRITE_RSP;
|
||||
|
||||
BLE_ATT_LOG_CMD(1, "prep write rsp", conn_handle,
|
||||
ble_att_prep_write_cmd_log, req);
|
||||
|
||||
rc = 0;
|
||||
|
||||
done:
|
||||
@@ -2449,8 +2404,6 @@ ble_att_svr_rx_exec_write(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
}
|
||||
|
||||
req = (struct ble_att_exec_write_req *)(*rxom)->om_data;
|
||||
BLE_ATT_LOG_CMD(0, "exec write req", conn_handle,
|
||||
ble_att_exec_write_req_log, req);
|
||||
|
||||
flags = req->baeq_flags;
|
||||
|
||||
@@ -2517,9 +2470,6 @@ ble_att_svr_rx_notify(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
|
||||
req = (struct ble_att_notify_req *)(*rxom)->om_data;
|
||||
|
||||
BLE_ATT_LOG_CMD(0, "notify req", conn_handle,
|
||||
ble_att_notify_req_log, req);
|
||||
|
||||
handle = le16toh(req->banq_handle);
|
||||
|
||||
if (handle == 0) {
|
||||
@@ -2591,8 +2541,6 @@ ble_att_svr_rx_indicate(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
}
|
||||
|
||||
req = (struct ble_att_indicate_req *)(*rxom)->om_data;
|
||||
BLE_ATT_LOG_CMD(0, "indicate req", conn_handle,
|
||||
ble_att_indicate_req_log, req);
|
||||
|
||||
handle = le16toh(req->baiq_handle);
|
||||
|
||||
@@ -2615,8 +2563,6 @@ ble_att_svr_rx_indicate(uint16_t conn_handle, struct os_mbuf **rxom)
|
||||
ble_gap_notify_rx_event(conn_handle, handle, *rxom, 1);
|
||||
*rxom = NULL;
|
||||
|
||||
BLE_ATT_LOG_EMPTY_CMD(1, "indicate rsp", conn_handle);
|
||||
|
||||
rc = 0;
|
||||
|
||||
done:
|
||||
|
||||
@@ -1,695 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "os/os.h"
|
||||
#include "nimble/hci_common.h"
|
||||
#include "nimble/ble_hci_trans.h"
|
||||
#include "host/ble_monitor.h"
|
||||
#include "ble_hs_priv.h"
|
||||
|
||||
static void
|
||||
ble_hs_dbg_le_event_disp(uint8_t subev, uint8_t len, uint8_t *evdata)
|
||||
{
|
||||
int8_t rssi;
|
||||
uint8_t advlen;
|
||||
uint8_t status;
|
||||
int i;
|
||||
int imax;
|
||||
uint8_t *dptr;
|
||||
char *adv_ptr;
|
||||
char adv_data_buf[32];
|
||||
|
||||
switch (subev) {
|
||||
case BLE_HCI_LE_SUBEV_ENH_CONN_COMPLETE:
|
||||
case BLE_HCI_LE_SUBEV_CONN_COMPLETE:
|
||||
status = evdata[0];
|
||||
if (status == BLE_ERR_SUCCESS) {
|
||||
BLE_HS_LOG(DEBUG, "LE connection complete. handle=%u role=%u "
|
||||
"paddrtype=%u addr=%x.%x.%x.%x.%x.%x ",
|
||||
get_le16(evdata + 1), evdata[3], evdata[4],
|
||||
evdata[10], evdata[9], evdata[8], evdata[7],
|
||||
evdata[6], evdata[5]);
|
||||
|
||||
evdata += 11;
|
||||
if (subev == BLE_HCI_LE_SUBEV_ENH_CONN_COMPLETE) {
|
||||
BLE_HS_LOG(DEBUG, "local_rpa=%x.%x.%x.%x.%x.%x "
|
||||
"peer_rpa=%x.%x.%x.%x.%x.%x ",
|
||||
evdata[5], evdata[4], evdata[3], evdata[2],
|
||||
evdata[1], evdata[0],
|
||||
evdata[11], evdata[10], evdata[9], evdata[8],
|
||||
evdata[7], evdata[6]);
|
||||
|
||||
evdata += 12;
|
||||
}
|
||||
BLE_HS_LOG(DEBUG, "itvl=%u latency=%u spvn_tmo=%u mca=%u\n",
|
||||
get_le16(evdata), get_le16(evdata + 2),
|
||||
get_le16(evdata + 4), evdata[6]);
|
||||
} else {
|
||||
BLE_HS_LOG(DEBUG, "LE connection complete. FAIL (status=%u)\n",
|
||||
status);
|
||||
}
|
||||
break;
|
||||
case BLE_HCI_LE_SUBEV_ADV_RPT:
|
||||
advlen = evdata[9];
|
||||
rssi = evdata[10 + advlen];
|
||||
BLE_HS_LOG(DEBUG, "LE advertising report. len=%u num=%u evtype=%u "
|
||||
"addrtype=%u addr=%x.%x.%x.%x.%x.%x advlen=%u "
|
||||
"rssi=%d\n", len, evdata[0], evdata[1], evdata[2],
|
||||
evdata[8], evdata[7], evdata[6], evdata[5],
|
||||
evdata[4], evdata[3], advlen, rssi);
|
||||
if (advlen) {
|
||||
dptr = &evdata[10];
|
||||
while (advlen > 0) {
|
||||
memset(adv_data_buf, 0, 32);
|
||||
imax = advlen;
|
||||
if (imax > 8) {
|
||||
imax = 8;
|
||||
}
|
||||
adv_ptr = &adv_data_buf[0];
|
||||
for (i = 0; i < imax; ++i) {
|
||||
snprintf(adv_ptr, 4, "%02x ", *dptr);
|
||||
adv_ptr += 3;
|
||||
++dptr;
|
||||
}
|
||||
advlen -= imax;
|
||||
BLE_HS_LOG(DEBUG, "%s\n", adv_data_buf);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BLE_HCI_LE_SUBEV_CONN_UPD_COMPLETE:
|
||||
status = evdata[0];
|
||||
if (status == BLE_ERR_SUCCESS) {
|
||||
BLE_HS_LOG(DEBUG, "LE Connection Update Complete. handle=%u "
|
||||
"itvl=%u latency=%u timeout=%u\n",
|
||||
get_le16(evdata + 1), get_le16(evdata + 3),
|
||||
get_le16(evdata + 5), get_le16(evdata + 7));
|
||||
} else {
|
||||
BLE_HS_LOG(DEBUG, "LE Connection Update Complete. FAIL "
|
||||
"(status=%u)\n", status);
|
||||
}
|
||||
break;
|
||||
|
||||
case BLE_HCI_LE_SUBEV_DATA_LEN_CHG:
|
||||
BLE_HS_LOG(DEBUG, "LE Data Length Change. handle=%u max_tx_bytes=%u "
|
||||
"max_tx_time=%u max_rx_bytes=%u max_rx_time=%u\n",
|
||||
get_le16(evdata), get_le16(evdata + 2),
|
||||
get_le16(evdata + 4), get_le16(evdata + 6),
|
||||
get_le16(evdata + 8));
|
||||
break;
|
||||
case BLE_HCI_LE_SUBEV_REM_CONN_PARM_REQ:
|
||||
BLE_HS_LOG(DEBUG, "LE Remote Connection Parameter Request. handle=%u "
|
||||
"min_itvl=%u max_itvl=%u latency=%u timeout=%u\n",
|
||||
get_le16(evdata), get_le16(evdata + 2),
|
||||
get_le16(evdata + 4), get_le16(evdata + 6),
|
||||
get_le16(evdata + 8));
|
||||
break;
|
||||
|
||||
case BLE_HCI_LE_SUBEV_RD_REM_USED_FEAT:
|
||||
status = evdata[0];
|
||||
if (status == BLE_ERR_SUCCESS) {
|
||||
BLE_HS_LOG(DEBUG, "LE Remote Used Features. handle=%u feat=",
|
||||
get_le16(evdata + 1));
|
||||
for (i = 0; i < BLE_HCI_RD_LOC_SUPP_FEAT_RSPLEN; ++i) {
|
||||
BLE_HS_LOG(DEBUG, "%02x ", evdata[3 + i]);
|
||||
}
|
||||
BLE_HS_LOG(DEBUG, "\n");
|
||||
} else {
|
||||
BLE_HS_LOG(DEBUG, "LE Remote Used Features. FAIL (status=%u)\n",
|
||||
status);
|
||||
}
|
||||
break;
|
||||
|
||||
case BLE_HCI_LE_SUBEV_LT_KEY_REQ:
|
||||
BLE_HS_LOG(DEBUG, "LE LTK Req. handle=%u rand=%lx%lx encdiv=%u\n",
|
||||
get_le16(evdata), get_le32(evdata + 6),
|
||||
get_le32(evdata + 2), get_le16(evdata + 10));
|
||||
break;
|
||||
|
||||
case BLE_HCI_LE_SUBEV_PHY_UPDATE_COMPLETE:
|
||||
BLE_HS_LOG(DEBUG, "PHY update. handle=%u tx=%u rx=%u\n",
|
||||
get_le16(evdata + 1), evdata[3], evdata[4]);
|
||||
break;
|
||||
|
||||
case BLE_HCI_LE_SUBEV_DIRECT_ADV_RPT:
|
||||
{
|
||||
struct hci_le_subev_direct_adv_rpt *data = (void *) evdata;
|
||||
struct hci_le_subev_direct_adv_rpt_param *params = data->params;
|
||||
|
||||
if (len < sizeof(*data) ||
|
||||
len < sizeof(*data) + data->num_reports * sizeof(*params)) {
|
||||
BLE_HS_LOG(DEBUG, "Corrupted LE Directed Advertising Report "
|
||||
"len=%u\n", len);
|
||||
break;
|
||||
}
|
||||
|
||||
BLE_HS_LOG(DEBUG, "LE Directed Advertising Report len=%u "
|
||||
"num=0x%02x ", len, data->num_reports);
|
||||
|
||||
for (i = 0; i < data->num_reports; i++) {
|
||||
BLE_HS_LOG(DEBUG, "[%d]={evttype=0x%02x}\n", i, params->evt_type);
|
||||
params += 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case BLE_HCI_LE_SUBEV_RD_LOC_P256_PUBKEY:
|
||||
{
|
||||
struct hci_le_subev_rd_loc_p256_pubkey *data = (void *) evdata;
|
||||
|
||||
if (len != sizeof(*data)) {
|
||||
BLE_HS_LOG(DEBUG, "Corrupted LE Read Local P-256 Public Key "
|
||||
"Complete Event len=%u\n", len);
|
||||
break;
|
||||
}
|
||||
|
||||
BLE_HS_LOG(DEBUG, "LE Read Local P-256 Public Key Complete "
|
||||
"len=%u status=0x%02x\n", len, data->status);
|
||||
break;
|
||||
}
|
||||
|
||||
case BLE_HCI_LE_SUBEV_GEN_DHKEY_COMPLETE:
|
||||
{
|
||||
struct hci_le_subev_gen_dhkey_complete *data = (void *) evdata;
|
||||
|
||||
if (len != sizeof(*data)) {
|
||||
BLE_HS_LOG(DEBUG, "Corrupted LE Generate DHKey Complete "
|
||||
"len=%u\n", len);
|
||||
break;
|
||||
}
|
||||
|
||||
BLE_HS_LOG(DEBUG, "LE Generate DHKey Complete Event len=%u "
|
||||
"status=0x%02x\n", len, data->status);
|
||||
break;
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_ADV)
|
||||
case BLE_HCI_LE_SUBEV_EXT_ADV_RPT:
|
||||
{
|
||||
struct hci_le_subev_ext_adv_rpt *data = (void *) evdata;
|
||||
struct hci_ext_adv_report_param *params;
|
||||
|
||||
if (len < sizeof(*data) + sizeof(*params)) {
|
||||
BLE_HS_LOG(DEBUG, "Corrupted LE Extended Advertising Report "
|
||||
"len=%u\n", len);
|
||||
break;
|
||||
}
|
||||
|
||||
BLE_HS_LOG(DEBUG, "LE Extended Advertising Report len=%u num=0x%02x ",
|
||||
len, data->num_reports);
|
||||
|
||||
for (i = 0, dptr = &evdata[1]; i < data->num_reports; i++) {
|
||||
params = (void *) dptr;
|
||||
BLE_HS_LOG(DEBUG, "[%d]={evttype=0x%04x advlen=%u}\n",
|
||||
i, le16toh(params->evt_type), params->adv_data_len);
|
||||
dptr += sizeof(*params) + params->adv_data_len;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#if MYNEWT_VAL(BLE_PERIODIC_ADV)
|
||||
case BLE_HCI_LE_SUBEV_PERIODIC_ADV_SYNC_ESTAB:
|
||||
{
|
||||
struct hci_le_subev_periodic_adv_sync_estab *data = (void *) evdata;
|
||||
|
||||
if (len != sizeof(*data)) {
|
||||
BLE_HS_LOG(DEBUG, "Corrupted LE Periodic Advertising Sync "
|
||||
"Established len=%u\n", len);
|
||||
break;
|
||||
}
|
||||
|
||||
BLE_HS_LOG(DEBUG, "LE Periodic Advertising Sync Established "
|
||||
"len=%u status=0x%02x handle=0x%04x", len, data->status,
|
||||
le16toh(data->sync_handle));
|
||||
break;
|
||||
}
|
||||
|
||||
case BLE_HCI_LE_SUBEV_PERIODIC_ADV_RPT:
|
||||
{
|
||||
struct hci_le_subev_periodic_adv_rpt *data = (void *) evdata;
|
||||
|
||||
if (len < sizeof(*data) || len != sizeof(*data) + data->data_length) {
|
||||
BLE_HS_LOG(DEBUG, "Corrupted LE Periodic Advertising Report "
|
||||
"len=%u\n", len);
|
||||
break;
|
||||
}
|
||||
|
||||
BLE_HS_LOG(DEBUG, "LE Periodic Advertising Report "
|
||||
"len=%u handle=0x%04x data_status=0x%02x data_len=0x%02x",
|
||||
len, le16toh(data->sync_handle), data->data_status,
|
||||
data->data_length);
|
||||
break;
|
||||
}
|
||||
|
||||
case BLE_HCI_LE_SUBEV_PERIODIC_ADV_SYNC_LOST:
|
||||
{
|
||||
struct hci_le_subev_periodic_adv_sync_lost *data = (void *) evdata;
|
||||
|
||||
if (len != sizeof(*data)) {
|
||||
BLE_HS_LOG(DEBUG, "Corrupted LE Periodic Advertising Sync Lost "
|
||||
"len=%u\n", len);
|
||||
break;
|
||||
}
|
||||
|
||||
BLE_HS_LOG(DEBUG, "LE Periodic Advertising Sync Lost "
|
||||
"len=%u handle=0x%04x", len, le16toh(data->sync_handle));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
case BLE_HCI_LE_SUBEV_SCAN_TIMEOUT:
|
||||
if (len) {
|
||||
BLE_HS_LOG(DEBUG, "Corrupted LE Scan Timeout len=%u", len);
|
||||
break;
|
||||
}
|
||||
|
||||
BLE_HS_LOG(DEBUG, "LE Scan Timeout Event len=%u", len);
|
||||
break;
|
||||
|
||||
case BLE_HCI_LE_SUBEV_ADV_SET_TERMINATED:
|
||||
{
|
||||
struct hci_le_subev_adv_set_terminated *data = (void *) evdata;
|
||||
|
||||
if (len != sizeof(*data)) {
|
||||
BLE_HS_LOG(DEBUG, "Corrupted LE Advertising Set Terminated "
|
||||
"len=%u\n", len);
|
||||
break;
|
||||
}
|
||||
|
||||
BLE_HS_LOG(DEBUG, "LE Advertising Set Terminated len=%u "
|
||||
"status=0x%02x adv_handle=0x%02x conn_handle=0x%04x "
|
||||
"num_compl_ext_adv_ev=0x%02x", len, data->status,
|
||||
data->adv_handle, le16toh(data->conn_handle),
|
||||
data->num_compl_ext_adv_ev);
|
||||
break;
|
||||
}
|
||||
|
||||
case BLE_HCI_LE_SUBEV_SCAN_REQ_RCVD:
|
||||
{
|
||||
struct hci_le_subev_scan_req_rcvd *data = (void *) evdata;
|
||||
|
||||
if (len != sizeof(*data)) {
|
||||
BLE_HS_LOG(DEBUG, "Corrupted LE Scan Request Received "
|
||||
"len=%u\n", len);
|
||||
break;
|
||||
}
|
||||
|
||||
BLE_HS_LOG(DEBUG, "LE Scan Request Received len=%u "
|
||||
"adv_handle=0x%02x", len, data->adv_handle);
|
||||
break;
|
||||
}
|
||||
#endif /* MYNEWT_VAL(BLE_EXT_ADV) */
|
||||
|
||||
case BLE_HCI_LE_SUBEV_CHAN_SEL_ALG:
|
||||
{
|
||||
struct hci_le_subev_chan_sel_alg *data = (void *) evdata;
|
||||
|
||||
if (len != sizeof(*data)) {
|
||||
BLE_HS_LOG(DEBUG, "Corrupted LE Channel Selection Algorithm "
|
||||
"len=%u\n", len);
|
||||
break;
|
||||
}
|
||||
|
||||
BLE_HS_LOG(DEBUG, "LE Channel Selection Algorithm len=%u "
|
||||
"conn_handle=0x%04x chan_sel_alg=0x%02x\n", len,
|
||||
le16toh(data->conn_handle), data->chan_sel_alg);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
BLE_HS_LOG(DEBUG, "LE Meta SubEvent op=0x%02x\n", subev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a disconnection complete command.
|
||||
*
|
||||
*
|
||||
* @param evdata
|
||||
* @param len
|
||||
*/
|
||||
static void
|
||||
ble_hs_dbg_disconn_comp_disp(uint8_t *evdata, uint8_t len)
|
||||
{
|
||||
uint8_t status;
|
||||
uint8_t reason;
|
||||
uint16_t handle;
|
||||
|
||||
status = evdata[0];
|
||||
handle = get_le16(evdata + 1);
|
||||
/* Ignore reason if status is not success */
|
||||
if (status != BLE_ERR_SUCCESS) {
|
||||
reason = 0;
|
||||
} else {
|
||||
reason = evdata[3];
|
||||
}
|
||||
BLE_HS_LOG(DEBUG, "Disconnection Complete: status=%u handle=%u "
|
||||
"reason=%u\n", status, handle, reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display an encryption change event or encryption key refresh event
|
||||
*
|
||||
* @param evdata
|
||||
* @param len
|
||||
*/
|
||||
static void
|
||||
ble_hs_dbg_encrypt_chg_disp(uint8_t *evdata, uint8_t len)
|
||||
{
|
||||
uint8_t status;
|
||||
uint8_t enabled;
|
||||
uint16_t handle;
|
||||
|
||||
status = evdata[0];
|
||||
handle = get_le16(evdata + 1);
|
||||
|
||||
/* Ignore reason if status is not success */
|
||||
if (status != BLE_ERR_SUCCESS) {
|
||||
enabled = 0;
|
||||
} else {
|
||||
enabled = evdata[3];
|
||||
}
|
||||
BLE_HS_LOG(DEBUG, "Encrypt change: status=%u handle=%u state=%u\n",
|
||||
status, handle, enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display an encryption encryption key refresh event
|
||||
*
|
||||
* @param evdata
|
||||
* @param len
|
||||
*/
|
||||
static void
|
||||
ble_hs_dbg_encrypt_refresh_disp(uint8_t *evdata, uint8_t len)
|
||||
{
|
||||
uint8_t status;
|
||||
uint16_t handle;
|
||||
|
||||
status = evdata[0];
|
||||
handle = get_le16(evdata + 1);
|
||||
|
||||
BLE_HS_LOG(DEBUG, "Encrypt key refresh: status=%u handle=%u\n",
|
||||
status, handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a version information event
|
||||
*
|
||||
* @param evdata
|
||||
* @param len
|
||||
*/
|
||||
static void
|
||||
ble_hs_dbg_rd_rem_ver_disp(uint8_t *evdata, uint8_t len)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "Remote Version Info: status=%u handle=%u vers_nr=%u "
|
||||
"compid=%u subver=%u\n",
|
||||
evdata[0], get_le16(evdata + 1), evdata[3],
|
||||
get_le16(evdata + 4), get_le16(evdata + 6));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the number of completed packets event
|
||||
*
|
||||
* @param evdata
|
||||
* @param len
|
||||
*/
|
||||
static void
|
||||
ble_hs_dbg_num_comp_pkts_disp(uint8_t *evdata, uint8_t len)
|
||||
{
|
||||
uint8_t handles;
|
||||
uint8_t *handle_ptr;
|
||||
uint16_t handle;
|
||||
uint16_t pkts;
|
||||
|
||||
handles = evdata[0];
|
||||
if (len != ((handles * 4) + 1)) {
|
||||
BLE_HS_LOG(DEBUG, "ERR: Number of Completed Packets bad length: "
|
||||
"num_handles=%u len=%u\n", handles, len);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
BLE_HS_LOG(DEBUG, "Number of Completed Packets: num_handles=%u\n",
|
||||
handles);
|
||||
if (handles) {
|
||||
handle_ptr = evdata + 1;
|
||||
while (handles) {
|
||||
handle = get_le16(handle_ptr);
|
||||
pkts = get_le16(handle_ptr + 2);
|
||||
handle_ptr += 4;
|
||||
BLE_HS_LOG(DEBUG, "handle:%u pkts:%u\n", handle, pkts);
|
||||
--handles;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the authenticated payload timeout event
|
||||
*
|
||||
* @param evdata
|
||||
* @param len
|
||||
*/
|
||||
static void
|
||||
ble_hs_dbg_auth_pyld_tmo_disp(uint8_t *evdata, uint8_t len)
|
||||
{
|
||||
uint16_t handle;
|
||||
|
||||
if (len != sizeof(uint16_t)) {
|
||||
BLE_HS_LOG(DEBUG, "ERR: AuthPyldTmoEvent bad length %u\n", len);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
handle = get_le16(evdata);
|
||||
BLE_HS_LOG(DEBUG, "AuthPyldTmo: handle=%u\n", handle);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ble_hs_dbg_cmd_comp_info_params(uint8_t status, uint8_t ocf, uint8_t *evdata)
|
||||
{
|
||||
int i;
|
||||
uint8_t *dptr;
|
||||
|
||||
if (status != BLE_ERR_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (ocf) {
|
||||
case BLE_HCI_OCF_IP_RD_LOCAL_VER:
|
||||
BLE_HS_LOG(DEBUG, "hci_ver=%u hci_rev=%u lmp_ver=%u mfrg=%u "
|
||||
"lmp_subver=%u",
|
||||
evdata[0], get_le16(evdata + 1), evdata[3],
|
||||
get_le16(evdata + 4), get_le16(evdata + 6));
|
||||
break;
|
||||
case BLE_HCI_OCF_IP_RD_LOC_SUPP_CMD:
|
||||
BLE_HS_LOG(DEBUG, "supp_cmds=");
|
||||
dptr = evdata;
|
||||
for (i = 0; i < 8; ++i) {
|
||||
BLE_HS_LOG(DEBUG, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:",
|
||||
dptr[0], dptr[1], dptr[2], dptr[3],
|
||||
dptr[4], dptr[5], dptr[6], dptr[7]);
|
||||
dptr += 8;
|
||||
}
|
||||
break;
|
||||
case BLE_HCI_OCF_IP_RD_LOC_SUPP_FEAT:
|
||||
BLE_HS_LOG(DEBUG, "supp_feat=0x%lx%08lx",
|
||||
get_le32(evdata + 4), get_le32(evdata));
|
||||
break;
|
||||
case BLE_HCI_OCF_IP_RD_BD_ADDR:
|
||||
BLE_HS_LOG(DEBUG, "bd_addr=%x:%x:%x:%x:%x:%x",
|
||||
evdata[5], evdata[4], evdata[3],
|
||||
evdata[2], evdata[1], evdata[0]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ble_hs_dbg_cmd_complete_disp(uint8_t *evdata, uint8_t len)
|
||||
{
|
||||
uint8_t cmd_pkts;
|
||||
uint8_t ogf;
|
||||
uint8_t ocf;
|
||||
uint8_t status;
|
||||
uint16_t opcode;
|
||||
|
||||
if (len < 3) {
|
||||
BLE_HS_LOG(DEBUG, "Invalid command complete: len=%d "
|
||||
"(expected >= 3)", len);
|
||||
goto done;
|
||||
}
|
||||
|
||||
cmd_pkts = evdata[0];
|
||||
opcode = get_le16(evdata + 1);
|
||||
ogf = BLE_HCI_OGF(opcode);
|
||||
ocf = BLE_HCI_OCF(opcode);
|
||||
|
||||
BLE_HS_LOG(DEBUG, "Command complete: cmd_pkts=%u ogf=0x%x ocf=0x%x",
|
||||
cmd_pkts, ogf, ocf);
|
||||
|
||||
if (len == 3) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = evdata[3];
|
||||
BLE_HS_LOG(DEBUG, " status=%u ", status);
|
||||
|
||||
/* Move past header and status */
|
||||
evdata += 4;
|
||||
|
||||
/* Display parameters based on command. */
|
||||
switch (ogf) {
|
||||
case BLE_HCI_OGF_INFO_PARAMS:
|
||||
ble_hs_dbg_cmd_comp_info_params(status, ocf, evdata);
|
||||
break;
|
||||
case BLE_HCI_OGF_STATUS_PARAMS:
|
||||
switch (ocf) {
|
||||
case BLE_HCI_OCF_RD_RSSI:
|
||||
BLE_HS_LOG(DEBUG, "handle=%u rssi=%d", get_le16(evdata),
|
||||
(int8_t)evdata[2]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case BLE_HCI_OGF_LE:
|
||||
switch (ocf) {
|
||||
case BLE_HCI_OCF_LE_RD_CHAN_MAP:
|
||||
BLE_HS_LOG(DEBUG, "handle=%u chanmap=%x.%x.%x.%x.%x",
|
||||
get_le16(evdata), evdata[2], evdata[3], evdata[4],
|
||||
evdata[5], evdata[6]);
|
||||
break;
|
||||
case BLE_HCI_OCF_LE_RD_MAX_DATA_LEN:
|
||||
BLE_HS_LOG(DEBUG, "txoct=%u txtime=%u rxoct=%u rxtime=%u",
|
||||
get_le16(evdata), get_le16(evdata + 2),
|
||||
get_le16(evdata + 4), get_le16(evdata + 6));
|
||||
break;
|
||||
case BLE_HCI_OCF_LE_RD_SUPP_STATES:
|
||||
BLE_HS_LOG(DEBUG, "states=0x%lx%08lx", get_le32(evdata + 4),
|
||||
get_le32(evdata));
|
||||
break;
|
||||
case BLE_HCI_OCF_LE_ENCRYPT:
|
||||
BLE_HS_LOG(DEBUG, "encdata=0x%02x%02x%02x%02x%02x%02x%02x%02x",
|
||||
evdata[15], evdata[14], evdata[13], evdata[12],
|
||||
evdata[11], evdata[10], evdata[9], evdata[8]);
|
||||
BLE_HS_LOG(DEBUG, "%02x%02x%02x%02x%02x%02x%02x%02x",
|
||||
evdata[7], evdata[6], evdata[5], evdata[4],
|
||||
evdata[3], evdata[2], evdata[1], evdata[0]);
|
||||
|
||||
break;
|
||||
case BLE_HCI_OCF_LE_RAND:
|
||||
BLE_HS_LOG(DEBUG, "rand=0x%02x%02x%02x%02x%02x%02x%02x%02x",
|
||||
evdata[0], evdata[1], evdata[2], evdata[3],
|
||||
evdata[4], evdata[5], evdata[6], evdata[7]);
|
||||
break;
|
||||
case BLE_HCI_OCF_LE_RD_SUGG_DEF_DATA_LEN:
|
||||
BLE_HS_LOG(DEBUG, "txoct=%u txtime=%u", get_le16(evdata),
|
||||
get_le16(evdata + 2));
|
||||
break;
|
||||
case BLE_HCI_OCF_LE_LT_KEY_REQ_REPLY:
|
||||
case BLE_HCI_OCF_LE_LT_KEY_REQ_NEG_REPLY:
|
||||
case BLE_HCI_OCF_LE_SET_DATA_LEN:
|
||||
BLE_HS_LOG(DEBUG, "handle=%u", get_le16(evdata));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
done:
|
||||
BLE_HS_LOG(DEBUG, "\n");
|
||||
}
|
||||
|
||||
static void
|
||||
ble_hs_dbg_cmd_status_disp(uint8_t *evdata, uint8_t len)
|
||||
{
|
||||
uint8_t ogf;
|
||||
uint8_t ocf;
|
||||
uint16_t opcode;
|
||||
|
||||
opcode = get_le16(evdata + 2);
|
||||
ogf = BLE_HCI_OGF(opcode);
|
||||
ocf = BLE_HCI_OCF(opcode);
|
||||
|
||||
BLE_HS_LOG(DEBUG, "Command Status: status=%u cmd_pkts=%u ocf=0x%x "
|
||||
"ogf=0x%x\n", evdata[0], evdata[1], ocf, ogf);
|
||||
}
|
||||
|
||||
void
|
||||
ble_hs_dbg_event_disp(uint8_t *evbuf)
|
||||
{
|
||||
#if MYNEWT_VAL(LOG_LEVEL) > LOG_LEVEL_DEBUG || BLE_MONITOR
|
||||
return;
|
||||
#endif
|
||||
|
||||
uint8_t *evdata;
|
||||
uint8_t evcode;
|
||||
uint8_t len;
|
||||
|
||||
/* Extract event code and length; move pointer to event parameter data */
|
||||
evcode = evbuf[0];
|
||||
len = evbuf[1];
|
||||
evdata = evbuf + BLE_HCI_EVENT_HDR_LEN;
|
||||
|
||||
switch (evcode) {
|
||||
case BLE_HCI_EVCODE_DISCONN_CMP:
|
||||
ble_hs_dbg_disconn_comp_disp(evdata, len);
|
||||
break;
|
||||
case BLE_HCI_EVCODE_ENC_KEY_REFRESH:
|
||||
ble_hs_dbg_encrypt_refresh_disp(evdata, len);
|
||||
break;
|
||||
case BLE_HCI_EVCODE_ENCRYPT_CHG:
|
||||
ble_hs_dbg_encrypt_chg_disp(evdata, len);
|
||||
break;
|
||||
case BLE_HCI_EVCODE_RD_REM_VER_INFO_CMP:
|
||||
ble_hs_dbg_rd_rem_ver_disp(evdata, len);
|
||||
break;
|
||||
case BLE_HCI_EVCODE_COMMAND_COMPLETE:
|
||||
ble_hs_dbg_cmd_complete_disp(evdata, len);
|
||||
break;
|
||||
case BLE_HCI_EVCODE_COMMAND_STATUS:
|
||||
ble_hs_dbg_cmd_status_disp(evdata, len);
|
||||
break;
|
||||
case BLE_HCI_EVCODE_NUM_COMP_PKTS:
|
||||
ble_hs_dbg_num_comp_pkts_disp(evdata, len);
|
||||
break;
|
||||
case BLE_HCI_EVCODE_LE_META:
|
||||
ble_hs_dbg_le_event_disp(evdata[0], len-1, evdata + 1);
|
||||
break;
|
||||
case BLE_HCI_EVCODE_AUTH_PYLD_TMO:
|
||||
ble_hs_dbg_auth_pyld_tmo_disp(evdata, len);
|
||||
break;
|
||||
default:
|
||||
BLE_HS_LOG(DEBUG, "Unknown event 0x%x len=%u\n", evcode, len);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ble_hs_dbg_set_sync_state(uint8_t sync_state)
|
||||
{
|
||||
ble_hs_sync_state = sync_state;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
#ifndef H_BLE_HS_DBG_PRIV_
|
||||
#define H_BLE_HS_DBG_PRIV_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void ble_hs_dbg_event_disp(uint8_t *evbuf);
|
||||
void ble_hs_dbg_set_sync_state(uint8_t sync_state);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* H_HOST_DBG_ */
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "nimble/ble_hci_trans.h"
|
||||
#include "host/ble_monitor.h"
|
||||
#include "ble_hs_priv.h"
|
||||
#include "ble_hs_dbg_priv.h"
|
||||
#include "ble_monitor_priv.h"
|
||||
|
||||
#define BLE_HCI_CMD_TIMEOUT_MS 2000
|
||||
@@ -212,9 +211,6 @@ ble_hs_hci_process_ack(uint16_t expected_opcode,
|
||||
/* Count events received */
|
||||
STATS_INC(ble_hs_stats, hci_event);
|
||||
|
||||
/* Display to console */
|
||||
ble_hs_dbg_event_disp(ble_hs_hci_ack);
|
||||
|
||||
event_code = ble_hs_hci_ack[0];
|
||||
param_len = ble_hs_hci_ack[1];
|
||||
event_len = param_len + 2;
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "nimble/hci_common.h"
|
||||
#include "nimble/ble_hci_trans.h"
|
||||
#include "host/ble_monitor.h"
|
||||
#include "ble_hs_dbg_priv.h"
|
||||
#include "ble_hs_priv.h"
|
||||
#include "ble_monitor_priv.h"
|
||||
|
||||
@@ -80,13 +79,6 @@ ble_hs_hci_cmd_send(uint16_t opcode, uint8_t len, const void *cmddata)
|
||||
memcpy(buf + BLE_HCI_CMD_HDR_LEN, cmddata, len);
|
||||
}
|
||||
|
||||
#if !BLE_MONITOR
|
||||
BLE_HS_LOG(DEBUG, "ble_hs_hci_cmd_send: ogf=0x%02x ocf=0x%04x len=%d\n",
|
||||
BLE_HCI_OGF(opcode), BLE_HCI_OCF(opcode), len);
|
||||
ble_hs_log_flat_buf(buf, len + BLE_HCI_CMD_HDR_LEN);
|
||||
BLE_HS_LOG(DEBUG, "\n");
|
||||
#endif
|
||||
|
||||
rc = ble_hs_hci_cmd_transport(buf);
|
||||
|
||||
if (rc == 0) {
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "host/ble_gap.h"
|
||||
#include "host/ble_monitor.h"
|
||||
#include "ble_hs_priv.h"
|
||||
#include "ble_hs_dbg_priv.h"
|
||||
|
||||
_Static_assert(sizeof (struct hci_data_hdr) == BLE_HCI_DATA_HDR_SZ,
|
||||
"struct hci_data_hdr must be 4 bytes");
|
||||
@@ -853,9 +852,6 @@ ble_hs_hci_evt_process(uint8_t *data)
|
||||
/* Count events received */
|
||||
STATS_INC(ble_hs_stats, hci_event);
|
||||
|
||||
/* Display to console */
|
||||
ble_hs_dbg_event_disp(data);
|
||||
|
||||
/* Process the event */
|
||||
event_code = data[0];
|
||||
param_len = data[1];
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "ble_att_priv.h"
|
||||
#include "ble_gap_priv.h"
|
||||
#include "ble_gatt_priv.h"
|
||||
#include "ble_hs_dbg_priv.h"
|
||||
#include "ble_hs_hci_priv.h"
|
||||
#include "ble_hs_atomic_priv.h"
|
||||
#include "ble_hs_conn_priv.h"
|
||||
@@ -143,31 +142,6 @@ int ble_mqueue_init(struct ble_mqueue *mq, ble_npl_event_fn *ev_fn, void *ev_arg
|
||||
struct os_mbuf *ble_mqueue_get(struct ble_mqueue *mq);
|
||||
int ble_mqueue_put(struct ble_mqueue *mq, struct ble_npl_eventq *evq, struct os_mbuf *om);
|
||||
|
||||
#if MYNEWT_VAL(LOG_LEVEL) <= LOG_LEVEL_DEBUG && !BLE_MONITOR
|
||||
|
||||
#define BLE_HS_LOG_CMD(is_tx, cmd_type, cmd_name, conn_handle, \
|
||||
log_cb, cmd) do \
|
||||
{ \
|
||||
BLE_HS_LOG(DEBUG, "%sed %s command: %s; conn=%d ", \
|
||||
(is_tx) ? "tx" : "rx", (cmd_type), (cmd_name), (conn_handle)); \
|
||||
(log_cb)(cmd); \
|
||||
BLE_HS_LOG(DEBUG, "\n"); \
|
||||
} while (0)
|
||||
|
||||
#define BLE_HS_LOG_EMPTY_CMD(is_tx, cmd_type, cmd_name, conn_handle) do \
|
||||
{ \
|
||||
BLE_HS_LOG(DEBUG, "%sed %s command: %s; conn=%d ", \
|
||||
(is_tx) ? "tx" : "rx", (cmd_type), (cmd_name), (conn_handle)); \
|
||||
BLE_HS_LOG(DEBUG, "\n"); \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
|
||||
#define BLE_HS_LOG_CMD(is_tx, cmd_type, cmd_name, conn_handle, log_cb, cmd)
|
||||
#define BLE_HS_LOG_EMPTY_CMD(is_tx, cmd_type, cmd_name, conn_handle)
|
||||
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(BLE_HS_DEBUG)
|
||||
#define BLE_HS_DBG_ASSERT(x) assert(x)
|
||||
#define BLE_HS_DBG_ASSERT_EVAL(x) assert(x)
|
||||
|
||||
@@ -1464,8 +1464,6 @@ ble_sm_random_rx(uint16_t conn_handle, struct os_mbuf **om,
|
||||
|
||||
cmd = (struct ble_sm_pair_random *)(*om)->om_data;
|
||||
|
||||
BLE_SM_LOG_CMD(0, "random", conn_handle, ble_sm_pair_random_log, cmd);
|
||||
|
||||
ble_hs_lock();
|
||||
proc = ble_sm_proc_find(conn_handle, BLE_SM_PROC_STATE_RANDOM, -1, NULL);
|
||||
if (proc == NULL) {
|
||||
@@ -1514,8 +1512,6 @@ ble_sm_confirm_rx(uint16_t conn_handle, struct os_mbuf **om,
|
||||
|
||||
cmd = (struct ble_sm_pair_confirm *)(*om)->om_data;
|
||||
|
||||
BLE_SM_LOG_CMD(0, "confirm", conn_handle, ble_sm_pair_confirm_log, cmd);
|
||||
|
||||
ble_hs_lock();
|
||||
proc = ble_sm_proc_find(conn_handle, BLE_SM_PROC_STATE_CONFIRM, -1, NULL);
|
||||
if (proc == NULL) {
|
||||
@@ -1762,8 +1758,6 @@ ble_sm_pair_req_rx(uint16_t conn_handle, struct os_mbuf **om,
|
||||
|
||||
req = (struct ble_sm_pair_cmd *)(*om)->om_data;
|
||||
|
||||
BLE_SM_LOG_CMD(0, "pair req", conn_handle, ble_sm_pair_cmd_log, req);
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
/* XXX: Check connection state; reject if not appropriate. */
|
||||
@@ -1862,8 +1856,6 @@ ble_sm_pair_rsp_rx(uint16_t conn_handle, struct os_mbuf **om,
|
||||
|
||||
rsp = (struct ble_sm_pair_cmd *)(*om)->om_data;
|
||||
|
||||
BLE_SM_LOG_CMD(0, "pair rsp", conn_handle, ble_sm_pair_cmd_log, rsp);
|
||||
|
||||
ble_hs_lock();
|
||||
proc = ble_sm_proc_find(conn_handle, BLE_SM_PROC_STATE_PAIR, 1, NULL);
|
||||
if (proc != NULL) {
|
||||
@@ -1942,7 +1934,6 @@ ble_sm_sec_req_rx(uint16_t conn_handle, struct os_mbuf **om,
|
||||
}
|
||||
|
||||
cmd = (struct ble_sm_sec_req *)(*om)->om_data;
|
||||
BLE_SM_LOG_CMD(0, "sec req", conn_handle, ble_sm_sec_req_log, cmd);
|
||||
|
||||
/* XXX: Reject if:
|
||||
* o authreq-reserved flags set?
|
||||
@@ -2210,7 +2201,6 @@ ble_sm_enc_info_rx(uint16_t conn_handle, struct os_mbuf **om,
|
||||
}
|
||||
|
||||
cmd = (struct ble_sm_enc_info *)(*om)->om_data;
|
||||
BLE_SM_LOG_CMD(0, "enc info", conn_handle, ble_sm_enc_info_log, cmd);
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
@@ -2245,7 +2235,6 @@ ble_sm_master_id_rx(uint16_t conn_handle, struct os_mbuf **om,
|
||||
}
|
||||
|
||||
cmd = (struct ble_sm_master_id *)(*om)->om_data;
|
||||
BLE_SM_LOG_CMD(0, "master id", conn_handle, ble_sm_master_id_log, cmd);
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
@@ -2281,7 +2270,6 @@ ble_sm_id_info_rx(uint16_t conn_handle, struct os_mbuf **om,
|
||||
}
|
||||
|
||||
cmd = (struct ble_sm_id_info *)(*om)->om_data;
|
||||
BLE_SM_LOG_CMD(0, "id info", conn_handle, ble_sm_id_info_log, cmd);
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
@@ -2316,8 +2304,6 @@ ble_sm_id_addr_info_rx(uint16_t conn_handle, struct os_mbuf **om,
|
||||
}
|
||||
|
||||
cmd = (struct ble_sm_id_addr_info *)(*om)->om_data;
|
||||
BLE_SM_LOG_CMD(0, "id addr info", conn_handle, ble_sm_id_addr_info_log,
|
||||
cmd);
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
@@ -2352,7 +2338,6 @@ ble_sm_sign_info_rx(uint16_t conn_handle, struct os_mbuf **om,
|
||||
}
|
||||
|
||||
cmd = (struct ble_sm_sign_info *)(*om)->om_data;
|
||||
BLE_SM_LOG_CMD(0, "sign info", conn_handle, ble_sm_sign_info_log, cmd);
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
@@ -2387,7 +2372,6 @@ ble_sm_fail_rx(uint16_t conn_handle, struct os_mbuf **om,
|
||||
res->app_status = ble_hs_mbuf_pullup_base(om, sizeof(*cmd));
|
||||
if (res->app_status == 0) {
|
||||
cmd = (struct ble_sm_pair_fail *)(*om)->om_data;
|
||||
BLE_SM_LOG_CMD(0, "fail", conn_handle, ble_sm_pair_fail_log, cmd);
|
||||
|
||||
res->app_status = BLE_HS_SM_PEER_ERR(cmd->reason);
|
||||
}
|
||||
|
||||
@@ -61,97 +61,3 @@ ble_sm_tx(uint16_t conn_handle, struct os_mbuf *txom)
|
||||
&conn, &chan);
|
||||
return ble_l2cap_tx(conn, chan, txom);
|
||||
}
|
||||
|
||||
#if NIMBLE_BLE_SM
|
||||
void
|
||||
ble_sm_pair_cmd_log(struct ble_sm_pair_cmd *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "io_cap=%d oob_data_flag=%d authreq=0x%02x "
|
||||
"mac_enc_key_size=%d init_key_dist=%d "
|
||||
"resp_key_dist=%d",
|
||||
cmd->io_cap, cmd->oob_data_flag, cmd->authreq,
|
||||
cmd->max_enc_key_size, cmd->init_key_dist,
|
||||
cmd->resp_key_dist);
|
||||
}
|
||||
|
||||
void
|
||||
ble_sm_pair_confirm_log(struct ble_sm_pair_confirm *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "value=");
|
||||
ble_hs_log_flat_buf(cmd->value, sizeof cmd->value);
|
||||
}
|
||||
|
||||
void
|
||||
ble_sm_pair_random_log(struct ble_sm_pair_random *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "value=");
|
||||
ble_hs_log_flat_buf(cmd->value, sizeof cmd->value);
|
||||
}
|
||||
|
||||
void
|
||||
ble_sm_pair_fail_log(struct ble_sm_pair_fail *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "reason=%d", cmd->reason);
|
||||
}
|
||||
|
||||
void
|
||||
ble_sm_enc_info_log(struct ble_sm_enc_info *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "ltk=");
|
||||
ble_hs_log_flat_buf(cmd->ltk, sizeof cmd->ltk);
|
||||
}
|
||||
|
||||
void
|
||||
ble_sm_master_id_log(struct ble_sm_master_id *cmd)
|
||||
{
|
||||
/* These get logged separately to accommodate a bug in the va_args
|
||||
* implementation related to 64-bit integers.
|
||||
*/
|
||||
BLE_HS_LOG(DEBUG, "ediv=0x%04x ", cmd->ediv);
|
||||
BLE_HS_LOG(DEBUG, "rand=0x%016llx", cmd->rand_val);
|
||||
}
|
||||
|
||||
void
|
||||
ble_sm_id_info_log(struct ble_sm_id_info *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "irk=");
|
||||
ble_hs_log_flat_buf(cmd->irk, sizeof cmd->irk);
|
||||
}
|
||||
|
||||
void
|
||||
ble_sm_id_addr_info_log(struct ble_sm_id_addr_info *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "addr_type=%d addr=", cmd->addr_type);
|
||||
BLE_HS_LOG_ADDR(DEBUG, cmd->bd_addr);
|
||||
}
|
||||
|
||||
void
|
||||
ble_sm_sign_info_log(struct ble_sm_sign_info *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "sig_key=");
|
||||
ble_hs_log_flat_buf(cmd->sig_key, sizeof cmd->sig_key);
|
||||
}
|
||||
|
||||
void
|
||||
ble_sm_sec_req_log(struct ble_sm_sec_req *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "authreq=0x%02x", cmd->authreq);
|
||||
}
|
||||
|
||||
void
|
||||
ble_sm_public_key_log(struct ble_sm_public_key *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "x=");
|
||||
ble_hs_log_flat_buf(cmd->x, sizeof cmd->x);
|
||||
BLE_HS_LOG(DEBUG, "y=");
|
||||
ble_hs_log_flat_buf(cmd->y, sizeof cmd->y);
|
||||
}
|
||||
|
||||
void
|
||||
ble_sm_dhkey_check_log(struct ble_sm_dhkey_check *cmd)
|
||||
{
|
||||
BLE_HS_LOG(DEBUG, "value=");
|
||||
ble_hs_log_flat_buf(cmd->value, sizeof cmd->value);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -294,19 +294,6 @@ void ble_sm_dbg_set_sc_keys(uint8_t *pubkey, uint8_t *privkey);
|
||||
|
||||
int ble_sm_num_procs(void);
|
||||
|
||||
void ble_sm_pair_cmd_log(struct ble_sm_pair_cmd *cmd);
|
||||
void ble_sm_pair_confirm_log(struct ble_sm_pair_confirm *cmd);
|
||||
void ble_sm_pair_random_log(struct ble_sm_pair_random *cmd);
|
||||
void ble_sm_pair_fail_log(struct ble_sm_pair_fail *cmd);
|
||||
void ble_sm_enc_info_log(struct ble_sm_enc_info *cmd);
|
||||
void ble_sm_master_id_log(struct ble_sm_master_id *cmd);
|
||||
void ble_sm_id_info_log(struct ble_sm_id_info *cmd);
|
||||
void ble_sm_id_addr_info_log(struct ble_sm_id_addr_info *cmd);
|
||||
void ble_sm_sign_info_log(struct ble_sm_sign_info *cmd);
|
||||
void ble_sm_sec_req_log(struct ble_sm_sec_req *cmd);
|
||||
void ble_sm_public_key_log(struct ble_sm_public_key *cmd);
|
||||
void ble_sm_dhkey_check_log(struct ble_sm_dhkey_check *cmd);
|
||||
|
||||
int ble_sm_alg_s1(uint8_t *k, uint8_t *r1, uint8_t *r2, uint8_t *out);
|
||||
int ble_sm_alg_c1(uint8_t *k, uint8_t *r,
|
||||
uint8_t *preq, uint8_t *pres,
|
||||
@@ -400,10 +387,6 @@ int ble_sm_enc_initiate(uint16_t conn_handle, uint8_t key_size,
|
||||
const uint8_t *ltk, uint16_t ediv,
|
||||
uint64_t rand_val, int auth);
|
||||
int ble_sm_init(void);
|
||||
|
||||
#define BLE_SM_LOG_CMD(is_tx, cmd_name, conn_handle, log_cb, cmd) \
|
||||
BLE_HS_LOG_CMD((is_tx), "sm", (cmd_name), (conn_handle), (log_cb), (cmd))
|
||||
|
||||
#else
|
||||
|
||||
#define ble_sm_enc_change_rx(evt) ((void)(evt))
|
||||
|
||||
@@ -568,7 +568,6 @@ ble_sm_sc_public_key_rx(uint16_t conn_handle, struct os_mbuf **om,
|
||||
}
|
||||
|
||||
cmd = (struct ble_sm_public_key *)(*om)->om_data;
|
||||
BLE_SM_LOG_CMD(0, "public key", conn_handle, ble_sm_public_key_log, cmd);
|
||||
|
||||
ble_hs_lock();
|
||||
proc = ble_sm_proc_find(conn_handle, BLE_SM_PROC_STATE_PUBLIC_KEY, -1,
|
||||
@@ -768,7 +767,6 @@ ble_sm_sc_dhkey_check_rx(uint16_t conn_handle, struct os_mbuf **om,
|
||||
}
|
||||
|
||||
cmd = (struct ble_sm_dhkey_check *)(*om)->om_data;
|
||||
BLE_SM_LOG_CMD(0, "dhkey check", conn_handle, ble_sm_dhkey_check_log, cmd);
|
||||
|
||||
ble_hs_lock();
|
||||
proc = ble_sm_proc_find(conn_handle, BLE_SM_PROC_STATE_DHKEY_CHECK, -1,
|
||||
|
||||
Reference in New Issue
Block a user