File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
connectivity/FEATURE_BLE/source/cordio/source Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ bool dummy_gap_event_handler(const wsfMsgHdr_t *msg)
3232}
3333}
3434
35+ #if BLE_FEATURE_PERIODIC_ADVERTISING && BLE_ROLE_OBSERVER
36+ sync_handle_t PalGap::_pending_periodic_sync_handle = 0 ;
37+ #endif
3538
3639bool PalGap::is_feature_supported (
3740 ble::controller_supported_features_t feature
@@ -592,7 +595,8 @@ void PalGap::gap_handler(const wsfMsgHdr_t *msg)
592595
593596 handler->on_periodic_advertising_sync_established (
594597 hci_error_code_t (evt->status ),
595- evt->syncHandle ,
598+ /* the Cordio host stack uses a different ID to identify the control block */
599+ _pending_periodic_sync_handle,
596600 evt->advSid ,
597601 connection_peer_address_type_t (evt->advAddrType ),
598602 evt->advAddr ,
@@ -1343,6 +1347,8 @@ ble_error_t PalGap::periodic_advertising_create_sync(
13431347 if (sync_id == DM_SYNC_ID_NONE) {
13441348 return BLE_ERROR_INTERNAL_STACK_FAILURE;
13451349 } else {
1350+ /* this is not the real handle, this is CORDIO internal handle but the user doesn't need to know that */
1351+ _pending_periodic_sync_handle = sync_id;
13461352 return BLE_ERROR_NONE;
13471353 }
13481354}
Original file line number Diff line number Diff line change @@ -566,6 +566,10 @@ class PalGap final : public ble::PalGap {
566566 }
567567
568568private:
569+ #if BLE_FEATURE_PERIODIC_ADVERTISING && BLE_ROLE_OBSERVER
570+ /* must be static because is needed in a static handler, there can only be one sync in progress */
571+ static sync_handle_t _pending_periodic_sync_handle;
572+ #endif
569573 PalGapEventHandler *_pal_event_handler;
570574 address_t device_random_address;
571575 bool use_active_scanning;
You can’t perform that action at this time.
0 commit comments