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