GenericGap: ensure legacy advertising set exists when setting data

pull/12730/head
Lingkai Dong 2020-03-31 16:12:05 +01:00
parent 2422efc9bb
commit eba5821fd8
1 changed files with 2 additions and 2 deletions

View File

@ -1782,6 +1782,8 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
return BLE_ERROR_INVALID_PARAM; return BLE_ERROR_INVALID_PARAM;
} }
prepare_legacy_advertising_set();
if (!_existing_sets.get(handle)) { if (!_existing_sets.get(handle)) {
return BLE_ERROR_INVALID_PARAM; return BLE_ERROR_INVALID_PARAM;
} }
@ -2689,7 +2691,6 @@ bool GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler> template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::prepare_legacy_advertising_set() void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::prepare_legacy_advertising_set()
{ {
#if BLE_FEATURE_EXTENDED_ADVERTISING
if (_existing_sets.get(LEGACY_ADVERTISING_HANDLE)) { if (_existing_sets.get(LEGACY_ADVERTISING_HANDLE)) {
return; return;
} }
@ -2699,7 +2700,6 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
AdvertisingParameters() AdvertisingParameters()
); );
_existing_sets.set(LEGACY_ADVERTISING_HANDLE); _existing_sets.set(LEGACY_ADVERTISING_HANDLE);
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
} }