From 7f05fc0e005e41ffeeac577f9baf9167b8dc2c9c Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Thu, 17 May 2018 10:30:24 +0100 Subject: [PATCH] BLE: Define peer_address_type_t This type model a peer address, unlike BLEProtocol::AddressType, it is compatible with privacy concepts. --- features/FEATURE_BLE/ble/BLETypes.h | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/features/FEATURE_BLE/ble/BLETypes.h b/features/FEATURE_BLE/ble/BLETypes.h index d595299350..5a5b13fb22 100644 --- a/features/FEATURE_BLE/ble/BLETypes.h +++ b/features/FEATURE_BLE/ble/BLETypes.h @@ -529,6 +529,43 @@ struct att_security_requirement_t : SafeEnum(value) { } }; +/** + * Type that describes a peer device address type. + */ +struct peer_address_type_t :SafeEnum { + /** struct scoped enum wrapped by the class */ + enum type { + /** + * Public device address. + */ + PUBLIC = 0, + + /** + * Random address. + * + * Use Gap::getRandomAddressType to retrieve the type of the random + * address. + */ + RANDOM, + + /** + * A Public address used as a device identity address. + */ + PUBLIC_IDENTITY, + + /** + * A Random static address used as a device identity address. + */ + RANDOM_STATIC_IDENTITY + }; + + /** + * Construct a new instance of peer_address_type_t. + */ + peer_address_type_t(type value) : + SafeEnum(value) { } +}; + } // namespace ble /**