@@ -557,7 +557,7 @@ ble_error_t Gap::connect(
557
557
#if BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
558
558
if (_connect_to_address_type != peer_address_type_t ::ANONYMOUS) {
559
559
ret = startScan (
560
- ( scan_duration_t )connectionParams. getConnectionSupervisionTimeoutArray ()[ 0 ] ,
560
+ scan_duration_t::forever () ,
561
561
duplicates_filter_t ::ENABLE,
562
562
(scan_period_t )0
563
563
);
@@ -710,6 +710,14 @@ ble_error_t Gap::rejectConnectionParametersUpdate(
710
710
#if BLE_ROLE_CENTRAL
711
711
ble_error_t Gap::cancelConnect ()
712
712
{
713
+ #if BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
714
+ if (_ready_to_connect_to_host_resolved_address) {
715
+ connecting_to_host_resolved_address_failed (false );
716
+ stopScan ();
717
+ return BLE_ERROR_NONE;
718
+ }
719
+ #endif // BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
720
+
713
721
if (!_initiating) {
714
722
return BLE_ERROR_NONE;
715
723
}
@@ -1183,9 +1191,9 @@ void Gap::on_scan_stopped(bool success)
1183
1191
}
1184
1192
1185
1193
#if BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
1186
- void Gap::connecting_to_host_resolved_address_failed ()
1194
+ void Gap::connecting_to_host_resolved_address_failed (bool inform_user )
1187
1195
{
1188
- if (_event_handler) {
1196
+ if (inform_user && _event_handler) {
1189
1197
_event_handler->onConnectionComplete (
1190
1198
ConnectionCompleteEvent (
1191
1199
BLE_ERROR_NOT_FOUND,
@@ -1219,13 +1227,6 @@ void Gap::on_scan_timeout()
1219
1227
_scan_enabled = false ;
1220
1228
_scan_pending = false ;
1221
1229
1222
- #if BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
1223
- if (_ready_to_connect_to_host_resolved_address) {
1224
- connecting_to_host_resolved_address_failed ();
1225
- return ;
1226
- }
1227
- #endif // BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
1228
-
1229
1230
if (_event_handler) {
1230
1231
_event_handler->onScanTimeout (ScanTimeoutEvent ());
1231
1232
}
@@ -1241,13 +1242,6 @@ void Gap::process_legacy_scan_timeout()
1241
1242
/* legacy scanning timed out is based on timer so we need to stop the scan manually */
1242
1243
_pal_gap.scan_enable (false , false );
1243
1244
1244
- #if BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
1245
- if (_ready_to_connect_to_host_resolved_address) {
1246
- connecting_to_host_resolved_address_failed ();
1247
- return ;
1248
- }
1249
- #endif // BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
1250
-
1251
1245
if (_event_handler) {
1252
1246
_event_handler->onScanTimeout (ScanTimeoutEvent ());
1253
1247
}
0 commit comments