Skip to content

Commit 2c90611

Browse files
missing host resolution for rpa when extended advertising is available
1 parent 0931709 commit 2c90611

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

connectivity/FEATURE_BLE/source/generic/GapImpl.cpp

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -633,21 +633,31 @@ ble_error_t Gap::connect(
633633
adjusted_address_type = peer_address_type_t::RANDOM;
634634
}
635635

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+
}
651661
}
652662

653663
if (ret == BLE_ERROR_NONE) {

0 commit comments

Comments
 (0)