@@ -501,7 +501,11 @@ ble_error_t nRF5xGap::connect(
501
501
return BLE_ERROR_INVALID_PARAM;
502
502
}
503
503
504
- return connect (peerAddr, legacy_address, connectionParams, scanParamsIn);
504
+ bool identity =
505
+ peerAddrType == peer_address_type_t ::PUBLIC_IDENTITY ||
506
+ peerAddrType == peer_address_type_t ::RANDOM_STATIC_IDENTITY;
507
+
508
+ return connect (peerAddr, legacy_address, connectionParams, scanParamsIn, identity);
505
509
}
506
510
507
511
@@ -510,6 +514,16 @@ ble_error_t nRF5xGap::connect(
510
514
LegacyAddressType_t peerAddrType,
511
515
const ConnectionParams_t *connectionParams,
512
516
const GapScanningParams *scanParamsIn
517
+ ) {
518
+ return connect (peerAddr, peerAddrType, connectionParams, scanParamsIn, false );
519
+ }
520
+
521
+ ble_error_t nRF5xGap::connect (
522
+ const Address_t peerAddr,
523
+ LegacyAddressType_t peerAddrType,
524
+ const ConnectionParams_t *connectionParams,
525
+ const GapScanningParams *scanParamsIn,
526
+ bool identity
513
527
) {
514
528
ble_gap_addr_t addr;
515
529
ble_gap_addr_t * addr_ptr = &addr;
@@ -585,23 +599,16 @@ ble_error_t nRF5xGap::connect(
585
599
586
600
scanParams.use_whitelist = (whitelistAddressesSize) ? 1 : 0 ;
587
601
588
- if ((addr.addr_type == BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE)
589
- || (addr.addr_type == BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE)) {
590
- /* If a device is using Resolvable Private Addresses Section 1.3.2.2 (Core spec v4.2 volume 6 part B),
591
- it shall also have an Identity Address that is either a Public or Random Static address type.”
592
- To establish a connection, a static address must be provided by the application to the SoftDevice.
593
- The SoftDevice resolves the address and connects to the right device if it is available. */
594
- addr.addr_id_peer = 1 ;
595
- addr.addr_type = BLE_GAP_ADDR_TYPE_PUBLIC;
596
- } else {
597
- addr.addr_id_peer = 0 ;
598
- }
599
-
600
602
if (_privacy_enabled) {
601
603
bool enable_resolution =
602
604
_central_privacy_configuration.resolution_strategy != CentralPrivacyConfiguration_t::DO_NOT_RESOLVE;
603
605
604
606
update_identities_list (enable_resolution);
607
+
608
+ if (enable_resolution && identity) {
609
+ addr.addr_id_peer = 1 ;
610
+ }
611
+
605
612
set_private_resolvable_address ();
606
613
}
607
614
0 commit comments