@@ -1096,11 +1096,10 @@ ble_error_t Gap::reset()
1096
1096
#endif
1097
1097
1098
1098
#if BLE_ROLE_BROADCASTER
1099
- _advertising_timeout.detach ();
1100
1099
#if BLE_FEATURE_EXTENDED_ADVERTISING
1101
1100
if (is_extended_advertising_available ()) {
1102
1101
/* stop all advertising sets */
1103
- for (size_t i = 1 ; i < BLE_GAP_MAX_ADVERTISING_SETS; ++i) {
1102
+ for (size_t i = 0 ; i < BLE_GAP_MAX_ADVERTISING_SETS; ++i) {
1104
1103
if (_active_sets.get (i)) {
1105
1104
_pal_gap.extended_advertising_enable (
1106
1105
/* enable */ false ,
@@ -1117,40 +1116,31 @@ ble_error_t Gap::reset()
1117
1116
(advertising_handle_t ) i
1118
1117
);
1119
1118
}
1119
+ _active_periodic_sets.clear ();
1120
1120
#endif // BLE_FEATURE_PERIODIC_ADVERTISING
1121
1121
}
1122
1122
1123
1123
/* clear state of all advertising sets */
1124
1124
_existing_sets.clear ();
1125
- #endif // BLE_FEATURE_EXTENDED_ADVERTISING
1126
- #if BLE_FEATURE_PERIODIC_ADVERTISING
1127
- _active_periodic_sets.clear ();
1128
- #endif
1129
- if (_active_sets.get (LEGACY_ADVERTISING_HANDLE)) {
1130
- #if BLE_FEATURE_EXTENDED_ADVERTISING
1131
- _pal_gap.extended_advertising_enable (
1132
- /* enable */ false ,
1133
- /* number of advertising sets */ 1 ,
1134
- (advertising_handle_t *) &LEGACY_ADVERTISING_HANDLE,
1135
- nullptr ,
1136
- nullptr
1137
- );
1138
- #else
1139
- _pal_gap.advertising_enable (false );
1140
- #endif
1141
- }
1142
- _active_sets.clear ();
1143
- _pending_sets.clear ();
1144
- _address_refresh_sets.clear ();
1145
- _interruptible_sets.clear ();
1146
- _connectable_payload_size_exceeded.clear ();
1147
- _set_is_connectable.clear ();
1148
1125
1149
- #if BLE_FEATURE_EXTENDED_ADVERTISING
1150
1126
/* clear advertising set data on the controller */
1151
1127
_pal_gap.clear_advertising_sets ();
1128
+ } else
1129
+ #else // BLE_FEATURE_EXTENDED_ADVERTISING
1130
+ {
1131
+ if (_active_sets.get (LEGACY_ADVERTISING_HANDLE)) {
1132
+ _pal_gap.advertising_enable (false );
1133
+ }
1152
1134
}
1153
1135
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
1136
+
1137
+ _active_sets.clear ();
1138
+ _pending_sets.clear ();
1139
+ _address_refresh_sets.clear ();
1140
+ _interruptible_sets.clear ();
1141
+ _connectable_payload_size_exceeded.clear ();
1142
+ _set_is_connectable.clear ();
1143
+ _advertising_timeout.detach ();
1154
1144
#endif // #BLE_ROLE_BROADCASTER
1155
1145
1156
1146
return BLE_ERROR_NONE;
0 commit comments