Skip to content

Commit 6297eda

Browse files
forx157espressif-bot
authored andcommitted
fix(ble_mesh): fixed the issue of incorrect proxy adv flag setting
1 parent 31a089c commit 6297eda

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

components/bt/esp_ble_mesh/core/ext_adv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ static uint32_t received_adv_evts_handle(uint32_t recv_evts)
303303
CONFIG_BLE_MESH_GATT_PROXY_SERVER
304304
if (unlikely(i == BLE_MESH_ADV_PROXY_INS)) {
305305
BT_DBG("Mesh Proxy Advertising auto stop");
306+
bt_mesh_proxy_server_adv_flag_set(false);
306307
} else
307308
#endif
308309
{
@@ -366,7 +367,7 @@ void bt_mesh_adv_update(void)
366367
{
367368
#if (CONFIG_BLE_MESH_NODE && CONFIG_BLE_MESH_PB_GATT) || \
368369
CONFIG_BLE_MESH_GATT_PROXY_SERVER
369-
BT_WARN("Mesh Proxy Advertising stopped manually");
370+
BT_DBG("Mesh Proxy Advertising stopped manually");
370371
bt_mesh_proxy_server_adv_stop();
371372
if (adv_insts[BLE_MESH_ADV_PROXY_INS].busy) {
372373
ble_mesh_adv_task_wakeup(ADV_TASK_PROXY_ADV_UPD_EVT);

components/bt/esp_ble_mesh/core/proxy_server.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/*
44
* SPDX-FileCopyrightText: 2017 Intel Corporation
5-
* SPDX-FileContributor: 2018-2024 Espressif Systems (Shanghai) CO LTD
5+
* SPDX-FileContributor: 2018-2025 Espressif Systems (Shanghai) CO LTD
66
*
77
* SPDX-License-Identifier: Apache-2.0
88
*/
@@ -170,6 +170,11 @@ static void proxy_sar_timeout(struct k_work *work)
170170
bt_mesh_gatts_disconnect(client->conn, 0x13);
171171
}
172172

173+
void bt_mesh_proxy_server_adv_flag_set(bool enable)
174+
{
175+
proxy_adv_enabled = enable;
176+
}
177+
173178
#if CONFIG_BLE_MESH_GATT_PROXY_SERVER
174179
/**
175180
* The following callbacks are used to notify proper information
@@ -853,7 +858,9 @@ static void proxy_connected(struct bt_mesh_conn *conn, uint8_t err)
853858
conn_count++;
854859

855860
/* Since we use ADV_OPT_ONE_TIME */
856-
proxy_adv_enabled = false;
861+
#if !CONFIG_BLE_MESH_USE_BLE_50
862+
bt_mesh_proxy_server_adv_flag_set(false);
863+
#endif
857864

858865
#if CONFIG_BLE_MESH_PROXY_SOLIC_PDU_RX
859866
/* Before re-enabling advertising, stop advertising
@@ -1498,7 +1505,7 @@ static int node_id_adv(struct bt_mesh_subnet *sub)
14981505
return err;
14991506
}
15001507

1501-
proxy_adv_enabled = true;
1508+
bt_mesh_proxy_server_adv_flag_set(true);
15021509

15031510
return 0;
15041511
}
@@ -1529,7 +1536,7 @@ static int net_id_adv(struct bt_mesh_subnet *sub)
15291536
return err;
15301537
}
15311538

1532-
proxy_adv_enabled = true;
1539+
bt_mesh_proxy_server_adv_flag_set(true);
15331540

15341541
return 0;
15351542
}
@@ -1592,7 +1599,7 @@ static int private_node_id_adv(struct bt_mesh_subnet *sub)
15921599
return err;
15931600
}
15941601

1595-
proxy_adv_enabled = true;
1602+
bt_mesh_proxy_server_adv_flag_set(true);
15961603

15971604
return 0;
15981605
}
@@ -1636,7 +1643,7 @@ static int private_net_id_adv(struct bt_mesh_subnet *sub)
16361643
return err;
16371644
}
16381645

1639-
proxy_adv_enabled = true;
1646+
bt_mesh_proxy_server_adv_flag_set(true);
16401647

16411648
return 0;
16421649
}
@@ -1902,7 +1909,7 @@ int32_t bt_mesh_proxy_server_adv_start(void)
19021909
prov_sd, prov_sd_len) == 0) {
19031910
#endif /* CONFIG_BLE_MESH_USE_BLE_50 */
19041911

1905-
proxy_adv_enabled = true;
1912+
bt_mesh_proxy_server_adv_flag_set(true);
19061913

19071914
/* Advertise 60 seconds using fast interval */
19081915
if (prov_fast_adv) {
@@ -1959,7 +1966,7 @@ int bt_mesh_proxy_server_adv_stop(void)
19591966
return -EINVAL;
19601967
}
19611968

1962-
proxy_adv_enabled = false;
1969+
bt_mesh_proxy_server_adv_flag_set(false);
19631970
return 0;
19641971
}
19651972

@@ -2022,7 +2029,7 @@ int bt_mesh_proxy_server_deinit(void)
20222029
proxy_adv_inst = BLE_MESH_ADV_INS_UNUSED;
20232030
#endif
20242031

2025-
proxy_adv_enabled = false;
2032+
bt_mesh_proxy_server_adv_flag_set(false);
20262033
gatt_svc = MESH_GATT_NONE;
20272034

20282035
#if CONFIG_BLE_MESH_GATT_PROXY_SERVER

components/bt/esp_ble_mesh/core/proxy_server.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ void bt_mesh_proxy_server_identity_stop(struct bt_mesh_subnet *sub);
118118

119119
bool bt_mesh_proxy_server_relay(struct net_buf_simple *buf, uint16_t dst);
120120
void bt_mesh_proxy_server_addr_add(struct net_buf_simple *buf, uint16_t addr);
121+
void bt_mesh_proxy_server_adv_flag_set(bool enable);
121122

122123
int bt_mesh_proxy_server_init(void);
123124
int bt_mesh_proxy_server_deinit(void);

0 commit comments

Comments
 (0)