aboutsummaryrefslogtreecommitdiffstats
path: root/api/direct_bt/BTAddress.hpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-02-08 15:56:02 +0100
committerSven Gothel <[email protected]>2021-02-08 15:56:02 +0100
commitf6cb06866df4b43538ff1bf001fa65ca5f204cc7 (patch)
tree3ee9e8600338815d8ffd9043a2173abca0fe6b65 /api/direct_bt/BTAddress.hpp
parent9dfcad8e80c80fcd8849ad2d399315848f208880 (diff)
C++: Promote L2CAP_PSM, L2CAP_CID, .. to 'enum class'; Minor constexpr enhancements
'enum' -> 'enum class' w/ all bells and whistles: L2CAP_PSM, L2CAP_CID, AD_Type_Const BTAddress.hpp: Add 'constexpr uint8_t number(..)' constexpr: - equality- and bit-operations on different types: EIRDataType, ManufactureSpecificData - isEIRDataTypeSet(), setEIRDataTypeSet(), setAdapterSettingMaskBit() HCIACLData Cleanup - Use L2CAP_PSM and L2CAP_CID types - Convenient queries if SMP or GATT type - Add toString(..) w/ l2cap_data ptr L2CAPComm: Use L2CAP_PSM and L2CAP_CID types
Diffstat (limited to 'api/direct_bt/BTAddress.hpp')
-rw-r--r--api/direct_bt/BTAddress.hpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/api/direct_bt/BTAddress.hpp b/api/direct_bt/BTAddress.hpp
index c269099d..b2ca0eed 100644
--- a/api/direct_bt/BTAddress.hpp
+++ b/api/direct_bt/BTAddress.hpp
@@ -98,6 +98,7 @@ namespace direct_bt {
/** Undefined, e.g. address not of type {@link BDAddressType::BDADDR_LE_RANDOM} */
UNDEFINED = 0xff
};
+ constexpr uint8_t number(const BLERandomAddressType rhs) noexcept { return static_cast<uint8_t>(rhs); }
std::string getBLERandomAddressTypeString(const BLERandomAddressType type) noexcept;
/**
@@ -127,7 +128,7 @@ namespace direct_bt {
RANDOM_STATIC_IDENTITY = 0x03,
UNDEFINED = 0xff /**< HCIADDR_UNDEFINED */
};
-
+ constexpr uint8_t number(const HCILEPeerAddressType rhs) noexcept { return static_cast<uint8_t>(rhs); }
BDAddressType getBDAddressType(const HCILEPeerAddressType hciPeerAddrType) noexcept;
std::string getHCILEPeerAddressTypeString(const HCILEPeerAddressType type) noexcept;
@@ -142,7 +143,7 @@ namespace direct_bt {
RESOLVABLE_OR_RANDOM = 0x03,
UNDEFINED = 0xff
};
-
+ constexpr uint8_t number(const HCILEOwnAddressType rhs) noexcept { return static_cast<uint8_t>(rhs); }
BDAddressType getBDAddressType(const HCILEOwnAddressType hciOwnAddrType) noexcept;
std::string getHCILEOwnAddressTypeString(const HCILEOwnAddressType type) noexcept;