mirror of https://github.com/ARMmbed/mbed-os.git
stop advertising before reseting
parent
6f3a9ca107
commit
bed7677c81
|
|
@ -1349,11 +1349,32 @@ ble_error_t GenericGap::reset(void)
|
||||||
_advertising_timeout.detach();
|
_advertising_timeout.detach();
|
||||||
_scan_timeout.detach();
|
_scan_timeout.detach();
|
||||||
|
|
||||||
|
/* stop all advertising sets */
|
||||||
|
for (size_t i = 0; i < MAX_ADVERTISING_SETS; ++i) {
|
||||||
|
if (_active_sets.get(i)) {
|
||||||
|
_pal_gap.extended_advertising_enable(
|
||||||
|
/* enable */ false,
|
||||||
|
/* number of advertising sets */ 1,
|
||||||
|
(advertising_handle_t*)&i,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (_active_periodic_sets.get(i)) {
|
||||||
|
_pal_gap.periodic_advertising_enable(
|
||||||
|
/* enable */ false,
|
||||||
|
(advertising_handle_t)i
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* clear state of all advertising sets */
|
||||||
_existing_sets.clear();
|
_existing_sets.clear();
|
||||||
|
_existing_sets.set(LEGACY_ADVERTISING_HANDLE);
|
||||||
_active_sets.clear();
|
_active_sets.clear();
|
||||||
_active_periodic_sets.clear();
|
_active_periodic_sets.clear();
|
||||||
_existing_sets.set(LEGACY_ADVERTISING_HANDLE);
|
|
||||||
|
|
||||||
|
/* clear advertising set data on the controller */
|
||||||
_pal_gap.clear_advertising_sets();
|
_pal_gap.clear_advertising_sets();
|
||||||
|
|
||||||
return BLE_ERROR_NONE;
|
return BLE_ERROR_NONE;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue