mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-09-17 22:49:55 +00:00
nimble/mesh: Fix stop advertising for ADV and GATT bearer
When using ext advetising, we need to make sure to stop correct instance.
This commit is contained in:
@@ -274,7 +274,7 @@ void bt_mesh_register_gatt(void);
|
||||
int bt_le_adv_start(const struct ble_gap_adv_params *param,
|
||||
const struct bt_data *ad, size_t ad_len,
|
||||
const struct bt_data *sd, size_t sd_len);
|
||||
int bt_le_adv_stop(void);
|
||||
int bt_le_adv_stop(bool proxy);
|
||||
|
||||
struct k_delayed_work {
|
||||
struct ble_npl_callout work;
|
||||
|
||||
@@ -131,7 +131,7 @@ static inline void adv_send(struct os_mbuf *buf)
|
||||
|
||||
k_sleep(K_MSEC(duration));
|
||||
|
||||
err = bt_le_adv_stop();
|
||||
err = bt_le_adv_stop(false);
|
||||
adv_send_end(err, cb, cb_data);
|
||||
if (err) {
|
||||
BT_ERR("Stopping advertising failed: err %d", err);
|
||||
|
||||
@@ -643,9 +643,21 @@ error:
|
||||
return err;
|
||||
}
|
||||
|
||||
int bt_le_adv_stop(void)
|
||||
int bt_le_adv_stop(bool proxy)
|
||||
{
|
||||
return ble_gap_ext_adv_stop(BT_MESH_ADV_INST);
|
||||
#if MYNEWT_VAL(BLE_MESH_PROXY)
|
||||
int rc;
|
||||
|
||||
if (proxy) {
|
||||
rc = ble_gap_ext_adv_stop(BT_MESH_ADV_GATT_INST);
|
||||
} else {
|
||||
rc = ble_gap_ext_adv_stop(BT_MESH_ADV_INST);
|
||||
}
|
||||
|
||||
return rc;
|
||||
#else
|
||||
return ble_gap_ext_adv_stop(BT_MESH_ADV_INST);
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -695,7 +707,7 @@ bt_le_adv_start(const struct ble_gap_adv_params *param,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bt_le_adv_stop(void)
|
||||
int bt_le_adv_stop(bool proxy)
|
||||
{
|
||||
return ble_gap_adv_stop();
|
||||
}
|
||||
|
||||
@@ -1233,7 +1233,7 @@ void bt_mesh_proxy_adv_stop(void)
|
||||
return;
|
||||
}
|
||||
|
||||
err = bt_le_adv_stop();
|
||||
err = bt_le_adv_stop(true);
|
||||
if (err) {
|
||||
BT_ERR("Failed to stop advertising (err %d)", err);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user