@@ -920,8 +920,6 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
920
920
_pal_gap.clear_advertising_sets ();
921
921
#if BLE_FEATURE_EXTENDED_ADVERTISING
922
922
}
923
-
924
- prepare_legacy_advertising_set ();
925
923
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
926
924
927
925
return BLE_ERROR_NONE;
@@ -1630,10 +1628,12 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
1630
1628
return BLE_ERROR_INVALID_PARAM;
1631
1629
}
1632
1630
1633
- prepare_legacy_advertising_set ();
1634
-
1635
1631
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
+ }
1637
1637
}
1638
1638
1639
1639
if (is_extended_advertising_available ()) {
@@ -1786,10 +1786,12 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
1786
1786
return BLE_ERROR_INVALID_PARAM;
1787
1787
}
1788
1788
1789
- prepare_legacy_advertising_set ();
1790
-
1791
1789
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
+ }
1793
1795
}
1794
1796
1795
1797
// handle special case of legacy advertising
0 commit comments