From daee12d62357e499fb9ea31317efea18d247312d Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Tue, 27 Nov 2018 15:29:52 +0000 Subject: [PATCH 01/16] BLE: Fix set check in GenerigGap::stopAdvertising. --- features/FEATURE_BLE/source/generic/GenericGap.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/features/FEATURE_BLE/source/generic/GenericGap.cpp b/features/FEATURE_BLE/source/generic/GenericGap.cpp index a4928a07df..70e2390239 100644 --- a/features/FEATURE_BLE/source/generic/GenericGap.cpp +++ b/features/FEATURE_BLE/source/generic/GenericGap.cpp @@ -2357,7 +2357,11 @@ ble_error_t GenericGap::stopAdvertising(advertising_handle_t handle) return BLE_ERROR_INVALID_PARAM; } - if (_existing_sets.get(handle)) { + if (!_existing_sets.get(handle)) { + return BLE_ERROR_INVALID_PARAM; + } + + if (!_active_sets.get(handle)) { return BLE_ERROR_INVALID_PARAM; } From 1a6246f1305faee949e8f489f70da80c4ede8c99 Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Tue, 27 Nov 2018 15:30:56 +0000 Subject: [PATCH 02/16] BLE: Remove double handling of DM_CONN_OPEN_IND . --- .../TARGET_CORDIO/source/CordioPalGap.cpp | 25 +------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/features/FEATURE_BLE/targets/TARGET_CORDIO/source/CordioPalGap.cpp b/features/FEATURE_BLE/targets/TARGET_CORDIO/source/CordioPalGap.cpp index 1179fa776e..7b15cfe3d9 100644 --- a/features/FEATURE_BLE/targets/TARGET_CORDIO/source/CordioPalGap.cpp +++ b/features/FEATURE_BLE/targets/TARGET_CORDIO/source/CordioPalGap.cpp @@ -510,30 +510,7 @@ void Gap::gap_handler(const wsfMsgHdr_t *msg) handler->on_periodic_advertising_sync_loss(evt->syncHandle); } break; - - case DM_CONN_OPEN_IND: { - if (!handler) { - break; - } - - // TODO: filter with old event ... - const hciLeConnCmplEvt_t *evt = (const hciLeConnCmplEvt_t *) msg; - handler->on_enhanced_connection_complete( - hci_error_code_t(evt->status), - evt->handle, - connection_role_t(evt->role), - connection_peer_address_type_t(evt->addrType), - evt->peerAddr, - evt->localRpa, - evt->peerRpa, - evt->connInterval, - evt->connLatency, - evt->supTimeout, - clock_accuracy_t(evt->clockAccuracy) - ); - } - break; - + case DM_SCAN_REQ_RCVD_IND: { if (!handler) { break; From 5302a7f599b4f096e9d7ced271b8415432cb54c9 Mon Sep 17 00:00:00 2001 From: paul-szczepanek-arm <33840200+paul-szczepanek-arm@users.noreply.github.com> Date: Tue, 27 Nov 2018 15:38:01 +0000 Subject: [PATCH 03/16] consistent errors --- features/FEATURE_BLE/source/generic/GenericGap.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/features/FEATURE_BLE/source/generic/GenericGap.cpp b/features/FEATURE_BLE/source/generic/GenericGap.cpp index 70e2390239..49d484b065 100644 --- a/features/FEATURE_BLE/source/generic/GenericGap.cpp +++ b/features/FEATURE_BLE/source/generic/GenericGap.cpp @@ -2053,7 +2053,7 @@ ble_error_t GenericGap::destroyAdvertisingSet(advertising_handle_t handle) return BLE_ERROR_INVALID_PARAM; } - if (_existing_sets.get(handle) == false) { + if (!_existing_sets.get(handle)) { return BLE_ERROR_INVALID_PARAM; } @@ -2362,7 +2362,7 @@ ble_error_t GenericGap::stopAdvertising(advertising_handle_t handle) } if (!_active_sets.get(handle)) { - return BLE_ERROR_INVALID_PARAM; + return BLE_ERROR_INVALID_STATE; } ble_error_t status; @@ -2431,7 +2431,7 @@ ble_error_t GenericGap::setPeriodicAdvertisingParameters( } if (!_existing_sets.get(handle)) { - return BLE_ERROR_INVALID_STATE; + return BLE_ERROR_INVALID_PARAM; } return _pal_gap.set_periodic_advertising_parameters( @@ -2458,7 +2458,7 @@ ble_error_t GenericGap::setPeriodicAdvertisingPayload( } if (!_existing_sets.get(handle)) { - return BLE_ERROR_INVALID_STATE; + return BLE_ERROR_INVALID_PARAM; } if (payload.size() > getMaxAdvertisingDataLength()) { @@ -2515,7 +2515,7 @@ ble_error_t GenericGap::startPeriodicAdvertising(advertising_handle_t handle) } if (!_existing_sets.get(handle)) { - return BLE_ERROR_INVALID_STATE; + return BLE_ERROR_INVALID_PARAM; } if (_active_sets.get(handle) == false) { @@ -2548,7 +2548,7 @@ ble_error_t GenericGap::stopPeriodicAdvertising(advertising_handle_t handle) } if (!_existing_sets.get(handle)) { - return BLE_ERROR_INVALID_STATE; + return BLE_ERROR_INVALID_PARAM; } if (_active_periodic_sets.get(handle) == false) { From c23911e3d8cbf63db789f53421a9f33a03a3ec15 Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Wed, 28 Nov 2018 17:15:54 +0000 Subject: [PATCH 04/16] BLE: Fix extraction of advertising element type. --- features/FEATURE_BLE/ble/gap/AdvertisingDataParser.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/FEATURE_BLE/ble/gap/AdvertisingDataParser.h b/features/FEATURE_BLE/ble/gap/AdvertisingDataParser.h index e41610b9fe..1bc947cad0 100644 --- a/features/FEATURE_BLE/ble/gap/AdvertisingDataParser.h +++ b/features/FEATURE_BLE/ble/gap/AdvertisingDataParser.h @@ -87,7 +87,7 @@ public: element_t next() { element_t element = { - (ble::adv_data_type_t::type) data[TYPE_INDEX], + (ble::adv_data_type_t::type) data[position + TYPE_INDEX], data.subspan(position + VALUE_INDEX, current_length() - (TYPE_SIZE)) }; From e7ef0b764eb8829b47f6343fa8b26379ad139522 Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Wed, 28 Nov 2018 17:25:44 +0000 Subject: [PATCH 05/16] BLE: protect event signaling flag from concurent accesses. --- features/FEATURE_BLE/source/BLE.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/features/FEATURE_BLE/source/BLE.cpp b/features/FEATURE_BLE/source/BLE.cpp index e61356c075..e9f66c3bb2 100644 --- a/features/FEATURE_BLE/source/BLE.cpp +++ b/features/FEATURE_BLE/source/BLE.cpp @@ -17,6 +17,7 @@ #include #include "ble/BLE.h" #include "ble/BLEInstanceBase.h" +#include "platform/mbed_critical.h" #if defined(TARGET_OTA_ENABLED) #include "ble/services/DFUService.h" @@ -299,16 +300,19 @@ void BLE::waitForEvent(void) void BLE::processEvents() { + core_util_critical_section_enter(); if (event_signaled == false) { + core_util_critical_section_exit(); return; } + event_signaled = false; + core_util_critical_section_exit(); + if (!transport) { MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_BLE, MBED_ERROR_CODE_BLE_BACKEND_NOT_INITIALIZED), "bad handle to underlying transport"); } - event_signaled = false; - transport->processEvents(); } @@ -328,11 +332,14 @@ void BLE::onEventsToProcess(const BLE::OnEventsToProcessCallback_t& callback) void BLE::signalEventsToProcess() { + core_util_critical_section_enter(); if (event_signaled == true) { + core_util_critical_section_exit(); return; } event_signaled = true; + core_util_critical_section_exit(); if (whenEventsToProcess) { OnEventsToProcessCallbackContext params = { From 78468fb6e30699ea17f124b25ed5bda25d7ae9f6 Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Thu, 29 Nov 2018 12:18:11 +0000 Subject: [PATCH 06/16] 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; From 402a4479d227f77bc14bba405d73f7edecf629fd Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Thu, 29 Nov 2018 12:22:34 +0000 Subject: [PATCH 07/16] BLE: Ensure scan process is stopped before connecting. --- features/FEATURE_BLE/source/generic/GenericGap.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/features/FEATURE_BLE/source/generic/GenericGap.cpp b/features/FEATURE_BLE/source/generic/GenericGap.cpp index 49d484b065..9b6adc81ca 100644 --- a/features/FEATURE_BLE/source/generic/GenericGap.cpp +++ b/features/FEATURE_BLE/source/generic/GenericGap.cpp @@ -675,6 +675,9 @@ ble_error_t GenericGap::connect( return BLE_ERROR_INVALID_PARAM; } + // ensure scan is stopped. + _pal_gap.scan_enable(false, false); + return _pal_gap.create_connection( connectionParams.getScanIntervalArray()[0], connectionParams.getScanWindowArray()[0], @@ -691,6 +694,9 @@ ble_error_t GenericGap::connect( ); } + // ensure scan is stopped. + _pal_gap.extended_scan_enable(false, pal::duplicates_filter_t::DISABLE, 0, 0); + // reduce the address type to public or random peer_address_type_t adjusted_address_type(peer_address_type_t::PUBLIC); From 3ddcdf24a3706baec1446c8fa8d7d203eaa5cbd2 Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Thu, 29 Nov 2018 12:26:40 +0000 Subject: [PATCH 08/16] BLE: Fix ble::Gap::getMaxAdvertisingDataLength return type. --- features/FEATURE_BLE/ble/gap/Gap.h | 2 +- features/FEATURE_BLE/ble/generic/GenericGap.h | 2 +- features/FEATURE_BLE/source/gap/Gap.cpp | 2 +- features/FEATURE_BLE/source/generic/GenericGap.cpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/features/FEATURE_BLE/ble/gap/Gap.h b/features/FEATURE_BLE/ble/gap/Gap.h index ecf281fc1b..08842e05ae 100644 --- a/features/FEATURE_BLE/ble/gap/Gap.h +++ b/features/FEATURE_BLE/ble/gap/Gap.h @@ -536,7 +536,7 @@ public: * * @return Maximum advertising data length supported. */ - virtual uint8_t getMaxAdvertisingDataLength(); + virtual uint16_t getMaxAdvertisingDataLength(); /** Create an advertising set and apply the passed in parameters. The handle returned * by this function must be used for all other calls that accept an advertising handle. diff --git a/features/FEATURE_BLE/ble/generic/GenericGap.h b/features/FEATURE_BLE/ble/generic/GenericGap.h index d3a02ffdd9..300ca5d9c6 100644 --- a/features/FEATURE_BLE/ble/generic/GenericGap.h +++ b/features/FEATURE_BLE/ble/generic/GenericGap.h @@ -90,7 +90,7 @@ public: /** @copydoc Gap::getMaxAdvertisingDataLength */ - virtual uint8_t getMaxAdvertisingDataLength(); + virtual uint16_t getMaxAdvertisingDataLength(); /** @copydoc Gap::createAdvertisingSet */ diff --git a/features/FEATURE_BLE/source/gap/Gap.cpp b/features/FEATURE_BLE/source/gap/Gap.cpp index 4cb4c6a50e..7a048034fb 100644 --- a/features/FEATURE_BLE/source/gap/Gap.cpp +++ b/features/FEATURE_BLE/source/gap/Gap.cpp @@ -30,7 +30,7 @@ uint8_t Gap::getMaxAdvertisingSetNumber() return 1; } -uint8_t Gap::getMaxAdvertisingDataLength() +uint16_t Gap::getMaxAdvertisingDataLength() { /* Requesting action from porter(s): override this API if this capability is supported. */ return LEGACY_ADVERTISING_MAX_SIZE; diff --git a/features/FEATURE_BLE/source/generic/GenericGap.cpp b/features/FEATURE_BLE/source/generic/GenericGap.cpp index 9b6adc81ca..69824b691b 100644 --- a/features/FEATURE_BLE/source/generic/GenericGap.cpp +++ b/features/FEATURE_BLE/source/generic/GenericGap.cpp @@ -696,7 +696,7 @@ ble_error_t GenericGap::connect( // ensure scan is stopped. _pal_gap.extended_scan_enable(false, pal::duplicates_filter_t::DISABLE, 0, 0); - + // reduce the address type to public or random peer_address_type_t adjusted_address_type(peer_address_type_t::PUBLIC); @@ -2003,7 +2003,7 @@ uint8_t GenericGap::getMaxAdvertisingSetNumber() } } -uint8_t GenericGap::getMaxAdvertisingDataLength() +uint16_t GenericGap::getMaxAdvertisingDataLength() { useVersionTwoAPI(); return _pal_gap.get_maximum_advertising_data_length(); From 4ed3f5620f8389ae02acbcc25f9fd6e98adef449 Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Thu, 29 Nov 2018 12:28:38 +0000 Subject: [PATCH 09/16] BLE: Fix name of DisconnectionEvent into DisconnectionCompleteEvent for consistency. --- features/FEATURE_BLE/ble/gap/Events.h | 4 ++-- features/FEATURE_BLE/ble/gap/Gap.h | 2 +- features/FEATURE_BLE/source/generic/GenericGap.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/features/FEATURE_BLE/ble/gap/Events.h b/features/FEATURE_BLE/ble/gap/Events.h index 3c09137517..d2987e123f 100644 --- a/features/FEATURE_BLE/ble/gap/Events.h +++ b/features/FEATURE_BLE/ble/gap/Events.h @@ -630,10 +630,10 @@ private: * * @see ble::Gap::EventHandler::onDisconnectionComplete(). */ -struct DisconnectionEvent { +struct DisconnectionCompleteEvent { #if !defined(DOXYGEN_ONLY) - DisconnectionEvent( + DisconnectionCompleteEvent( connection_handle_t connectionHandle, const disconnection_reason_t &reason ) : diff --git a/features/FEATURE_BLE/ble/gap/Gap.h b/features/FEATURE_BLE/ble/gap/Gap.h index 08842e05ae..4494dc50b4 100644 --- a/features/FEATURE_BLE/ble/gap/Gap.h +++ b/features/FEATURE_BLE/ble/gap/Gap.h @@ -427,7 +427,7 @@ public: * * @see disconnect() */ - virtual void onDisconnectionComplete(const DisconnectionEvent &event) + virtual void onDisconnectionComplete(const DisconnectionCompleteEvent &event) { } diff --git a/features/FEATURE_BLE/source/generic/GenericGap.cpp b/features/FEATURE_BLE/source/generic/GenericGap.cpp index 69824b691b..95a32e394b 100644 --- a/features/FEATURE_BLE/source/generic/GenericGap.cpp +++ b/features/FEATURE_BLE/source/generic/GenericGap.cpp @@ -1448,7 +1448,7 @@ void GenericGap::processDisconnectionEvent( if (_eventHandler) { _eventHandler->onDisconnectionComplete( - DisconnectionEvent( + DisconnectionCompleteEvent( handle, (disconnection_reason_t::type) reason ) From e8972a72a411e45762f1f7be1978d38236bfde77 Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Thu, 29 Nov 2018 12:32:36 +0000 Subject: [PATCH 10/16] BLE: provide better default connection parameters. --- features/FEATURE_BLE/ble/gap/ConnectionParameters.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/features/FEATURE_BLE/ble/gap/ConnectionParameters.h b/features/FEATURE_BLE/ble/gap/ConnectionParameters.h index d93052a48f..62dc30cdf7 100644 --- a/features/FEATURE_BLE/ble/gap/ConnectionParameters.h +++ b/features/FEATURE_BLE/ble/gap/ConnectionParameters.h @@ -145,10 +145,10 @@ public: phy_t phy = phy_t::LE_1M, scan_interval_t scanInterval = scan_interval_t::min(), scan_window_t scanWindow = scan_window_t::min(), - conn_interval_t minConnectionInterval = conn_interval_t::min(), - conn_interval_t maxConnectionInterval = conn_interval_t::max(), + conn_interval_t minConnectionInterval = conn_interval_t(50), + conn_interval_t maxConnectionInterval = conn_interval_t(100), slave_latency_t slaveLatency = slave_latency_t::min(), - supervision_timeout_t connectionSupervisionTimeout = supervision_timeout_t::max(), + supervision_timeout_t connectionSupervisionTimeout = supervision_timeout_t(100), conn_event_length_t minEventLength = conn_event_length_t::min(), conn_event_length_t maxEventLength = conn_event_length_t::max() ); From e026bce881990a7705b4301ca982056db4b01494 Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Mon, 3 Dec 2018 16:50:10 +0000 Subject: [PATCH 11/16] BLE: Change parameter order of ble::Gap::startScan --- features/FEATURE_BLE/ble/gap/Gap.h | 2 +- features/FEATURE_BLE/ble/generic/GenericGap.h | 2 +- features/FEATURE_BLE/source/gap/Gap.cpp | 2 +- features/FEATURE_BLE/source/generic/GenericGap.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/features/FEATURE_BLE/ble/gap/Gap.h b/features/FEATURE_BLE/ble/gap/Gap.h index 4494dc50b4..ef0af66caf 100644 --- a/features/FEATURE_BLE/ble/gap/Gap.h +++ b/features/FEATURE_BLE/ble/gap/Gap.h @@ -726,8 +726,8 @@ public: * @see EventHandler::onScanTimeout when scanning timeout. */ virtual ble_error_t startScan( - duplicates_filter_t filtering = duplicates_filter_t::DISABLE, scan_duration_t duration = scan_duration_t::forever(), + duplicates_filter_t filtering = duplicates_filter_t::DISABLE, scan_period_t period = scan_period_t(0) ); diff --git a/features/FEATURE_BLE/ble/generic/GenericGap.h b/features/FEATURE_BLE/ble/generic/GenericGap.h index 300ca5d9c6..8b3fd4af13 100644 --- a/features/FEATURE_BLE/ble/generic/GenericGap.h +++ b/features/FEATURE_BLE/ble/generic/GenericGap.h @@ -175,8 +175,8 @@ public: /** @copydoc Gap::startScan */ virtual ble_error_t startScan( - duplicates_filter_t filtering, scan_duration_t duration, + duplicates_filter_t filtering, scan_period_t period ); diff --git a/features/FEATURE_BLE/source/gap/Gap.cpp b/features/FEATURE_BLE/source/gap/Gap.cpp index 7a048034fb..3515ddd531 100644 --- a/features/FEATURE_BLE/source/gap/Gap.cpp +++ b/features/FEATURE_BLE/source/gap/Gap.cpp @@ -145,8 +145,8 @@ ble_error_t Gap::setScanParameters(const ScanParameters ¶ms) }; ble_error_t Gap::startScan( - duplicates_filter_t filtering, scan_duration_t duration, + duplicates_filter_t filtering, scan_period_t period ) { diff --git a/features/FEATURE_BLE/source/generic/GenericGap.cpp b/features/FEATURE_BLE/source/generic/GenericGap.cpp index 95a32e394b..6998191d32 100644 --- a/features/FEATURE_BLE/source/generic/GenericGap.cpp +++ b/features/FEATURE_BLE/source/generic/GenericGap.cpp @@ -2869,8 +2869,8 @@ ble_error_t GenericGap::setScanParameters(const ScanParameters ¶ms) } ble_error_t GenericGap::startScan( - duplicates_filter_t filtering, scan_duration_t duration, + duplicates_filter_t filtering, scan_period_t period ) { From dc3ff6a5e039edf39b5bc21229132b03447a23bc Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Mon, 3 Dec 2018 16:56:20 +0000 Subject: [PATCH 12/16] BLE: Rename ConnectionParameters::setFilterPolicy into setFilter for consistency. --- features/FEATURE_BLE/ble/gap/ConnectionParameters.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/FEATURE_BLE/ble/gap/ConnectionParameters.h b/features/FEATURE_BLE/ble/gap/ConnectionParameters.h index 62dc30cdf7..713288fbc0 100644 --- a/features/FEATURE_BLE/ble/gap/ConnectionParameters.h +++ b/features/FEATURE_BLE/ble/gap/ConnectionParameters.h @@ -215,7 +215,7 @@ public: * * @return A reference to this. */ - ConnectionParameters &setFilterPolicy(initiator_filter_policy_t filterPolicy) + ConnectionParameters &setFilter(initiator_filter_policy_t filterPolicy) { _filterPolicy = filterPolicy; From 5abf2f08fa1fcac96a8c169c92c8808552e2f4e5 Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Mon, 3 Dec 2018 17:04:38 +0000 Subject: [PATCH 13/16] BLE: Reintroduce refactored type identifier in privacy configuration structures. --- features/FEATURE_BLE/ble/gap/Types.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/features/FEATURE_BLE/ble/gap/Types.h b/features/FEATURE_BLE/ble/gap/Types.h index 59f07ba91b..1eab24978a 100644 --- a/features/FEATURE_BLE/ble/gap/Types.h +++ b/features/FEATURE_BLE/ble/gap/Types.h @@ -891,6 +891,9 @@ struct peripheral_privacy_configuration_t { PERFORM_AUTHENTICATION_PROCEDURE }; + MBED_DEPRECATED_SINCE("mbed-os-5.11", "Use resolution_strategy_t instead.") + typedef resolution_strategy_t ResolutionStrategy; + /** * Connection strategy to use when a connection request contains a * private resolvable address. @@ -941,6 +944,9 @@ struct central_privay_configuration_t { RESOLVE_AND_FILTER }; + MBED_DEPRECATED_SINCE("mbed-os-5.11", "Use resolution_strategy_t instead.") + typedef resolution_strategy_t ResolutionStrategy; + /** * Resolution strategy applied to advertising packets received by the * local device. From ed426c5b4544d77a95d536b75af1a87bc64bc7a5 Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Mon, 3 Dec 2018 17:11:28 +0000 Subject: [PATCH 14/16] BLE: rename ConnectionParameters::getFilterPolicy into getFilter for consistency. --- features/FEATURE_BLE/ble/gap/ConnectionParameters.h | 2 +- features/FEATURE_BLE/source/generic/GenericGap.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/features/FEATURE_BLE/ble/gap/ConnectionParameters.h b/features/FEATURE_BLE/ble/gap/ConnectionParameters.h index 713288fbc0..33aeaf5c46 100644 --- a/features/FEATURE_BLE/ble/gap/ConnectionParameters.h +++ b/features/FEATURE_BLE/ble/gap/ConnectionParameters.h @@ -282,7 +282,7 @@ public: * * @return The initiator policy. */ - initiator_filter_policy_t getFilterPolicy() const + initiator_filter_policy_t getFilter() const { return _filterPolicy; } diff --git a/features/FEATURE_BLE/source/generic/GenericGap.cpp b/features/FEATURE_BLE/source/generic/GenericGap.cpp index 6998191d32..9191b55fbe 100644 --- a/features/FEATURE_BLE/source/generic/GenericGap.cpp +++ b/features/FEATURE_BLE/source/generic/GenericGap.cpp @@ -681,7 +681,7 @@ ble_error_t GenericGap::connect( return _pal_gap.create_connection( connectionParams.getScanIntervalArray()[0], connectionParams.getScanWindowArray()[0], - connectionParams.getFilterPolicy(), + connectionParams.getFilter(), (pal::connection_peer_address_type_t::type) peerAddressType.value(), peerAddress, connectionParams.getOwnAddressType(), @@ -707,7 +707,7 @@ ble_error_t GenericGap::connect( } return _pal_gap.extended_create_connection( - connectionParams.getFilterPolicy(), + connectionParams.getFilter(), connectionParams.getOwnAddressType(), adjusted_address_type, peerAddress, From d1b0642ad2158fba45040b8d403e4b2382a5638a Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Mon, 3 Dec 2018 17:56:54 +0000 Subject: [PATCH 15/16] BLE: rename AdvertisingReportEvent::getAdvertisingData into getPayload. This change makes it consistent with PeriodicAdvertisingReportEvent. --- features/FEATURE_BLE/ble/gap/Events.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/FEATURE_BLE/ble/gap/Events.h b/features/FEATURE_BLE/ble/gap/Events.h index d2987e123f..38c910a34c 100644 --- a/features/FEATURE_BLE/ble/gap/Events.h +++ b/features/FEATURE_BLE/ble/gap/Events.h @@ -152,7 +152,7 @@ struct AdvertisingReportEvent { } /** Get payload. */ - const mbed::Span &getAdvertisingData() const + const mbed::Span &getPayload() const { return advertisingData; } From 472c57205bf5968346c3b0aba605315dd900c63f Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Mon, 3 Dec 2018 18:03:30 +0000 Subject: [PATCH 16/16] BLE: Fix doxygen parameter declaration order. --- features/FEATURE_BLE/ble/gap/Gap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/FEATURE_BLE/ble/gap/Gap.h b/features/FEATURE_BLE/ble/gap/Gap.h index ef0af66caf..194369c623 100644 --- a/features/FEATURE_BLE/ble/gap/Gap.h +++ b/features/FEATURE_BLE/ble/gap/Gap.h @@ -711,8 +711,8 @@ public: /** Start scanning. * - * @param filtering Filtering policy. * @param duration How long to scan for. Special value 0 means scan forever. + * @param filtering Filtering policy. * @param period How long to scan for in single period. If the period is 0 and duration * is nonzero the scan will last for single duration. *