diff options
author | Sven Gothel <[email protected]> | 2020-08-28 01:21:03 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-08-28 01:21:03 +0200 |
commit | 0a0b3285f6790914dc06a02b642c9539701222c5 (patch) | |
tree | c1030094bfb41f79e3d4e8d41b7f3a43b0195664 /api/direct_bt | |
parent | 7d855e9503729bf1b433e4aa91a8ca869119653a (diff) |
DBTManager, HCIHandler, GATTHandler: Move local environment debug flags to their respective singleton holder for efficacy
This avoids retrieving the property more than once, thanks to the new singleton environment holder
Diffstat (limited to 'api/direct_bt')
-rw-r--r-- | api/direct_bt/DBTManager.hpp | 8 | ||||
-rw-r--r-- | api/direct_bt/GATTHandler.hpp | 4 | ||||
-rw-r--r-- | api/direct_bt/HCIHandler.hpp | 4 |
3 files changed, 12 insertions, 4 deletions
diff --git a/api/direct_bt/DBTManager.hpp b/api/direct_bt/DBTManager.hpp index 1ef938d6..9fca40f9 100644 --- a/api/direct_bt/DBTManager.hpp +++ b/api/direct_bt/DBTManager.hpp @@ -57,6 +57,9 @@ namespace direct_bt { MgmtEnv(); public: + /** Global Debug flag, retrieved first to triggers DBTEnv initialization. */ + const bool DEBUG_GLOBAL; + /** Poll timeout for mgmt reader thread, defaults to 10s. */ const int32_t MGMT_READER_THREAD_POLL_TIMEOUT; /** Timeout for mgmt command replies, defaults to 3s. */ @@ -65,6 +68,9 @@ namespace direct_bt { /** Small ringbuffer capacity for synchronized commands, defaults to 64 messages. */ const int32_t MGMT_EVT_RING_CAPACITY; + /** Debug all Mgmt event communication */ + const bool DEBUG_EVENT; + private: /** Maximum number of packets to wait for until matching a sequential command. Won't block as timeout will limit. */ const int32_t MGMT_READ_PACKET_MAX_RETRY; @@ -119,8 +125,6 @@ namespace direct_bt { std::vector<std::shared_ptr<WhitelistElem>> whitelist; const MgmtEnv & env; - const bool debug_global; // only to trigger DBTEnv initialization first - const bool debug_event; const BTMode btMode; POctets rbuffer; HCIComm comm; diff --git a/api/direct_bt/GATTHandler.hpp b/api/direct_bt/GATTHandler.hpp index 009d431b..90f22eac 100644 --- a/api/direct_bt/GATTHandler.hpp +++ b/api/direct_bt/GATTHandler.hpp @@ -76,6 +76,9 @@ namespace direct_bt { /** Medium ringbuffer capacity, defaults to 128 messages. */ const int32_t ATTPDU_RING_CAPACITY; + /** Debug all GATT Data communication */ + const bool DEBUG_DATA; + public: static GATTEnv& get() { /** @@ -118,7 +121,6 @@ namespace direct_bt { private: const GATTEnv & env; - const bool debug_data; /** GATTHandle's device weak back-reference */ std::weak_ptr<DBTDevice> wbr_device; diff --git a/api/direct_bt/HCIHandler.hpp b/api/direct_bt/HCIHandler.hpp index 6790740b..9c53caac 100644 --- a/api/direct_bt/HCIHandler.hpp +++ b/api/direct_bt/HCIHandler.hpp @@ -112,6 +112,9 @@ namespace direct_bt { /** Small ringbuffer capacity for synchronized commands, defaults to 64 messages. */ const int32_t HCI_EVT_RING_CAPACITY; + /** Debug all HCI event communication */ + const bool DEBUG_EVENT; + private: /** Maximum number of packets to wait for until matching a sequential command. Won't block as timeout will limit. */ const int32_t HCI_READ_PACKET_MAX_RETRY; @@ -157,7 +160,6 @@ namespace direct_bt { static MgmtEvent::Opcode translate(HCIEventType evt, HCIMetaEventType met); const HCIEnv & env; - const bool debug_event; const BTMode btMode; const uint16_t dev_id; POctets rbuffer; |