diff --git a/components/bt/esp_ble_mesh/mesh_core/bluedroid_host/mesh_bearer_adapt.c b/components/bt/esp_ble_mesh/mesh_core/bluedroid_host/mesh_bearer_adapt.c index 2328ac6a4a..4a9988b418 100644 --- a/components/bt/esp_ble_mesh/mesh_core/bluedroid_host/mesh_bearer_adapt.c +++ b/components/bt/esp_ble_mesh/mesh_core/bluedroid_host/mesh_bearer_adapt.c @@ -1576,8 +1576,10 @@ static void bt_mesh_bta_gattc_cb(tBTA_GATTC_EVT event, tBTA_GATTC *p_data) for (i = 0; i < ARRAY_SIZE(bt_mesh_gattc_info); i++) { if (bt_mesh_gattc_info[i].conn.handle == handle) { if (bt_mesh_gattc_info[i].wr_desc_done == false) { - BT_DBG("Receive notification before finishing to write ccc"); + BT_WARN("Receive notification before finishing to write ccc"); +#if !CONFIG_BLE_MESH_BQB_TEST return; +#endif } conn = &bt_mesh_gattc_info[i].conn; diff --git a/components/bt/esp_ble_mesh/mesh_core/proxy_client.c b/components/bt/esp_ble_mesh/mesh_core/proxy_client.c index 8241c0c902..2ceb5dcdac 100644 --- a/components/bt/esp_ble_mesh/mesh_core/proxy_client.c +++ b/components/bt/esp_ble_mesh/mesh_core/proxy_client.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2017-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -37,6 +37,7 @@ static struct bt_mesh_proxy_server { struct bt_mesh_conn *conn; + bt_mesh_addr_t addr; enum __packed { NONE, PROV, @@ -411,6 +412,7 @@ static void proxy_connected(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn, int server->conn = bt_mesh_conn_ref(conn); server->conn_type = NONE; + memcpy(&server->addr, addr, sizeof(bt_mesh_addr_t)); net_buf_simple_reset(&server->buf); bt_mesh_gattc_exchange_mtu(id); @@ -544,6 +546,12 @@ static ssize_t proxy_write_ccc(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn) return 0; } +#if CONFIG_BLE_MESH_BQB_TEST + /* notify maybe received first */ + if (server->conn_type == PROXY) { + return 0; + } +#endif return -EINVAL; } @@ -556,6 +564,16 @@ static ssize_t proxy_recv_ntf(struct bt_mesh_conn *conn, uint8_t *data, uint16_t return -ENOTCONN; } +#if CONFIG_BLE_MESH_BQB_TEST + /* update conn type if notify received before write ccc */ + if (server->conn_type == NONE) { + server->conn_type = PROXY; + if (proxy_client_connect_cb) { + proxy_client_connect_cb(&server->addr, server - servers, server->net_idx); + } + } +#endif + if (server->conn_type == PROXY) { return proxy_recv(conn, NULL, data, len, 0, 0); } diff --git a/components/bt/esp_ble_mesh/mesh_core/proxy_server.c b/components/bt/esp_ble_mesh/mesh_core/proxy_server.c index 897c18005b..086811c78f 100644 --- a/components/bt/esp_ble_mesh/mesh_core/proxy_server.c +++ b/components/bt/esp_ble_mesh/mesh_core/proxy_server.c @@ -1059,7 +1059,7 @@ static int proxy_segment_and_send(struct bt_mesh_conn *conn, uint8_t type, net_buf_simple_pull(msg, mtu); while (msg->len) { - if (msg->len + 1 < mtu) { + if (msg->len + 1 <= mtu) { net_buf_simple_push_u8(msg, PDU_HDR(SAR_LAST, type)); proxy_send(conn, msg->data, msg->len); break;