File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -333,6 +333,15 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
333333 if (event.isConnected ()) {
334334 printf (" Stopped advertising early due to connection\r\n " );
335335 }
336+
337+ #if BLE_FEATURE_EXTENDED_ADVERTISING
338+ ble_error_t error = _gap.destroyAdvertisingSet (_extended_adv_handle);
339+ if (error) {
340+ print_error (error, " Error caused by Gap::destroyAdvertisingSet" );
341+ }
342+
343+ _extended_adv_handle = ble::INVALID_ADVERTISING_HANDLE;
344+ #endif // BLE_FEATURE_EXTENDED_ADVERTISING
336345 }
337346
338347 void onAdvertisingStart (const ble::AdvertisingStartEvent &event) override
@@ -499,19 +508,12 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
499508 print_error (error, " Error caused by Gap::stopAdvertising" );
500509 }
501510 }
502-
503- ble_error_t error = _gap.destroyAdvertisingSet (_extended_adv_handle);
504- if (error) {
505- print_error (error, " Error caused by Gap::destroyAdvertisingSet" );
506- }
507-
508- _extended_adv_handle = ble::INVALID_ADVERTISING_HANDLE;
509511 }
510- #endif // BLE_FEATURE_EXTENDED_ADVERTISING
511-
512+ #else
512513 _is_in_scanning_phase = true ;
513514
514515 _event_queue.call_in (delay, [this ]{ scan (); });
516+ #endif // BLE_FEATURE_EXTENDED_ADVERTISING
515517 }
516518
517519 /* * print some information about our radio activity */
You can’t perform that action at this time.
0 commit comments