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

This commit is contained in:
Rahul Tank
2026-08-11 11:30:32 +05:30
parent 811681cd65
commit c186c40278
+14 -1
View File
@@ -4941,7 +4941,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;
}
@@ -5157,6 +5161,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