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:
Łukasz Rymanowski
2018-05-22 23:48:26 +02:00
parent 12f3d059cd
commit cc9b523e60
4 changed files with 18 additions and 6 deletions
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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);
+15 -3
View File
@@ -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();
}
+1 -1
View File
@@ -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 {