mirror of https://github.com/ARMmbed/mbed-os.git
upgrade implementationof gap::connect in case of private address and whitelisting for SD API 3 and further
parent
3a969c6748
commit
69919a45e5
|
@ -334,7 +334,7 @@ ble_error_t nRF5xGap::connect(const Address_t peerAddr,
|
||||||
connParams.conn_sup_timeout = 600;
|
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)
|
#if (NRF_SD_BLE_API_VERSION <= 2)
|
||||||
/* Allocate the stack's whitelist statically */
|
/* Allocate the stack's whitelist statically */
|
||||||
|
@ -363,6 +363,20 @@ ble_error_t nRF5xGap::connect(const Address_t peerAddr,
|
||||||
if (err != BLE_ERROR_NONE) {
|
if (err != BLE_ERROR_NONE) {
|
||||||
return (ble_error_t)err;
|
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
|
#endif
|
||||||
|
|
||||||
if (scanParamsIn != NULL) {
|
if (scanParamsIn != NULL) {
|
||||||
|
|
|
@ -42,6 +42,9 @@
|
||||||
#include "nrf_drv_common.h"
|
#include "nrf_drv_common.h"
|
||||||
#include "lp_ticker_api.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").
|
// Common stuff used also by lp_ticker and rtc_api (see "common_rtc.h").
|
||||||
|
|
Loading…
Reference in New Issue