Skip to content

Commit 82f17e7

Browse files
committed
BLE: replace legacy address types (BLEProtocol) with new ones
1 parent 11c3e13 commit 82f17e7

File tree

10 files changed

+87
-91
lines changed

10 files changed

+87
-91
lines changed

features/FEATURE_BLE/ble/gap/AdvertisingParameters.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <algorithm>
2121

2222
#include "BLETypes.h"
23-
#include "BLEProtocol.h"
2423
#include "blecommon.h"
2524
#include "SafeEnum.h"
2625

features/FEATURE_BLE/ble/gap/Gap.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,8 +1347,7 @@ class Gap : public StaticInterface<Impl, Gap> {
13471347
* @return BLE_ERROR_NONE if the implementation's whitelist was successfully
13481348
* populated with the addresses in the given whitelist.
13491349
*
1350-
* @note The whitelist must not contain addresses of type @ref
1351-
* BLEProtocol::AddressType::RANDOM_PRIVATE_NON_RESOLVABLE. This
1350+
* @note The whitelist must not contain non-resolvable addresses. This
13521351
* results in a @ref BLE_ERROR_INVALID_PARAM because the remote peer might
13531352
* change its private address at any time, and it is not possible to resolve
13541353
* it.
@@ -1372,8 +1371,8 @@ class Gap : public StaticInterface<Impl, Gap> {
13721371
* @return BLE_ERROR_NONE on success.
13731372
*/
13741373
ble_error_t getAddress(
1375-
BLEProtocol::AddressType_t *typeP,
1376-
BLEProtocol::AddressBytes_t address
1374+
own_address_type_t &typeP,
1375+
address_t &address
13771376
);
13781377

13791378
/**
@@ -1388,7 +1387,7 @@ class Gap : public StaticInterface<Impl, Gap> {
13881387
* the address in input was not identifiable as a random address.
13891388
*/
13901389
static ble_error_t getRandomAddressType(
1391-
const BLEProtocol::AddressBytes_t address,
1390+
const ble::address_t address,
13921391
ble::random_address_type_t *addressType
13931392
);
13941393

@@ -1604,8 +1603,8 @@ class Gap : public StaticInterface<Impl, Gap> {
16041603
ble_error_t setWhitelist_(const whitelist_t &whitelist);
16051604

16061605
ble_error_t getAddress_(
1607-
BLEProtocol::AddressType_t *typeP,
1608-
BLEProtocol::AddressBytes_t address
1606+
own_address_type_t &typeP,
1607+
address_t &address
16091608
);
16101609

16111610
/* Note: Implementation must call the base class reset_ */

features/FEATURE_BLE/ble/generic/GenericGap.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
#include <algorithm>
2121

22-
#include "ble/BLEProtocol.h"
2322
#include "ble/Gap.h"
2423
#include "ble/pal/PalGap.h"
2524
#include "ble/pal/GapEvents.h"
@@ -75,7 +74,6 @@ class GenericGap :
7574
using Gap::default_peripheral_privacy_configuration;
7675
using Gap::default_central_privacy_configuration;
7776

78-
typedef typename BLEProtocol::AddressBytes_t Address_t;
7977
typedef typename ble::whitelist_t whitelist_t;
8078
typedef typename Gap::ConnectionParams_t ConnectionParams_t;
8179

@@ -291,8 +289,8 @@ class GenericGap :
291289
* @see Gap::getAddress
292290
*/
293291
ble_error_t getAddress_(
294-
BLEProtocol::AddressType_t *type,
295-
BLEProtocol::AddressBytes_t address
292+
own_address_type_t &type,
293+
address_t &address
296294
);
297295

298296
/**
@@ -405,12 +403,12 @@ class GenericGap :
405403
);
406404

407405
ble_error_t getAddress(
408-
BLEProtocol::AddressType_t *typeP,
409-
BLEProtocol::AddressBytes_t address
406+
own_address_type_t &typeP,
407+
address_t &address
410408
);
411409

412410
static ble_error_t getRandomAddressType(
413-
const BLEProtocol::AddressBytes_t address,
411+
const ble::address_t address,
414412
ble::random_address_type_t *addressType
415413
);
416414

@@ -580,7 +578,7 @@ class GenericGap :
580578
PalGap &_pal_gap;
581579
pal::GenericAccessService &_gap_service;
582580
PalSecurityManager &_pal_sm;
583-
BLEProtocol::AddressType_t _address_type;
581+
ble::own_address_type_t _address_type;
584582
ble::address_t _address;
585583
pal::initiator_policy_t _initiator_policy_mode;
586584
pal::scanning_filter_policy_t _scanning_filter_policy;

features/FEATURE_BLE/ble/generic/GenericSecurityManager.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,9 +433,9 @@ class GenericSecurityManager :
433433
connection_handle_t connection,
434434
connection_role_t role,
435435
peer_address_type_t peer_address_type,
436-
const BLEProtocol::AddressBytes_t peer_address,
437-
BLEProtocol::AddressType_t local_address_type,
438-
const BLEProtocol::AddressBytes_t local_address,
436+
address_t peer_address,
437+
own_address_type_t local_address_type,
438+
address_t local_address,
439439
const ::Gap::ConnectionParams_t *connection_params
440440
);
441441

features/FEATURE_BLE/ble/generic/SecurityDb.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -597,16 +597,12 @@ class SecurityDb {
597597
continue;
598598
}
599599

600-
memcpy(
601-
whitelist->addresses[whitelist->size].address,
602-
identity->identity_address.data(),
603-
sizeof(BLEProtocol::AddressBytes_t)
604-
);
600+
whitelist->addresses[whitelist->size].address = identity->identity_address;
605601

606602
if (identity->identity_address_is_public) {
607-
whitelist->addresses[whitelist->size].type = BLEProtocol::AddressType::PUBLIC;
603+
whitelist->addresses[whitelist->size].type = peer_address_type_t::PUBLIC_IDENTITY;
608604
} else {
609-
whitelist->addresses[whitelist->size].type = BLEProtocol::AddressType::RANDOM_STATIC;
605+
whitelist->addresses[whitelist->size].type = peer_address_type_t::RANDOM_STATIC_IDENTITY;
610606
}
611607

612608
whitelist->size++;

features/FEATURE_BLE/ble/pal/ConnectionEventMonitor.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#ifndef MBED_BLE_CONNECTION_EVENT_MONITOR
1818
#define MBED_BLE_CONNECTION_EVENT_MONITOR
1919

20-
#include "ble/BLEProtocol.h"
2120
#include "ble/Gap.h"
2221
#include "ble/BLETypes.h"
2322

@@ -53,9 +52,9 @@ class ConnectionEventMonitorEventHandler {
5352
connection_handle_t connection,
5453
connection_role_t role,
5554
ble::peer_address_type_t peer_address_type,
56-
const BLEProtocol::AddressBytes_t peer_address,
57-
BLEProtocol::AddressType_t local_address_type,
58-
const BLEProtocol::AddressBytes_t local_address,
55+
address_t peer_address,
56+
own_address_type_t local_address_type,
57+
const address_t local_address,
5958
const ::Gap::ConnectionParams_t *connection_params
6059
) {
6160
self()->on_connected_(

features/FEATURE_BLE/ble/pal/PalSecurityManager.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "platform/Callback.h"
2222
#include "platform/NonCopyable.h"
2323
#include "ble/BLETypes.h"
24-
#include "ble/BLEProtocol.h"
2524
#include "ble/SecurityManager.h"
2625
#include "ble/pal/GapTypes.h"
2726

features/FEATURE_BLE/source/gap/Gap.tpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,8 +872,8 @@ ble_error_t Gap<Impl>::getCentralPrivacyConfiguration_(
872872

873873
template<class Impl>
874874
ble_error_t Gap<Impl>::getAddress(
875-
BLEProtocol::AddressType_t *typeP,
876-
BLEProtocol::AddressBytes_t address
875+
own_address_type_t &typeP,
876+
address_t &address
877877
) {
878878
return impl()->getAddress_(typeP, address);
879879
}

0 commit comments

Comments
 (0)