Skip to content

Commit 53550bb

Browse files
committed
Gap: create legacy advertising set only when required
1 parent 0341d5c commit 53550bb

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

features/FEATURE_BLE/source/generic/GenericGap.tpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -920,8 +920,6 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
920920
_pal_gap.clear_advertising_sets();
921921
#if BLE_FEATURE_EXTENDED_ADVERTISING
922922
}
923-
924-
prepare_legacy_advertising_set();
925923
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
926924

927925
return BLE_ERROR_NONE;
@@ -1630,10 +1628,12 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
16301628
return BLE_ERROR_INVALID_PARAM;
16311629
}
16321630

1633-
prepare_legacy_advertising_set();
1634-
16351631
if (!_existing_sets.get(handle)) {
1636-
return BLE_ERROR_INVALID_PARAM;
1632+
if (handle == LEGACY_ADVERTISING_HANDLE) {
1633+
prepare_legacy_advertising_set();
1634+
} else {
1635+
return BLE_ERROR_INVALID_PARAM;
1636+
}
16371637
}
16381638

16391639
if (is_extended_advertising_available()) {
@@ -1786,10 +1786,12 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
17861786
return BLE_ERROR_INVALID_PARAM;
17871787
}
17881788

1789-
prepare_legacy_advertising_set();
1790-
17911789
if (!_existing_sets.get(handle)) {
1792-
return BLE_ERROR_INVALID_PARAM;
1790+
if (handle == LEGACY_ADVERTISING_HANDLE) {
1791+
prepare_legacy_advertising_set();
1792+
} else {
1793+
return BLE_ERROR_INVALID_PARAM;
1794+
}
17931795
}
17941796

17951797
// handle special case of legacy advertising

0 commit comments

Comments
 (0)