fix(nimble): Added change to stop adv before starting new adv

This commit is contained in:
Rahul Tank
2026-08-11 19:08:33 +05:30
parent 44dcef6d6e
commit 68522b8d81
+14 -1
View File
@@ -3815,7 +3815,11 @@ ble_gap_adv_validate(uint8_t own_addr_type, const ble_addr_t *peer_addr,
return BLE_HS_EINVAL;
}
if (ble_gap_slave[0].op != BLE_GAP_OP_NULL) {
if (ble_gap_slave[0].op != BLE_GAP_OP_NULL
#if MYNEWT_VAL(BLE_GAP_ALLOW_ADV_RESTART)
&& ble_gap_slave[0].op != BLE_GAP_OP_S_ADV
#endif
) {
return BLE_HS_EALREADY;
}
@@ -3916,6 +3920,15 @@ ble_gap_adv_start(uint8_t own_addr_type, const ble_addr_t *direct_addr,
goto done;
}
#if MYNEWT_VAL(BLE_GAP_ALLOW_ADV_RESTART)
if (ble_gap_slave[0].op == BLE_GAP_OP_S_ADV) {
rc = ble_gap_adv_stop_no_lock();
if (rc != 0) {
goto done;
}
}
#endif
#if MYNEWT_VAL(BLE_ENABLE_CONN_REATTEMPT) && NIMBLE_BLE_CONNECT
}
#endif