ble_mesh: Optimize some send & recv logs

This commit is contained in:
lly 2020-05-29 15:12:02 +08:00
parent 13154fe5c6
commit 36c476833f
2 changed files with 11 additions and 10 deletions

View file

@ -398,13 +398,13 @@ static int publish_retransmit(struct bt_mesh_model *mod)
key = bt_mesh_tx_appkey_get(pub->dev_role, pub->key); key = bt_mesh_tx_appkey_get(pub->dev_role, pub->key);
if (!key) { if (!key) {
BT_ERR("%s, Failed to find AppKey", __func__); BT_ERR("%s, AppKey 0x%03x not exists", __func__, pub->key);
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
} }
tx.sub = bt_mesh_tx_netkey_get(pub->dev_role, key->net_idx); tx.sub = bt_mesh_tx_netkey_get(pub->dev_role, key->net_idx);
if (!tx.sub) { if (!tx.sub) {
BT_ERR("%s, Failed to get subnet", __func__); BT_ERR("%s, Subnet 0x%04x not exists", __func__, key->net_idx);
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
} }
@ -833,9 +833,9 @@ void bt_mesh_model_recv(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf)
u8_t count = 0U; u8_t count = 0U;
int i; int i;
BT_INFO("app_idx 0x%04x src 0x%04x dst 0x%04x", rx->ctx.app_idx, BT_INFO("recv, app_idx 0x%04x src 0x%04x dst 0x%04x", rx->ctx.app_idx,
rx->ctx.addr, rx->ctx.recv_dst); rx->ctx.addr, rx->ctx.recv_dst);
BT_INFO("len %u: %s", buf->len, bt_hex(buf->data, buf->len)); BT_INFO("recv, len %u: %s", buf->len, bt_hex(buf->data, buf->len));
if (get_opcode(buf, &opcode) < 0) { if (get_opcode(buf, &opcode) < 0) {
BT_WARN("%s, Unable to decode OpCode", __func__); BT_WARN("%s, Unable to decode OpCode", __func__);
@ -967,12 +967,12 @@ static int model_send(struct bt_mesh_model *model,
return -EINVAL; return -EINVAL;
} }
BT_INFO("app_idx 0x%04x src 0x%04x dst 0x%04x", BT_INFO("send, app_idx 0x%04x src 0x%04x dst 0x%04x",
tx->ctx->app_idx, tx->src, tx->ctx->addr); tx->ctx->app_idx, tx->src, tx->ctx->addr);
BT_INFO("len %u: %s", msg->len, bt_hex(msg->data, msg->len)); BT_INFO("send, len %u: %s", msg->len, bt_hex(msg->data, msg->len));
if (!ready_to_send(role, tx->ctx->addr)) { if (!ready_to_send(role, tx->ctx->addr)) {
BT_ERR("%s, fail", __func__); BT_ERR("%s, Not ready", __func__);
return -EINVAL; return -EINVAL;
} }
@ -1057,7 +1057,7 @@ int bt_mesh_model_publish(struct bt_mesh_model *model)
key = bt_mesh_tx_appkey_get(pub->dev_role, pub->key); key = bt_mesh_tx_appkey_get(pub->dev_role, pub->key);
if (!key) { if (!key) {
BT_ERR("%s, Failed to get AppKey", __func__); BT_ERR("%s, AppKey 0x%03x not exists", __func__, pub->key);
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
} }
@ -1082,7 +1082,7 @@ int bt_mesh_model_publish(struct bt_mesh_model *model)
tx.sub = bt_mesh_tx_netkey_get(pub->dev_role, ctx.net_idx); tx.sub = bt_mesh_tx_netkey_get(pub->dev_role, ctx.net_idx);
if (!tx.sub) { if (!tx.sub) {
BT_ERR("%s, Failed to get subnet", __func__); BT_ERR("%s, Subnet 0x%04x not exists", __func__, ctx.net_idx);
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
} }

View file

@ -636,6 +636,7 @@ int bt_mesh_trans_send(struct bt_mesh_net_tx *tx, struct net_buf_simple *msg,
tx->ctx->addr, bt_mesh.seq, tx->ctx->addr, bt_mesh.seq,
BLE_MESH_NET_IVI_TX); BLE_MESH_NET_IVI_TX);
if (err) { if (err) {
BT_ERR("%s, Encrypt failed", __func__);
return err; return err;
} }
@ -1967,7 +1968,7 @@ int bt_mesh_app_key_get(const struct bt_mesh_subnet *subnet, u16_t app_idx,
app_key = bt_mesh_tx_appkey_get(role, app_idx); app_key = bt_mesh_tx_appkey_get(role, app_idx);
if (!app_key) { if (!app_key) {
BT_ERR("%s, Failed to get AppKey", __func__); BT_ERR("%s, AppKey 0x%04x not exists", __func__, app_idx);
return -ENOENT; return -ENOENT;
} }