Skip to content

Commit 30cd607

Browse files
remove stopping sets since controller resets them
1 parent ab123d3 commit 30cd607

File tree

1 file changed

+15
-48
lines changed

1 file changed

+15
-48
lines changed

connectivity/FEATURE_BLE/source/generic/GapImpl.cpp

Lines changed: 15 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,20 +1220,6 @@ ble_error_t Gap::reset()
12201220
set_scan_state(ScanState::idle);
12211221
_scan_requested = false;
12221222

1223-
#if BLE_FEATURE_EXTENDED_ADVERTISING
1224-
/* reset pending advertising sets */
1225-
AdvertisingEnableStackNode_t* next = _advertising_enable_queue.next;
1226-
_advertising_enable_queue.next = nullptr;
1227-
_advertising_enable_queue.handle = ble::INVALID_ADVERTISING_HANDLE;
1228-
_advertising_enable_pending = false;
1229-
/* free any allocated nodes */
1230-
while (next) {
1231-
AdvertisingEnableStackNode_t* node_to_free = next;
1232-
AdvertisingEnableStackNode_t* next = next->next;
1233-
delete node_to_free;
1234-
}
1235-
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
1236-
12371223
#if BLE_FEATURE_PRIVACY
12381224
_privacy_initialization_pending = false;
12391225
#if BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
@@ -1249,44 +1235,25 @@ ble_error_t Gap::reset()
12491235
#endif
12501236

12511237
#if BLE_ROLE_BROADCASTER
1238+
/* clear advertising set data on the controller */
1239+
_pal_gap.clear_advertising_sets();
12521240
#if BLE_FEATURE_EXTENDED_ADVERTISING
1253-
if (is_extended_advertising_available()) {
1254-
/* stop all advertising sets */
1255-
for (size_t i = 0; i < BLE_GAP_MAX_ADVERTISING_SETS; ++i) {
1256-
if (_active_sets.get(i)) {
1257-
_pal_gap.extended_advertising_enable(
1258-
/* enable */ false,
1259-
/* number of advertising sets */ 1,
1260-
(advertising_handle_t *) &i,
1261-
nullptr,
1262-
nullptr
1263-
);
1264-
}
1241+
/* reset pending advertising sets */
1242+
AdvertisingEnableStackNode_t* next = _advertising_enable_queue.next;
1243+
_advertising_enable_queue.next = nullptr;
1244+
_advertising_enable_queue.handle = ble::INVALID_ADVERTISING_HANDLE;
1245+
_advertising_enable_pending = false;
1246+
/* free any allocated nodes */
1247+
while (next) {
1248+
AdvertisingEnableStackNode_t* node_to_free = next;
1249+
AdvertisingEnableStackNode_t* next = next->next;
1250+
delete node_to_free;
1251+
}
1252+
_existing_sets.clear();
12651253
#if BLE_FEATURE_PERIODIC_ADVERTISING
1266-
if (_active_periodic_sets.get(i)) {
1267-
_pal_gap.periodic_advertising_enable(
1268-
/* enable */ false,
1269-
(advertising_handle_t) i
1270-
);
1271-
}
1272-
_active_periodic_sets.clear();
1254+
_active_periodic_sets.clear();
12731255
#endif // BLE_FEATURE_PERIODIC_ADVERTISING
1274-
}
1275-
1276-
/* clear state of all advertising sets */
1277-
_existing_sets.clear();
1278-
1279-
/* clear advertising set data on the controller */
1280-
_pal_gap.clear_advertising_sets();
1281-
} else
1282-
#else // BLE_FEATURE_EXTENDED_ADVERTISING
1283-
{
1284-
if (_active_sets.get(LEGACY_ADVERTISING_HANDLE)) {
1285-
_pal_gap.advertising_enable(false);
1286-
}
1287-
}
12881256
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
1289-
12901257
_active_sets.clear();
12911258
_pending_stop_sets.clear();
12921259
_pending_sets.clear();

0 commit comments

Comments
 (0)