upgrade implementationof gap::connect in case of private address and whitelisting for SD API 3 and further

pull/3841/head
Andrzej Puzdrowski 2017-02-01 09:40:44 +01:00
parent 9d8c05bbe8
commit 4e188af065
2 changed files with 18 additions and 1 deletions

View File

@ -334,7 +334,7 @@ ble_error_t nRF5xGap::connect(const Address_t peerAddr,
connParams.conn_sup_timeout = 600;
}
ble_gap_scan_params_t scanParams;
ble_gap_scan_params_t scanParams ={0};
#if (NRF_SD_BLE_API_VERSION <= 2)
/* Allocate the stack's whitelist statically */
@ -363,6 +363,20 @@ ble_error_t nRF5xGap::connect(const Address_t peerAddr,
if (err != BLE_ERROR_NONE) {
return (ble_error_t)err;
}
scanParams.use_whitelist = (whitelistAddressesSize) ? 1 : 0;
if (addr.addr_type == ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE || addr.addr_type == ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE) {
/* If a device is using Resolvable Private Addresses Section 1.3.2.2 (Core spec v4.2 volume 6 part B),
it shall also have an Identity Address that is either a Public or Random Static address type.
For connecting a static address must be provided by the application to the softdevice.
The softdevice will resolve the address and connect to the right device if present. */
addr.addr_id_peer = 1;
addr.addr_type = BLE_GAP_ADDR_TYPE_PUBLIC;
} else {
addr.addr_id_peer = 0;
}
#endif
if (scanParamsIn != NULL) {

View File

@ -42,6 +42,9 @@
#include "nrf_drv_common.h"
#include "lp_ticker_api.h"
#if defined(NRF52_ERRATA_20)
#include "softdevice_handler.h"
#endif
//------------------------------------------------------------------------------
// Common stuff used also by lp_ticker and rtc_api (see "common_rtc.h").