@@ -1127,15 +1127,10 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
1127
1127
1128
1128
/* clear advertising set data on the controller */
1129
1129
_pal_gap.clear_advertising_sets ();
1130
-
1131
- setExtendedAdvertisingParameters (
1132
- LEGACY_ADVERTISING_HANDLE,
1133
- AdvertisingParameters ()
1134
- );
1135
1130
#if BLE_FEATURE_EXTENDED_ADVERTISING
1136
1131
}
1137
1132
1138
- _existing_sets. set (LEGACY_ADVERTISING_HANDLE );
1133
+ prepare_legacy_advertising_set ( );
1139
1134
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
1140
1135
1141
1136
return BLE_ERROR_NONE;
@@ -1844,6 +1839,8 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
1844
1839
return BLE_ERROR_INVALID_PARAM;
1845
1840
}
1846
1841
1842
+ prepare_legacy_advertising_set ();
1843
+
1847
1844
if (!_existing_sets.get (handle)) {
1848
1845
return BLE_ERROR_INVALID_PARAM;
1849
1846
}
@@ -1998,6 +1995,8 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
1998
1995
return BLE_ERROR_INVALID_PARAM;
1999
1996
}
2000
1997
1998
+ prepare_legacy_advertising_set ();
1999
+
2001
2000
if (!_existing_sets.get (handle)) {
2002
2001
return BLE_ERROR_INVALID_PARAM;
2003
2002
}
@@ -2902,5 +2901,22 @@ bool GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
2902
2901
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
2903
2902
}
2904
2903
2904
+ template <template <class > class PalGapImpl , class PalSecurityManager , class ConnectionEventMonitorEventHandler >
2905
+ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::prepare_legacy_advertising_set ()
2906
+ {
2907
+ #if BLE_FEATURE_EXTENDED_ADVERTISING
2908
+ if (_existing_sets.get (LEGACY_ADVERTISING_HANDLE)) {
2909
+ return ;
2910
+ }
2911
+
2912
+ setExtendedAdvertisingParameters (
2913
+ LEGACY_ADVERTISING_HANDLE,
2914
+ AdvertisingParameters ()
2915
+ );
2916
+ _existing_sets.set (LEGACY_ADVERTISING_HANDLE);
2917
+ #endif // BLE_FEATURE_EXTENDED_ADVERTISING
2918
+ }
2919
+
2920
+
2905
2921
} // generic
2906
2922
} // ble
0 commit comments