From 78468fb6e30699ea17f124b25ed5bda25d7ae9f6 Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Thu, 29 Nov 2018 12:18:11 +0000 Subject: [PATCH] BLE: Use RANDOM address per default for Advertising, Scan and Connection parameter. Unlike the public address, the RANDOM address is guaranteed to exist. If privacy is enabled, it means the controller will generates random resolvable addresses or non resolvable addresses depending on the config. If privacy is not enabled then the device will use the device's random static address that doesn't change between radio processes. --- features/FEATURE_BLE/ble/gap/AdvertisingParameters.h | 2 +- features/FEATURE_BLE/ble/gap/ScanParameters.h | 2 +- features/FEATURE_BLE/source/gap/ConnectionParameters.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/features/FEATURE_BLE/ble/gap/AdvertisingParameters.h b/features/FEATURE_BLE/ble/gap/AdvertisingParameters.h index 18e9c83f37..304abddaad 100644 --- a/features/FEATURE_BLE/ble/gap/AdvertisingParameters.h +++ b/features/FEATURE_BLE/ble/gap/AdvertisingParameters.h @@ -135,7 +135,7 @@ public: _minInterval(minInterval), _maxInterval(maxInterval), _peerAddressType(target_peer_address_type_t::PUBLIC), - _ownAddressType(own_address_type_t::PUBLIC), + _ownAddressType(own_address_type_t::RANDOM), _policy(advertising_filter_policy_t::NO_FILTER), _primaryPhy(phy_t::LE_1M), _secondaryPhy(phy_t::LE_1M), diff --git a/features/FEATURE_BLE/ble/gap/ScanParameters.h b/features/FEATURE_BLE/ble/gap/ScanParameters.h index 494cc818f6..9eb9c610bc 100644 --- a/features/FEATURE_BLE/ble/gap/ScanParameters.h +++ b/features/FEATURE_BLE/ble/gap/ScanParameters.h @@ -121,7 +121,7 @@ public: scan_window_t scan_interval = scan_interval_t::min(), scan_interval_t scan_window = scan_window_t::min(), bool active_scanning = false, - own_address_type_t own_address_type = own_address_type_t::PUBLIC, + own_address_type_t own_address_type = own_address_type_t::RANDOM, scanning_filter_policy_t scanning_filter_policy = scanning_filter_policy_t::NO_FILTER ) : own_address_type(own_address_type), diff --git a/features/FEATURE_BLE/source/gap/ConnectionParameters.cpp b/features/FEATURE_BLE/source/gap/ConnectionParameters.cpp index 3ed5b646ef..837a706f85 100644 --- a/features/FEATURE_BLE/source/gap/ConnectionParameters.cpp +++ b/features/FEATURE_BLE/source/gap/ConnectionParameters.cpp @@ -30,7 +30,7 @@ ConnectionParameters::ConnectionParameters( conn_event_length_t maxEventLength ) : _filterPolicy(initiator_filter_policy_t::NO_FILTER), - _ownAddressType(own_address_type_t::PUBLIC) + _ownAddressType(own_address_type_t::RANDOM) { for (uint8_t i = 0; i < MAX_PARAM_PHYS; ++i) { _enabledPhy[i] = false;