You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/06/06 14:30:19 UTC
[11/13] incubator-mynewt-core git commit: BLE Host - clean up packet
logging.
BLE Host - clean up packet logging.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/a3e7ae6d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/a3e7ae6d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/a3e7ae6d
Branch: refs/heads/upf54
Commit: a3e7ae6d03d67ef402091e209c14aeba1c567137
Parents: 7120ba1
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Jun 6 21:41:33 2016 +0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Jun 6 21:41:33 2016 +0800
----------------------------------------------------------------------
net/nimble/host/src/ble_att_clt.c | 59 ++++++++++++++++++
net/nimble/host/src/ble_att_cmd.c | 94 ++++++++++++++++++++++++++++-
net/nimble/host/src/ble_att_cmd_priv.h | 30 ++++++---
net/nimble/host/src/ble_att_priv.h | 3 +
net/nimble/host/src/ble_att_svr.c | 44 +++++++++++++-
net/nimble/host/src/ble_hs_priv.h | 7 +++
6 files changed, 227 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a3e7ae6d/net/nimble/host/src/ble_att_clt.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_clt.c b/net/nimble/host/src/ble_att_clt.c
index 30fe813..dba3527 100644
--- a/net/nimble/host/src/ble_att_clt.c
+++ b/net/nimble/host/src/ble_att_clt.c
@@ -197,6 +197,8 @@ ble_att_clt_tx_mtu(uint16_t conn_handle, struct ble_att_mtu_cmd *req)
struct os_mbuf *txom;
int rc;
+ BLE_ATT_LOG_CMD(1, "mtu req", conn_handle, ble_att_mtu_cmd_log, req);
+
if (req->bamc_mtu < BLE_ATT_MTU_DFLT) {
return BLE_HS_EINVAL;
}
@@ -286,6 +288,9 @@ ble_att_clt_tx_find_info(uint16_t conn_handle,
struct os_mbuf *txom;
int rc;
+ BLE_ATT_LOG_CMD(1, "find info req", conn_handle,
+ ble_att_find_info_req_log, req);
+
if (req->bafq_start_handle == 0 ||
req->bafq_start_handle > req->bafq_end_handle) {
@@ -375,6 +380,8 @@ ble_att_clt_rx_find_info(uint16_t conn_handle, struct os_mbuf **om)
}
ble_att_find_info_rsp_parse((*om)->om_data, (*om)->om_len, &rsp);
+ 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), BLE_ATT_FIND_INFO_RSP_BASE_SZ);
@@ -434,6 +441,9 @@ ble_att_clt_tx_find_type_value(uint16_t conn_handle,
return BLE_HS_ENOTSUP;
#endif
+ BLE_ATT_LOG_CMD(1, "find type value req", conn_handle,
+ ble_att_find_type_value_req_log, req);
+
struct os_mbuf *txom;
int rc;
@@ -484,6 +494,8 @@ 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);
+
/* Reponse consists of a one-byte opcode (already verified) and a variable
* length Handles-Information-List field. Strip the opcode from the
* response.
@@ -556,6 +568,9 @@ ble_att_clt_tx_read_type(uint16_t conn_handle,
struct os_mbuf *txom;
int rc;
+ BLE_ATT_LOG_CMD(1, "read type req", conn_handle,
+ ble_att_read_type_req_log, req);
+
if (req->batq_start_handle == 0 ||
req->batq_start_handle > req->batq_end_handle) {
@@ -610,6 +625,8 @@ ble_att_clt_rx_read_type(uint16_t conn_handle, struct os_mbuf **rxom)
}
ble_att_read_type_rsp_parse((*rxom)->om_data, (*rxom)->om_len, &rsp);
+ BLE_ATT_LOG_CMD(0, "read type rsp", conn_handle, ble_att_read_type_rsp_log,
+ &rsp);
/* Strip the response base from the front of the mbuf. */
os_mbuf_adj(*rxom, BLE_ATT_READ_TYPE_RSP_BASE_SZ);
@@ -672,6 +689,9 @@ ble_att_clt_tx_read(uint16_t conn_handle, struct ble_att_read_req *req)
struct os_mbuf *txom;
int rc;
+ BLE_ATT_LOG_CMD(1, "read req", conn_handle,
+ ble_att_read_req_log, req);
+
if (req->barq_handle == 0) {
return BLE_HS_EINVAL;
}
@@ -700,6 +720,8 @@ ble_att_clt_rx_read(uint16_t conn_handle, struct os_mbuf **rxom)
void *value;
int rc;
+ BLE_ATT_LOG_EMPTY_CMD(0, "read rsp", conn_handle);
+
/* Reponse consists of a one-byte opcode (already verified) and a variable
* length Attribute Value field. Strip the opcode from the response.
*/
@@ -754,6 +776,9 @@ ble_att_clt_tx_read_blob(uint16_t conn_handle,
struct os_mbuf *txom;
int rc;
+ BLE_ATT_LOG_CMD(1, "read blob req", conn_handle,
+ ble_att_read_blob_req_log, req);
+
if (req->babq_handle == 0) {
return BLE_HS_EINVAL;
}
@@ -782,6 +807,8 @@ ble_att_clt_rx_read_blob(uint16_t conn_handle, struct os_mbuf **rxom)
void *value;
int rc;
+ BLE_ATT_LOG_EMPTY_CMD(0, "read blob rsp", conn_handle);
+
/* Reponse consists of a one-byte opcode (already verified) and a variable
* length Attribute Value field. Strip the opcode from the response.
*/
@@ -850,6 +877,8 @@ ble_att_clt_tx_read_mult(uint16_t conn_handle, uint16_t *att_handles,
struct os_mbuf *txom;
int rc;
+ BLE_ATT_LOG_EMPTY_CMD(1, "reqd mult req", conn_handle);
+
if (num_att_handles < 1) {
return BLE_HS_EINVAL;
}
@@ -878,6 +907,8 @@ ble_att_clt_rx_read_mult(uint16_t conn_handle, struct os_mbuf **rxom)
void *value;
int rc;
+ BLE_ATT_LOG_EMPTY_CMD(0, "read mult rsp", conn_handle);
+
/* Reponse consists of a one-byte opcode (already verified) and a variable
* length Attribute Value field. Strip the opcode from the response.
*/
@@ -940,6 +971,9 @@ ble_att_clt_tx_read_group_type(uint16_t conn_handle,
txom = NULL;
+ BLE_ATT_LOG_CMD(1, "read group type req", conn_handle,
+ ble_att_read_group_type_req_log, req);
+
if (req->bagq_start_handle == 0 ||
req->bagq_start_handle > req->bagq_end_handle) {
@@ -1000,6 +1034,8 @@ ble_att_clt_rx_read_group_type(uint16_t conn_handle, struct os_mbuf **rxom)
}
ble_att_read_group_type_rsp_parse((*rxom)->om_data, (*rxom)->om_len, &rsp);
+ BLE_ATT_LOG_CMD(0, "read group type rsp", conn_handle,
+ ble_att_read_group_type_rsp_log, &rsp);
/* Strip the base from the front of the response. */
os_mbuf_adj(*rxom, BLE_ATT_READ_GROUP_TYPE_RSP_BASE_SZ);
@@ -1096,6 +1132,8 @@ ble_att_clt_tx_write_req(uint16_t conn_handle, struct ble_att_write_req *req,
int rc;
+ BLE_ATT_LOG_CMD(1, "write req", conn_handle, ble_att_write_cmd_log, req);
+
rc = ble_att_clt_tx_write_req_or_cmd(conn_handle, req, value, value_len,
1);
return rc;
@@ -1112,6 +1150,8 @@ ble_att_clt_tx_write_cmd(uint16_t conn_handle,
int rc;
+ BLE_ATT_LOG_CMD(1, "write cmd", conn_handle, ble_att_write_cmd_log, req);
+
rc = ble_att_clt_tx_write_req_or_cmd(conn_handle, req, value, value_len,
0);
return rc;
@@ -1124,6 +1164,8 @@ 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;
@@ -1178,6 +1220,9 @@ ble_att_clt_tx_prep_write(uint16_t conn_handle,
struct os_mbuf *txom;
int rc;
+ BLE_ATT_LOG_CMD(1, "prep write req", conn_handle,
+ ble_att_prep_write_cmd_log, req);
+
if (req->bapc_handle == 0) {
return BLE_HS_EINVAL;
}
@@ -1229,6 +1274,8 @@ ble_att_clt_rx_prep_write(uint16_t conn_handle, struct os_mbuf **rxom)
}
ble_att_prep_write_rsp_parse((*rxom)->om_data, (*rxom)->om_len, &rsp);
+ BLE_ATT_LOG_CMD(0, "prep write rsp", conn_handle,
+ ble_att_prep_write_cmd_log, &rsp);
/* Strip the base from the front of the response. */
os_mbuf_adj(*rxom, BLE_ATT_PREP_WRITE_CMD_BASE_SZ);
@@ -1283,6 +1330,9 @@ ble_att_clt_tx_exec_write(uint16_t conn_handle,
struct os_mbuf *txom;
int rc;
+ BLE_ATT_LOG_CMD(1, "exec write req", conn_handle,
+ ble_att_exec_write_req_log, req);
+
if ((req->baeq_flags & BLE_ATT_EXEC_WRITE_F_RESERVED) != 0) {
return BLE_HS_EINVAL;
}
@@ -1309,6 +1359,8 @@ ble_att_clt_rx_exec_write(uint16_t conn_handle, struct os_mbuf **rxom)
int rc;
+ BLE_ATT_LOG_EMPTY_CMD(0, "exec write rsp", conn_handle);
+
rc = ble_hs_misc_pullup_base(rxom, BLE_ATT_EXEC_WRITE_RSP_SZ);
if (rc == 0) {
ble_att_exec_write_rsp_parse((*rxom)->om_data, (*rxom)->om_len);
@@ -1366,6 +1418,8 @@ ble_att_clt_tx_notify(uint16_t conn_handle, struct ble_att_notify_req *req,
struct os_mbuf *txom;
int rc;
+ BLE_ATT_LOG_CMD(1, "notify req", conn_handle, ble_att_notify_req_log, req);
+
if (req->banq_handle == 0) {
return BLE_HS_EINVAL;
}
@@ -1433,6 +1487,9 @@ ble_att_clt_tx_indicate(uint16_t conn_handle,
struct os_mbuf *txom;
int rc;
+ BLE_ATT_LOG_CMD(1, "indicate req", conn_handle, ble_att_indicate_req_log,
+ req);
+
if (req->baiq_handle == 0) {
return BLE_HS_EINVAL;
}
@@ -1458,6 +1515,8 @@ 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;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a3e7ae6d/net/nimble/host/src/ble_att_cmd.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_cmd.c b/net/nimble/host/src/ble_att_cmd.c
index aad771c..5df0846 100644
--- a/net/nimble/host/src/ble_att_cmd.c
+++ b/net/nimble/host/src/ble_att_cmd.c
@@ -98,7 +98,7 @@ ble_att_error_rsp_write(void *payload, int len, struct ble_att_error_rsp *src)
void
ble_att_error_rsp_log(struct ble_att_error_rsp *cmd)
{
- BLE_HS_LOG(DEBUG, "req_op=%d attr_handle=0x%04x error_code=%d",
+ BLE_HS_LOG(DEBUG, "req_op=%d handle=0x%04x error_code=%d",
cmd->baep_req_op, cmd->baep_handle, cmd->baep_error_code);
}
@@ -174,6 +174,13 @@ ble_att_find_info_req_write(void *payload, int len,
ble_att_find_info_req_swap(dst, src);
}
+void
+ble_att_find_info_req_log(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);
+}
+
static void
ble_att_find_info_rsp_swap(struct ble_att_find_info_rsp *dst,
struct ble_att_find_info_rsp *src)
@@ -203,6 +210,12 @@ ble_att_find_info_rsp_write(void *payload, int len,
ble_att_find_info_rsp_swap(dst, src);
}
+void
+ble_att_find_info_rsp_log(struct ble_att_find_info_rsp *cmd)
+{
+ BLE_HS_LOG(DEBUG, "format=%d", cmd->bafp_format);
+}
+
static void
ble_att_find_type_value_req_swap(struct ble_att_find_type_value_req *dst,
struct ble_att_find_type_value_req *src)
@@ -234,6 +247,14 @@ ble_att_find_type_value_req_write(void *payload, int len,
ble_att_find_type_value_req_swap(dst, src);
}
+void
+ble_att_find_type_value_req_log(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);
+}
+
static void
ble_att_read_type_req_swap(struct ble_att_read_type_req *dst,
struct ble_att_read_type_req *src)
@@ -264,6 +285,13 @@ ble_att_read_type_req_write(void *payload, int len,
ble_att_read_type_req_swap(dst, src);
}
+void
+ble_att_read_type_req_log(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);
+}
+
static void
ble_att_read_type_rsp_swap(struct ble_att_read_type_rsp *dst,
struct ble_att_read_type_rsp *src)
@@ -292,6 +320,13 @@ ble_att_read_type_rsp_write(void *payload, int len,
BLE_ATT_READ_TYPE_RSP_BASE_SZ, len);
ble_att_read_type_rsp_swap(dst, src);
}
+
+void
+ble_att_read_type_rsp_log(struct ble_att_read_type_rsp *cmd)
+{
+ BLE_HS_LOG(DEBUG, "length=%d", cmd->batp_length);
+}
+
static void
ble_att_read_req_swap(struct ble_att_read_req *dst,
struct ble_att_read_req *src)
@@ -319,6 +354,12 @@ ble_att_read_req_write(void *payload, int len, struct ble_att_read_req *src)
ble_att_read_req_swap(dst, src);
}
+void
+ble_att_read_req_log(struct ble_att_read_req *cmd)
+{
+ BLE_HS_LOG(DEBUG, "handle=0x%04x", cmd->barq_handle);
+}
+
static void
ble_att_read_blob_req_swap(struct ble_att_read_blob_req *dst,
struct ble_att_read_blob_req *src)
@@ -350,6 +391,13 @@ ble_att_read_blob_req_write(void *payload, int len,
}
void
+ble_att_read_blob_req_log(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(void *payload, int len)
{
ble_att_init_parse(BLE_ATT_OP_READ_MULT_REQ, payload,
@@ -407,6 +455,13 @@ ble_att_read_group_type_req_write(void *payload, int len,
ble_att_read_group_type_req_swap(dst, src);
}
+void
+ble_att_read_group_type_req_log(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);
+}
+
static void
ble_att_read_group_type_rsp_swap(struct ble_att_read_group_type_rsp *dst,
struct ble_att_read_group_type_rsp *src)
@@ -436,6 +491,12 @@ ble_att_read_group_type_rsp_write(void *payload, int len,
ble_att_read_group_type_rsp_swap(dst, src);
}
+void
+ble_att_read_group_type_rsp_log(struct ble_att_read_group_type_rsp *cmd)
+{
+ BLE_HS_LOG(DEBUG, "length=%d", cmd->bagp_length);
+}
+
static void
ble_att_write_req_swap(struct ble_att_write_req *dst,
struct ble_att_write_req *src)
@@ -483,6 +544,12 @@ ble_att_write_cmd_write(void *payload, int len, struct ble_att_write_req *src)
ble_att_write_req_swap(dst, src);
}
+void
+ble_att_write_cmd_log(struct ble_att_write_req *cmd)
+{
+ BLE_HS_LOG(DEBUG, "handle=0x%04x", cmd->bawq_handle);
+}
+
static void
ble_att_prep_write_cmd_swap(struct ble_att_prep_write_cmd *dst,
struct ble_att_prep_write_cmd *src)
@@ -535,6 +602,13 @@ ble_att_prep_write_rsp_write(void *payload, int len,
ble_att_prep_write_cmd_swap(dst, src);
}
+void
+ble_att_prep_write_cmd_log(struct ble_att_prep_write_cmd *cmd)
+{
+ BLE_HS_LOG(DEBUG, "handle=0x%04x offset=%d", cmd->bapc_handle,
+ cmd->bapc_offset);
+}
+
static void
ble_att_exec_write_req_swap(struct ble_att_exec_write_req *dst,
struct ble_att_exec_write_req *src)
@@ -565,6 +639,12 @@ ble_att_exec_write_req_write(void *payload, int len,
}
void
+ble_att_exec_write_req_log(struct ble_att_exec_write_req *cmd)
+{
+ BLE_HS_LOG(DEBUG, "flags=0x%02x", cmd->baeq_flags);
+}
+
+void
ble_att_exec_write_rsp_parse(void *payload, int len)
{
ble_att_init_parse(BLE_ATT_OP_EXEC_WRITE_RSP, payload,
@@ -607,6 +687,12 @@ ble_att_notify_req_write(void *payload, int len,
ble_att_notify_req_swap(dst, src);
}
+void
+ble_att_notify_req_log(struct ble_att_notify_req *cmd)
+{
+ BLE_HS_LOG(DEBUG, "handle=0x%04x", cmd->banq_handle);
+}
+
static void
ble_att_indicate_req_swap(struct ble_att_indicate_req *dst,
struct ble_att_indicate_req *src)
@@ -637,6 +723,12 @@ ble_att_indicate_req_write(void *payload, int len,
}
void
+ble_att_indicate_req_log(struct ble_att_indicate_req *cmd)
+{
+ BLE_HS_LOG(DEBUG, "handle=0x%04x", cmd->baiq_handle);
+}
+
+void
ble_att_indicate_rsp_parse(void *payload, int len)
{
ble_att_init_parse(BLE_ATT_OP_INDICATE_RSP, payload,
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a3e7ae6d/net/nimble/host/src/ble_att_cmd_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_cmd_priv.h b/net/nimble/host/src/ble_att_cmd_priv.h
index 6af2bac..38af5f2 100644
--- a/net/nimble/host/src/ble_att_cmd_priv.h
+++ b/net/nimble/host/src/ble_att_cmd_priv.h
@@ -320,42 +320,51 @@ void ble_att_find_info_req_parse(void *payload, int len,
struct ble_att_find_info_req *req);
void ble_att_find_info_req_write(void *payload, int len,
struct ble_att_find_info_req *req);
+void ble_att_find_info_req_log(struct ble_att_find_info_req *cmd);
void ble_att_find_info_rsp_parse(void *payload, int len,
struct ble_att_find_info_rsp *rsp);
void ble_att_find_info_rsp_write(void *payload, int len,
struct ble_att_find_info_rsp *rsp);
+void ble_att_find_info_rsp_log(struct ble_att_find_info_rsp *cmd);
void ble_att_find_type_value_req_parse(void *payload, int len,
struct ble_att_find_type_value_req *req);
void ble_att_find_type_value_req_write(void *payload, int len,
struct ble_att_find_type_value_req *req);
+void ble_att_find_type_value_req_log(struct ble_att_find_type_value_req *cmd);
void ble_att_read_type_req_parse(void *payload, int len,
struct ble_att_read_type_req *req);
void ble_att_read_type_req_write(void *payload, int len,
struct ble_att_read_type_req *req);
+void ble_att_read_type_req_log(struct ble_att_read_type_req *cmd);
void ble_att_read_type_rsp_parse(void *payload, int len,
struct ble_att_read_type_rsp *rsp);
void ble_att_read_type_rsp_write(void *payload, int len,
struct ble_att_read_type_rsp *rsp);
+void ble_att_read_type_rsp_log(struct ble_att_read_type_rsp *cmd);
void ble_att_read_req_parse(void *payload, int len,
struct ble_att_read_req *req);
void ble_att_read_req_write(void *payload, int len,
struct ble_att_read_req *req);
+void ble_att_read_req_log(struct ble_att_read_req *cmd);
void ble_att_read_blob_req_parse(void *payload, int len,
struct ble_att_read_blob_req *req);
void ble_att_read_blob_req_write(void *payload, int len,
struct ble_att_read_blob_req *req);
+void ble_att_read_blob_req_log(struct ble_att_read_blob_req *cmd);
void ble_att_read_mult_req_parse(void *payload, int len);
void ble_att_read_mult_req_write(void *payload, int len);
void ble_att_read_mult_rsp_parse(void *payload, int len);
void ble_att_read_mult_rsp_write(void *payload, int len);
-void ble_att_read_group_type_req_parse(void *payload, int len,
- struct ble_att_read_group_type_req *req);
-void ble_att_read_group_type_req_write(void *payload, int len,
- struct ble_att_read_group_type_req *req);
-void ble_att_read_group_type_rsp_parse(void *payload, int len,
- struct ble_att_read_group_type_rsp *rsp);
-void ble_att_read_group_type_rsp_write(void *payload, int len,
- struct ble_att_read_group_type_rsp *rsp);
+void ble_att_read_group_type_req_parse(
+ void *payload, int len, struct ble_att_read_group_type_req *req);
+void ble_att_read_group_type_req_write(
+ void *payload, int len, struct ble_att_read_group_type_req *req);
+void ble_att_read_group_type_req_log(struct ble_att_read_group_type_req *cmd);
+void ble_att_read_group_type_rsp_parse(
+ void *payload, int len, struct ble_att_read_group_type_rsp *rsp);
+void ble_att_read_group_type_rsp_write(
+ void *payload, int len, struct ble_att_read_group_type_rsp *rsp);
+void ble_att_read_group_type_rsp_log(struct ble_att_read_group_type_rsp *cmd);
void ble_att_write_req_parse(void *payload, int len,
struct ble_att_write_req *req);
void ble_att_write_req_write(void *payload, int len,
@@ -364,16 +373,19 @@ void ble_att_write_cmd_parse(void *payload, int len,
struct ble_att_write_req *req);
void ble_att_write_cmd_write(void *payload, int len,
struct ble_att_write_req *req);
+void ble_att_write_cmd_log(struct ble_att_write_req *cmd);
void ble_att_prep_write_req_parse(void *payload, int len,
struct ble_att_prep_write_cmd *cmd);
void ble_att_prep_write_req_write(void *payload, int len,
struct ble_att_prep_write_cmd *cmd);
+void ble_att_prep_write_cmd_log(struct ble_att_prep_write_cmd *cmd);
void ble_att_prep_write_rsp_parse(void *payload, int len,
struct ble_att_prep_write_cmd *cmd);
void ble_att_prep_write_rsp_write(void *payload, int len,
struct ble_att_prep_write_cmd *cmd);
void ble_att_exec_write_req_parse(void *payload, int len,
struct ble_att_exec_write_req *req);
+void ble_att_exec_write_req_log(struct ble_att_exec_write_req *cmd);
void ble_att_exec_write_req_write(void *payload, int len,
struct ble_att_exec_write_req *req);
void ble_att_exec_write_rsp_parse(void *payload, int len);
@@ -382,11 +394,13 @@ void ble_att_notify_req_parse(void *payload, int len,
struct ble_att_notify_req *req);
void ble_att_notify_req_write(void *payload, int len,
struct ble_att_notify_req *req);
+void ble_att_notify_req_log(struct ble_att_notify_req *cmd);
void ble_att_indicate_req_parse(void *payload, int len,
struct ble_att_indicate_req *req);
void ble_att_indicate_req_write(void *payload, int len,
struct ble_att_indicate_req *req);
void ble_att_indicate_rsp_parse(void *payload, int len);
void ble_att_indicate_rsp_write(void *payload, int len);
+void ble_att_indicate_req_log(struct ble_att_indicate_req *cmd);
#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a3e7ae6d/net/nimble/host/src/ble_att_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_priv.h b/net/nimble/host/src/ble_att_priv.h
index 77cfc64..f908b9c 100644
--- a/net/nimble/host/src/ble_att_priv.h
+++ b/net/nimble/host/src/ble_att_priv.h
@@ -150,6 +150,9 @@ 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 */
struct ble_att_svr_entry *
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a3e7ae6d/net/nimble/host/src/ble_att_svr.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_svr.c b/net/nimble/host/src/ble_att_svr.c
index 42e7eb5..210d421 100644
--- a/net/nimble/host/src/ble_att_svr.c
+++ b/net/nimble/host/src/ble_att_svr.c
@@ -440,6 +440,7 @@ ble_att_svr_tx_error_rsp(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
rsp.baep_error_code = error_code;
ble_att_error_rsp_write(dst, BLE_ATT_ERROR_RSP_SZ, &rsp);
+ BLE_ATT_LOG_CMD(1, "error rsp", conn_handle, ble_att_error_rsp_log, &rsp);
rc = ble_l2cap_tx(conn, chan, txom);
txom = NULL;
@@ -569,6 +570,7 @@ ble_att_svr_build_mtu_rsp(uint16_t conn_handle, struct os_mbuf **out_txom,
cmd.bamc_mtu = mtu;
ble_att_mtu_rsp_write(dst, BLE_ATT_MTU_CMD_SZ, &cmd);
+ BLE_ATT_LOG_CMD(1, "mtu rsp", conn_handle, ble_att_mtu_cmd_log, &cmd);
rc = 0;
@@ -605,7 +607,7 @@ ble_att_svr_rx_mtu(uint16_t conn_handle, struct os_mbuf **om)
rc = 0;
done:
- rc = ble_att_svr_tx_rsp(conn_handle, rc, txom, BLE_ATT_OP_FIND_INFO_REQ,
+ rc = ble_att_svr_tx_rsp(conn_handle, rc, txom, BLE_ATT_OP_MTU_REQ,
att_err, 0);
if (rc == 0) {
ble_hs_lock();
@@ -754,6 +756,8 @@ ble_att_svr_build_find_info_rsp(uint16_t conn_handle,
}
ble_att_find_info_rsp_write(buf, BLE_ATT_FIND_INFO_RSP_BASE_SZ, &rsp);
+ BLE_ATT_LOG_CMD(1, "find info rsp", conn_handle, ble_att_find_info_rsp_log,
+ &rsp);
/* Write the variable length Information Data field, populating the format
* field as appropriate.
@@ -797,6 +801,8 @@ ble_att_svr_rx_find_info(uint16_t conn_handle, struct os_mbuf **rxom)
}
ble_att_find_info_req_parse((*rxom)->om_data, (*rxom)->om_len, &req);
+ 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).
@@ -1077,6 +1083,8 @@ 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:
@@ -1110,6 +1118,8 @@ ble_att_svr_rx_find_type_value(uint16_t conn_handle, struct os_mbuf **rxom)
}
ble_att_find_type_value_req_parse((*rxom)->om_data, (*rxom)->om_len, &req);
+ 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).
@@ -1258,6 +1268,8 @@ done:
/* Fill the response base. */
rsp.batp_length = BLE_ATT_READ_TYPE_ADATA_BASE_SZ + prev_attr_len;
ble_att_read_type_rsp_write(txom->om_data, txom->om_len, &rsp);
+ BLE_ATT_LOG_CMD(1, "read type rsp", conn_handle,
+ ble_att_read_type_rsp_log, &rsp);
}
*out_txom = txom;
@@ -1299,6 +1311,8 @@ ble_att_svr_rx_read_type(uint16_t conn_handle, struct os_mbuf **rxom)
}
ble_att_read_type_req_parse((*rxom)->om_data, (*rxom)->om_len, &req);
+ BLE_ATT_LOG_CMD(0, "read type req", conn_handle, ble_att_read_type_req_log,
+ &req);
if (req.batq_start_handle > req.batq_end_handle ||
req.batq_start_handle == 0) {
@@ -1396,6 +1410,7 @@ ble_att_svr_build_read_rsp(uint16_t conn_handle, void *attr_data, int attr_len,
goto done;
}
+ BLE_ATT_LOG_EMPTY_CMD(1, "read rsp", conn_handle);
rc = 0;
done:
@@ -1429,6 +1444,7 @@ ble_att_svr_rx_read(uint16_t conn_handle, struct os_mbuf **rxom)
}
ble_att_read_req_parse((*rxom)->om_data, (*rxom)->om_len, &req);
+ BLE_ATT_LOG_CMD(0, "read req", conn_handle, ble_att_read_req_log, &req);
ctxt.offset = 0;
rc = ble_att_svr_read_handle(conn_handle, req.barq_handle, &ctxt,
@@ -1494,6 +1510,7 @@ ble_att_svr_build_read_blob_rsp(void *attr_data, int attr_len, uint16_t mtu,
goto done;
}
+ BLE_ATT_LOG_EMPTY_CMD(1, "read blob rsp", conn_handle);
rc = 0;
done:
@@ -1534,6 +1551,8 @@ ble_att_svr_rx_read_blob(uint16_t conn_handle, struct os_mbuf **rxom)
}
ble_att_read_blob_req_parse((*rxom)->om_data, (*rxom)->om_len, &req);
+ BLE_ATT_LOG_CMD(0, "read blob req", conn_handle, ble_att_read_blob_req_log,
+ &req);
ctxt.offset = req.babq_offset;
rc = ble_att_svr_read_handle(conn_handle, req.babq_handle, &ctxt,
@@ -1652,6 +1671,7 @@ ble_att_svr_build_read_mult_rsp(uint16_t conn_handle,
tx_space -= chunk_sz;
}
+ BLE_ATT_LOG_EMPTY_CMD(1, "read mult rsp", conn_handle);
rc = 0;
done:
@@ -1671,6 +1691,8 @@ 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;
@@ -1956,6 +1978,8 @@ done:
ble_att_read_group_type_rsp_write(rsp_buf,
BLE_ATT_READ_GROUP_TYPE_RSP_BASE_SZ,
&rsp);
+ BLE_ATT_LOG_CMD(1, "read group type rsp", conn_handle,
+ ble_att_read_group_type_rsp_log, &rsp);
rc = 0;
}
@@ -1996,6 +2020,8 @@ ble_att_svr_rx_read_group_type(uint16_t conn_handle, struct os_mbuf **rxom)
}
ble_att_read_group_type_req_parse((*rxom)->om_data, (*rxom)->om_len, &req);
+ BLE_ATT_LOG_CMD(0, "read group type req", conn_handle,
+ ble_att_read_group_type_req_log, &req);
if (req.bagq_start_handle > req.bagq_end_handle ||
req.bagq_start_handle == 0) {
@@ -2060,6 +2086,7 @@ ble_att_svr_build_write_rsp(struct os_mbuf **out_txom, uint8_t *att_err)
*dst = BLE_ATT_OP_WRITE_RSP;
+ BLE_ATT_LOG_EMPTY_CMD(1, "write rsp", conn_handle);
rc = 0;
done:
@@ -2094,6 +2121,8 @@ ble_att_svr_rx_write(uint16_t conn_handle, struct os_mbuf **rxom)
}
ble_att_write_req_parse((*rxom)->om_data, (*rxom)->om_len, &req);
+ BLE_ATT_LOG_CMD(0, "write req", conn_handle,
+ ble_att_write_cmd_log, &req);
/* Strip the request base from the front of the mbuf. */
os_mbuf_adj(*rxom, BLE_ATT_WRITE_REQ_BASE_SZ);
@@ -2141,6 +2170,8 @@ ble_att_svr_rx_write_no_rsp(uint16_t conn_handle, struct os_mbuf **rxom)
}
ble_att_write_cmd_parse((*rxom)->om_data, (*rxom)->om_len, &req);
+ BLE_ATT_LOG_CMD(0, "write cmd", conn_handle,
+ ble_att_write_cmd_log, &req);
/* Strip the request base from the front of the mbuf. */
os_mbuf_adj(*rxom, BLE_ATT_WRITE_REQ_BASE_SZ);
@@ -2371,6 +2402,8 @@ ble_att_svr_rx_prep_write(uint16_t conn_handle, struct os_mbuf **rxom)
}
ble_att_prep_write_req_parse((*rxom)->om_data, (*rxom)->om_len, &req);
+ BLE_ATT_LOG_CMD(0, "prep write req", conn_handle,
+ ble_att_prep_write_cmd_log, &req);
/* Strip the request base from the front of the mbuf. */
os_mbuf_adj(*rxom, BLE_ATT_PREP_WRITE_CMD_BASE_SZ);
@@ -2444,6 +2477,8 @@ ble_att_svr_rx_prep_write(uint16_t conn_handle, struct os_mbuf **rxom)
ble_att_prep_write_rsp_write(txom->om_data, BLE_ATT_PREP_WRITE_CMD_BASE_SZ,
&req);
+ BLE_ATT_LOG_CMD(1, "prep write rsp", conn_handle,
+ ble_att_prep_write_cmd_log, &req);
rc = 0;
@@ -2540,6 +2575,8 @@ ble_att_svr_rx_exec_write(uint16_t conn_handle, struct os_mbuf **rxom)
}
ble_att_exec_write_req_parse((*rxom)->om_data, (*rxom)->om_len, &req);
+ BLE_ATT_LOG_CMD(0, "exec write req", conn_handle,
+ ble_att_exec_write_req_log, &req);
rc = ble_att_svr_build_exec_write_rsp(&txom, &att_err);
if (rc != 0) {
@@ -2608,6 +2645,8 @@ ble_att_svr_rx_notify(uint16_t conn_handle, struct os_mbuf **rxom)
}
ble_att_notify_req_parse((*rxom)->om_data, (*rxom)->om_len, &req);
+ BLE_ATT_LOG_CMD(0, "notify req", conn_handle,
+ ble_att_notify_req_log, &req);
if (req.banq_handle == 0) {
return BLE_HS_EBADDATA;
@@ -2648,6 +2687,7 @@ ble_att_svr_build_indicate_rsp(struct os_mbuf **out_txom)
}
ble_att_indicate_rsp_write(dst, BLE_ATT_INDICATE_RSP_SZ);
+ BLE_ATT_LOG_EMPTY_CMD(1, "indicate rsp", conn_handle);
rc = 0;
@@ -2683,6 +2723,8 @@ ble_att_svr_rx_indicate(uint16_t conn_handle, struct os_mbuf **rxom)
}
ble_att_indicate_req_parse((*rxom)->om_data, (*rxom)->om_len, &req);
+ BLE_ATT_LOG_CMD(0, "indicate req", conn_handle,
+ ble_att_indicate_req_log, &req);
if (req.baiq_handle == 0) {
rc = BLE_HS_EBADDATA;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a3e7ae6d/net/nimble/host/src/ble_hs_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_priv.h b/net/nimble/host/src/ble_hs_priv.h
index 5244089..70f0de8 100644
--- a/net/nimble/host/src/ble_hs_priv.h
+++ b/net/nimble/host/src/ble_hs_priv.h
@@ -136,6 +136,13 @@ void ble_hci_set_phony_ack_cb(ble_hci_cmd_phony_ack_fn *cb);
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); \
+ BLE_HS_LOG(DEBUG, "\n"); \
+} while (0)
+
#else
#define BLE_HS_LOG_CMD(is_tx, cmd_type, cmd_name, conn_handle, log_cb, cmd)