mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/ble_mesh_console_stack_update' into 'master'
ble_mesh: stack: Update stack to solve several problems See merge request espressif/esp-idf!22499
This commit is contained in:
commit
ec030b358a
@ -56,7 +56,7 @@ static uint32_t bt_mesh_bqb_test_flag(uint8_t op, uint32_t value)
|
|||||||
{
|
{
|
||||||
static uint32_t bqb_log_flag = 0;
|
static uint32_t bqb_log_flag = 0;
|
||||||
|
|
||||||
switch (operation) {
|
switch (op) {
|
||||||
case BLE_MESH_BQB_TEST_FLAG_OP_GET:
|
case BLE_MESH_BQB_TEST_FLAG_OP_GET:
|
||||||
break;
|
break;
|
||||||
case BLE_MESH_BQB_TEST_FLAG_OP_SET:
|
case BLE_MESH_BQB_TEST_FLAG_OP_SET:
|
||||||
@ -77,7 +77,7 @@ uint32_t bt_mesh_bqb_test_flag_get(void)
|
|||||||
|
|
||||||
int bt_mesh_bqb_test_flag_set(uint32_t flag_mask)
|
int bt_mesh_bqb_test_flag_set(uint32_t flag_mask)
|
||||||
{
|
{
|
||||||
if (module_mask > BLE_MESH_BQB_TEST_LOG_LEVEL_OUTPUT_NONE) {
|
if (flag_mask > BLE_MESH_BQB_TEST_LOG_LEVEL_OUTPUT_NONE) {
|
||||||
BT_ERR("Invalid BQB test flag mask 0x%08x", flag_mask);
|
BT_ERR("Invalid BQB test flag mask 0x%08x", flag_mask);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ int bt_mesh_bqb_test_flag_set(uint32_t flag_mask)
|
|||||||
|
|
||||||
bool bt_mesh_bqb_test_flag_check(uint32_t flag_mask)
|
bool bt_mesh_bqb_test_flag_check(uint32_t flag_mask)
|
||||||
{
|
{
|
||||||
if (module_mask > BLE_MESH_BQB_TEST_LOG_LEVEL_OUTPUT_NONE) {
|
if (flag_mask > BLE_MESH_BQB_TEST_LOG_LEVEL_OUTPUT_NONE) {
|
||||||
BT_ERR("Invalid BQB test flag mask 0x%08x", flag_mask);
|
BT_ERR("Invalid BQB test flag mask 0x%08x", flag_mask);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1464,6 +1464,9 @@ static void mod_sub_add(struct bt_mesh_model *model,
|
|||||||
goto send_status;
|
goto send_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BT_BQB(BLE_MESH_BQB_TEST_LOG_LEVEL_PRIMARY_ID_NODE | BLE_MESH_BQB_TEST_LOG_LEVEL_SUB_ID_TNPT,
|
||||||
|
"SubGroupAddr: 0x%x", sub_addr);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(mod->groups); i++) {
|
for (i = 0; i < ARRAY_SIZE(mod->groups); i++) {
|
||||||
if (mod->groups[i] == BLE_MESH_ADDR_UNASSIGNED) {
|
if (mod->groups[i] == BLE_MESH_ADDR_UNASSIGNED) {
|
||||||
mod->groups[i] = sub_addr;
|
mod->groups[i] = sub_addr;
|
||||||
@ -1865,6 +1868,9 @@ static void mod_sub_va_add(struct bt_mesh_model *model,
|
|||||||
goto send_status;
|
goto send_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BT_BQB(BLE_MESH_BQB_TEST_LOG_LEVEL_PRIMARY_ID_NODE | BLE_MESH_BQB_TEST_LOG_LEVEL_SUB_ID_TNPT,
|
||||||
|
"SubVirtualAddr: 0x%x", sub_addr);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(mod->groups); i++) {
|
for (i = 0; i < ARRAY_SIZE(mod->groups); i++) {
|
||||||
if (mod->groups[i] == BLE_MESH_ADDR_UNASSIGNED) {
|
if (mod->groups[i] == BLE_MESH_ADDR_UNASSIGNED) {
|
||||||
mod->groups[i] = sub_addr;
|
mod->groups[i] = sub_addr;
|
||||||
|
@ -1387,10 +1387,12 @@ int bt_mesh_net_decode(struct net_buf_simple *data, enum bt_mesh_net_if net_if,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* For case MESH/NODE/RLY/BV-01-C, even the DST is RFU, it needs to be forwarded. */
|
/* For case MESH/NODE/RLY/BV-01-C, even the DST is RFU, it needs to be forwarded. */
|
||||||
|
#if !CONFIG_BLE_MESH_BQB_TEST
|
||||||
if (BLE_MESH_ADDR_IS_RFU(rx->ctx.recv_dst)) {
|
if (BLE_MESH_ADDR_IS_RFU(rx->ctx.recv_dst)) {
|
||||||
BT_ERR("Destination address is RFU; dropping packet 0x%02x", rx->ctx.recv_dst);
|
BT_ERR("Destination address is RFU; dropping packet 0x%02x", rx->ctx.recv_dst);
|
||||||
return -EBADMSG;
|
return -EBADMSG;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (net_if != BLE_MESH_NET_IF_LOCAL && bt_mesh_elem_find(rx->ctx.addr)) {
|
if (net_if != BLE_MESH_NET_IF_LOCAL && bt_mesh_elem_find(rx->ctx.addr)) {
|
||||||
BT_DBG("Dropping locally originated packet");
|
BT_DBG("Dropping locally originated packet");
|
||||||
@ -1470,6 +1472,11 @@ void bt_mesh_net_recv(struct net_buf_simple *data, int8_t rssi,
|
|||||||
/* Save the state so the buffer can later be relayed */
|
/* Save the state so the buffer can later be relayed */
|
||||||
net_buf_simple_save(&buf, &state);
|
net_buf_simple_save(&buf, &state);
|
||||||
|
|
||||||
|
BT_BQB(BLE_MESH_BQB_TEST_LOG_LEVEL_PRIMARY_ID_NODE | BLE_MESH_BQB_TEST_LOG_LEVEL_SUB_ID_NET,
|
||||||
|
"\nNetRecv: ctl: %d, src: %d, dst: %d, ttl: %d, data: 0x%s",
|
||||||
|
CTL(buf.data), SRC(buf.data), DST(buf.data), TTL(buf.data),
|
||||||
|
bt_hex(buf.data + BLE_MESH_NET_HDR_LEN, buf.len - BLE_MESH_NET_HDR_LEN));
|
||||||
|
|
||||||
rx.local_match = (bt_mesh_fixed_group_match(rx.ctx.recv_dst) ||
|
rx.local_match = (bt_mesh_fixed_group_match(rx.ctx.recv_dst) ||
|
||||||
bt_mesh_elem_find(rx.ctx.recv_dst));
|
bt_mesh_elem_find(rx.ctx.recv_dst));
|
||||||
|
|
||||||
|
@ -2725,6 +2725,11 @@ static void prov_retransmit(struct k_work *work)
|
|||||||
#endif
|
#endif
|
||||||
if (k_uptime_get() - link[idx].tx.start > timeout) {
|
if (k_uptime_get() - link[idx].tx.start > timeout) {
|
||||||
BT_WARN("Provisioner timeout, giving up transaction");
|
BT_WARN("Provisioner timeout, giving up transaction");
|
||||||
|
/**
|
||||||
|
* For the case MESH/PVNR/PBADV/BV-01, provisoner should
|
||||||
|
* sends link close with reason.
|
||||||
|
*/
|
||||||
|
close_link(idx,CLOSE_REASON_TIMEOUT);
|
||||||
reset_link(idx, CLOSE_REASON_TIMEOUT);
|
reset_link(idx, CLOSE_REASON_TIMEOUT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2866,6 +2871,12 @@ static void prov_msg_recv(const uint8_t idx)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
/**
|
||||||
|
* For the case MESH/PVNR/PROV/BV-10-C and MESH/PVNR/PROV/BI-14-C,
|
||||||
|
* provisioner should send transaction ack before closing the link.
|
||||||
|
*/
|
||||||
|
gen_prov_ack_send(idx, link[idx].rx.trans_id);
|
||||||
|
|
||||||
close_link(idx, CLOSE_REASON_FAILED);
|
close_link(idx, CLOSE_REASON_FAILED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -22,9 +22,11 @@
|
|||||||
#if (CONFIG_BLE_MESH_NODE && CONFIG_BLE_MESH_PB_GATT) || \
|
#if (CONFIG_BLE_MESH_NODE && CONFIG_BLE_MESH_PB_GATT) || \
|
||||||
CONFIG_BLE_MESH_GATT_PROXY_SERVER
|
CONFIG_BLE_MESH_GATT_PROXY_SERVER
|
||||||
|
|
||||||
|
#if !CONFIG_BLE_MESH_BQB_TEST
|
||||||
/* Not support enabling Proxy Client and Proxy Server simultaneously */
|
/* Not support enabling Proxy Client and Proxy Server simultaneously */
|
||||||
_Static_assert(!(IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) &&IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_CLIENT)),
|
_Static_assert(!(IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) &&IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_CLIENT)),
|
||||||
"Not support Proxy Server and Proxy Client simultaneously");
|
"Not support Proxy Server and Proxy Client simultaneously");
|
||||||
|
#endif
|
||||||
|
|
||||||
#define PDU_TYPE(data) (data[0] & BIT_MASK(6))
|
#define PDU_TYPE(data) (data[0] & BIT_MASK(6))
|
||||||
#define PDU_SAR(data) (data[0] >> 6)
|
#define PDU_SAR(data) (data[0] >> 6)
|
||||||
|
@ -782,6 +782,11 @@ static int sdu_recv(struct bt_mesh_net_rx *rx, uint32_t seq, uint8_t hdr,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BT_BQB(BLE_MESH_BQB_TEST_LOG_LEVEL_PRIMARY_ID_NODE | BLE_MESH_BQB_TEST_LOG_LEVEL_SUB_ID_TNPT,
|
||||||
|
"\nTNPTRecv: ctl: 0x%04x, ttl: 0x%04x, src: 0x%04x, dst: 0x%04x, payload: 0x%s",
|
||||||
|
rx->ctl, rx->ctx.recv_ttl, rx->ctx.addr, rx->ctx.recv_dst,
|
||||||
|
bt_hex(sdu->data, sdu->len));
|
||||||
|
|
||||||
rx->ctx.app_idx = BLE_MESH_KEY_DEV;
|
rx->ctx.app_idx = BLE_MESH_KEY_DEV;
|
||||||
bt_mesh_model_recv(rx, sdu);
|
bt_mesh_model_recv(rx, sdu);
|
||||||
|
|
||||||
@ -827,6 +832,12 @@ static int sdu_recv(struct bt_mesh_net_rx *rx, uint32_t seq, uint8_t hdr,
|
|||||||
sdu, ad, rx->ctx.addr,
|
sdu, ad, rx->ctx.addr,
|
||||||
rx->ctx.recv_dst, seq,
|
rx->ctx.recv_dst, seq,
|
||||||
BLE_MESH_NET_IVI_RX(rx));
|
BLE_MESH_NET_IVI_RX(rx));
|
||||||
|
|
||||||
|
BT_BQB(BLE_MESH_BQB_TEST_LOG_LEVEL_PRIMARY_ID_NODE | BLE_MESH_BQB_TEST_LOG_LEVEL_SUB_ID_TNPT,
|
||||||
|
"\nTNPTRecv: ctl: 0x%04x, ttl: 0x%04x, src: 0x%04x, dst: 0x%04x, payload: 0x%s",
|
||||||
|
rx->ctl, rx->ctx.recv_ttl, rx->ctx.addr, rx->ctx.recv_dst,
|
||||||
|
bt_hex(sdu->data, sdu->len));
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
BT_DBG("Unable to decrypt with AppKey 0x%03x",
|
BT_DBG("Unable to decrypt with AppKey 0x%03x",
|
||||||
key->app_idx);
|
key->app_idx);
|
||||||
@ -997,6 +1008,11 @@ static int ctl_recv(struct bt_mesh_net_rx *rx, uint8_t hdr,
|
|||||||
|
|
||||||
BT_DBG("OpCode 0x%02x len %u", ctl_op, buf->len);
|
BT_DBG("OpCode 0x%02x len %u", ctl_op, buf->len);
|
||||||
|
|
||||||
|
BT_BQB(BLE_MESH_BQB_TEST_LOG_LEVEL_PRIMARY_ID_NODE | BLE_MESH_BQB_TEST_LOG_LEVEL_SUB_ID_TNPT,
|
||||||
|
"\nTNPTRecv: ctl: 0x%04x, ttl: 0x%04x, src: 0x%04x, dst: 0x%04x, payload: 0x%s",
|
||||||
|
rx->ctl, rx->ctx.recv_ttl, rx->ctx.addr, rx->ctx.recv_dst,
|
||||||
|
bt_hex(buf->data, buf->len));
|
||||||
|
|
||||||
switch (ctl_op) {
|
switch (ctl_op) {
|
||||||
case TRANS_CTL_OP_ACK:
|
case TRANS_CTL_OP_ACK:
|
||||||
return trans_ack(rx, hdr, buf, seq_auth);
|
return trans_ack(rx, hdr, buf, seq_auth);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user