@@ -633,21 +633,31 @@ ble_error_t Gap::connect(
633
633
adjusted_address_type = peer_address_type_t ::RANDOM;
634
634
}
635
635
636
- ret = _pal_gap.extended_create_connection (
637
- connectionParams.getFilter (),
638
- connectionParams.getOwnAddressType (),
639
- adjusted_address_type,
640
- peerAddress,
641
- connectionParams.getPhySet (),
642
- connectionParams.getScanIntervalArray (),
643
- connectionParams.getScanWindowArray (),
644
- connectionParams.getMinConnectionIntervalArray (),
645
- connectionParams.getMaxConnectionIntervalArray (),
646
- connectionParams.getSlaveLatencyArray (),
647
- connectionParams.getConnectionSupervisionTimeoutArray (),
648
- connectionParams.getMinEventLengthArray (),
649
- connectionParams.getMaxEventLengthArray ()
650
- );
636
+ #if BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
637
+ if (_connect_to_host_resolved_address_state == ConnectionToHostResolvedAddressState::scan) {
638
+ ret = startScan (scan_duration_t::forever (), duplicates_filter_t ::ENABLE, scan_period_t (0 ));
639
+ if (ret != BLE_ERROR_NONE) {
640
+ _connect_to_host_resolved_address_state = ConnectionToHostResolvedAddressState::idle;
641
+ }
642
+ } else
643
+ #endif // BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
644
+ {
645
+ ret = _pal_gap.extended_create_connection (
646
+ connectionParams.getFilter (),
647
+ connectionParams.getOwnAddressType (),
648
+ adjusted_address_type,
649
+ peerAddress,
650
+ connectionParams.getPhySet (),
651
+ connectionParams.getScanIntervalArray (),
652
+ connectionParams.getScanWindowArray (),
653
+ connectionParams.getMinConnectionIntervalArray (),
654
+ connectionParams.getMaxConnectionIntervalArray (),
655
+ connectionParams.getSlaveLatencyArray (),
656
+ connectionParams.getConnectionSupervisionTimeoutArray (),
657
+ connectionParams.getMinEventLengthArray (),
658
+ connectionParams.getMaxEventLengthArray ()
659
+ );
660
+ }
651
661
}
652
662
653
663
if (ret == BLE_ERROR_NONE) {
0 commit comments