mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-08-16 15:07:53 +00:00
fix(nimble): Added change to stop adv before starting new adv
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user