diff options
-rw-r--r-- | api/direct_bt/BTTypes.hpp | 10 | ||||
-rw-r--r-- | api/direct_bt/GATTHandler.hpp | 2 | ||||
-rw-r--r-- | api/direct_bt/HCIHandler.hpp | 10 | ||||
-rw-r--r-- | api/direct_bt/HCITypes.hpp | 20 | ||||
-rw-r--r-- | api/direct_bt/L2CAPComm.hpp | 2 | ||||
-rw-r--r-- | api/direct_bt/UUID.hpp | 2 |
6 files changed, 23 insertions, 23 deletions
diff --git a/api/direct_bt/BTTypes.hpp b/api/direct_bt/BTTypes.hpp index 5994a80f..5b4ad420 100644 --- a/api/direct_bt/BTTypes.hpp +++ b/api/direct_bt/BTTypes.hpp @@ -51,7 +51,7 @@ namespace direct_bt { /** LE only Bluetooth mode */ LE = 3 /**< LE */ }; - inline uint8_t number(const BTMode rhs) noexcept { + constexpr uint8_t number(const BTMode rhs) noexcept { return static_cast<uint8_t>(rhs); } std::string getBTModeString(const BTMode v) noexcept; @@ -82,7 +82,7 @@ namespace direct_bt { /** Utilizing a second factor secret to be used as a secret, e.g. NFC field. Random key exchange with additional secret (2FA) and encryption and potential MITM protection. */ OUT_OF_BAND = 4 }; - inline uint8_t number(const PairingMode rhs) noexcept { + constexpr uint8_t number(const PairingMode rhs) noexcept { return static_cast<uint8_t>(rhs); } std::string getPairingModeString(const PairingMode v) noexcept; @@ -108,7 +108,7 @@ namespace direct_bt { LE = ( 1 << BDAddressType::BDADDR_LE_PUBLIC ) | ( 1 << BDAddressType::BDADDR_LE_RANDOM ), DUAL = BREDR | LE }; - inline uint8_t number(const ScanType rhs) noexcept { + constexpr uint8_t number(const ScanType rhs) noexcept { return static_cast<uint8_t>(rhs); } std::string getScanTypeString(const ScanType v) noexcept; @@ -138,7 +138,7 @@ namespace direct_bt { SCAN_RSP = 0x04, ADV_UNDEFINED = 0xff }; - inline uint8_t number(const AD_PDU_Type rhs) noexcept { + constexpr uint8_t number(const AD_PDU_Type rhs) noexcept { return static_cast<uint8_t>(rhs); } std::string getAD_PDU_TypeString(const AD_PDU_Type v) noexcept; @@ -155,7 +155,7 @@ namespace direct_bt { /** Auto Connect: Only supported for LE on Linux .. */ HCI_AUTO_CONN_ALWAYS = 0x02 }; - inline uint8_t number(const HCIWhitelistConnectType rhs) noexcept { + constexpr uint8_t number(const HCIWhitelistConnectType rhs) noexcept { return static_cast<uint8_t>(rhs); } diff --git a/api/direct_bt/GATTHandler.hpp b/api/direct_bt/GATTHandler.hpp index 346d4153..b9c76d86 100644 --- a/api/direct_bt/GATTHandler.hpp +++ b/api/direct_bt/GATTHandler.hpp @@ -145,7 +145,7 @@ namespace direct_bt { /* BT Core Spec v5.2: Vol 3, Part G GATT: 5.2.1 ATT_MTU */ MIN_ATT_MTU = 23 }; - static inline int number(const Defaults d) { return static_cast<int>(d); } + static constexpr int number(const Defaults d) { return static_cast<int>(d); } private: const GATTEnv & env; diff --git a/api/direct_bt/HCIHandler.hpp b/api/direct_bt/HCIHandler.hpp index 5024b9b4..6294a14a 100644 --- a/api/direct_bt/HCIHandler.hpp +++ b/api/direct_bt/HCIHandler.hpp @@ -203,15 +203,15 @@ namespace direct_bt { inline bool filter_test_metaev(HCIMetaEventType mec) noexcept { return 0 != test_bit_uint32(number(mec)-1, metaev_filter_mask); } inline void filter_put_metaevs(const uint32_t mask) noexcept { metaev_filter_mask=mask; } - inline static void filter_clear_metaevs(uint32_t &mask) noexcept { mask=0; } - inline static void filter_all_metaevs(uint32_t &mask) noexcept { mask=0xffffffffU; } + constexpr static void filter_clear_metaevs(uint32_t &mask) noexcept { mask=0; } + constexpr static void filter_all_metaevs(uint32_t &mask) noexcept { mask=0xffffffffU; } inline static void filter_set_metaev(HCIMetaEventType mec, uint32_t &mask) noexcept { set_bit_uint32(number(mec)-1, mask); } inline bool filter_test_opcbit(HCIOpcodeBit opcbit) noexcept { return 0 != test_bit_uint64(number(opcbit), opcbit_filter_mask); } inline void filter_put_opcbit(const uint64_t mask) noexcept { opcbit_filter_mask=mask; } - inline static void filter_clear_opcbit(uint64_t &mask) noexcept { mask=0; } - inline static void filter_all_opcbit(uint64_t &mask) noexcept { mask=0xffffffffffffffffUL; } + constexpr static void filter_clear_opcbit(uint64_t &mask) noexcept { mask=0; } + constexpr static void filter_all_opcbit(uint64_t &mask) noexcept { mask=0xffffffffffffffffUL; } inline static void filter_set_opcbit(HCIOpcodeBit opcbit, uint64_t &mask) noexcept { set_bit_uint64(number(opcbit), mask); } LFRingbuffer<std::shared_ptr<HCIEvent>, nullptr> hciEventRing; @@ -284,7 +284,7 @@ namespace direct_bt { void close() noexcept; - inline BTMode getBTMode() noexcept { return btMode; } + constexpr BTMode getBTMode() noexcept { return btMode; } /** Returns true if this mgmt instance is open and hence valid, otherwise false */ bool isOpen() const noexcept { diff --git a/api/direct_bt/HCITypes.hpp b/api/direct_bt/HCITypes.hpp index fb632fd9..53496f5b 100644 --- a/api/direct_bt/HCITypes.hpp +++ b/api/direct_bt/HCITypes.hpp @@ -72,7 +72,7 @@ namespace direct_bt { /** 10s le connection timeout, supervising max is 32s (v5.2 Vol 4, Part E - 7.8.12) */ LE_CONN_TIMEOUT_MS = 10000 }; - inline int32_t number(const HCIConstInt rhs) noexcept { + constexpr int32_t number(const HCIConstInt rhs) noexcept { return static_cast<int>(rhs); } @@ -83,7 +83,7 @@ namespace direct_bt { MAX_SHORT_NAME_LENGTH = 10, MAX_AD_LENGTH = 31 }; - inline uint16_t number(const HCIConstU16 rhs) noexcept { + constexpr uint16_t number(const HCIConstU16 rhs) noexcept { return static_cast<uint16_t>(rhs); } @@ -166,7 +166,7 @@ namespace direct_bt { INTERNAL_FAILURE = 0xfe, UNKNOWN = 0xff }; - inline uint8_t number(const HCIStatusCode rhs) noexcept { + constexpr uint8_t number(const HCIStatusCode rhs) noexcept { return static_cast<uint8_t>(rhs); } std::string getHCIStatusCodeString(const HCIStatusCode ec) noexcept; @@ -183,7 +183,7 @@ namespace direct_bt { /** Total packet size, guaranteed to be handled by adapter. */ PACKET_MAX_SIZE = 255 }; - inline uint8_t number(const HCIConstU8 rhs) noexcept { + constexpr uint8_t number(const HCIConstU8 rhs) noexcept { return static_cast<uint8_t>(rhs); } @@ -195,7 +195,7 @@ namespace direct_bt { DIAG = 0xf0, VENDOR = 0xff }; - inline uint8_t number(const HCIPacketType rhs) noexcept { + constexpr uint8_t number(const HCIPacketType rhs) noexcept { return static_cast<uint8_t>(rhs); } std::string getHCIPacketTypeString(const HCIPacketType op) noexcept; @@ -210,7 +210,7 @@ namespace direct_bt { /** LE controller commands */ LE_CTL = 0x08 }; - inline uint8_t number(const HCIOGF rhs) noexcept { + constexpr uint8_t number(const HCIOGF rhs) noexcept { return static_cast<uint8_t>(rhs); } std::string getHCIOGFString(const HCIOGF op) noexcept; @@ -250,7 +250,7 @@ namespace direct_bt { // etc etc - incomplete }; - inline uint8_t number(const HCIEventType rhs) noexcept { + constexpr uint8_t number(const HCIEventType rhs) noexcept { return static_cast<uint8_t>(rhs); } std::string getHCIEventTypeString(const HCIEventType op) noexcept; @@ -295,7 +295,7 @@ namespace direct_bt { LE_TRANSMIT_POWER_REPORTING = 0x21,/**< LE_TRANSMIT_POWER_REPORTING */ LE_BIGINFO_ADV_REPORT = 0x22 /**< LE_BIGINFO_ADV_REPORT */ }; - inline uint8_t number(const HCIMetaEventType rhs) noexcept { + constexpr uint8_t number(const HCIMetaEventType rhs) noexcept { return static_cast<uint8_t>(rhs); } std::string getHCIMetaEventTypeString(const HCIMetaEventType op) noexcept; @@ -341,7 +341,7 @@ namespace direct_bt { LE_START_ENC = 0x2019 // etc etc - incomplete }; - inline uint16_t number(const HCIOpcode rhs) noexcept { + constexpr uint16_t number(const HCIOpcode rhs) noexcept { return static_cast<uint16_t>(rhs); } std::string getHCIOpcodeString(const HCIOpcode op) noexcept; @@ -375,7 +375,7 @@ namespace direct_bt { LE_START_ENC = 39 // etc etc - incomplete }; - inline uint8_t number(const HCIOpcodeBit rhs) noexcept { + constexpr uint8_t number(const HCIOpcodeBit rhs) noexcept { return static_cast<uint8_t>(rhs); } diff --git a/api/direct_bt/L2CAPComm.hpp b/api/direct_bt/L2CAPComm.hpp index bdb7f17e..a0418cb7 100644 --- a/api/direct_bt/L2CAPComm.hpp +++ b/api/direct_bt/L2CAPComm.hpp @@ -115,7 +115,7 @@ namespace direct_bt { enum class Defaults : int { L2CAP_CONNECT_MAX_RETRY = 3 }; - static inline int number(const Defaults d) { return static_cast<int>(d); } + static constexpr int number(const Defaults d) { return static_cast<int>(d); } static std::string getStateString(bool isConnected, bool hasIOError) { return "State[connected "+std::to_string(isConnected)+", ioError "+std::to_string(hasIOError)+"]"; diff --git a/api/direct_bt/UUID.hpp b/api/direct_bt/UUID.hpp index 3547b120..809a33dc 100644 --- a/api/direct_bt/UUID.hpp +++ b/api/direct_bt/UUID.hpp @@ -55,7 +55,7 @@ public: enum class TypeSize : int { UUID16_SZ=2, UUID32_SZ=4, UUID128_SZ=16 }; - static inline int number(const TypeSize rhs) noexcept { + static constexpr int number(const TypeSize rhs) noexcept { return static_cast<int>(rhs); } |