set active set to false when stoping advertising

pull/8738/head
paul-szczepanek-arm 2018-11-26 23:00:29 +00:00
parent 4d986bf376
commit a14f143c85
1 changed files with 23 additions and 11 deletions

View File

@ -2302,25 +2302,37 @@ ble_error_t GenericGap::stopAdvertising(advertising_handle_t handle)
return BLE_ERROR_INVALID_PARAM;
}
if (is_extended_advertising_available() == false) {
ble_error_t status;
if (is_extended_advertising_available()) {
status = _pal_gap.extended_advertising_enable(
/*enable ? */ false,
/* number of advertising sets */ 1,
&handle,
NULL,
NULL
);
if (status) {
return status;
}
} else {
if (handle != LEGACY_ADVERTISING_HANDLE) {
return BLE_ERROR_INVALID_PARAM;
}
ble_error_t err = _pal_gap.advertising_enable(false);
if (err) {
return err;
status = _pal_gap.advertising_enable(false);
if (status) {
return status;
}
_advertising_timeout.detach();
}
return _pal_gap.extended_advertising_enable(
/*enable ? */ false,
/* number of advertising sets */ 1,
&handle,
NULL,
NULL
);
_active_sets.clear(handle);
return status;
}
bool GenericGap::isAdvertisingActive(advertising_handle_t handle)