From f80a628ef4279b9bf237981fc7aa2e9dbbae2915 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 24 Aug 2020 22:02:00 +0200
Subject: Adopt to exploding DEBUG value, implement
'hci.event,manager.event,adapter.event,gatt.data' for 'direct_bt.debug'
Explosion of 'hci.event,manager.event,adapter.event,gatt.data' will lead to
- 'direct_bt.debug.hci.event'
- 'direct_bt.debug.manager.event'
- 'direct_bt.debug.adapter.event'
- 'direct_bt.debug.gatt.data'
and is being used in their respective modules using COND_PRINT(debug_state, ...).
---
api/direct_bt/DBTAdapter.hpp | 10 ++++++++++
api/direct_bt/DBTManager.hpp | 8 ++++++++
api/direct_bt/GATTHandler.hpp | 8 ++++++++
api/direct_bt/HCIHandler.hpp | 7 +++++++
4 files changed, 33 insertions(+)
(limited to 'api')
diff --git a/api/direct_bt/DBTAdapter.hpp b/api/direct_bt/DBTAdapter.hpp
index d17362ee..f3c1fbe2 100644
--- a/api/direct_bt/DBTAdapter.hpp
+++ b/api/direct_bt/DBTAdapter.hpp
@@ -148,6 +148,15 @@ namespace direct_bt {
// *************************************************
// *************************************************
+ /**
+ * DBTAdapter represents one Bluetooth Controller.
+ *
+ * Controlling Environment variables:
+ *
+ * - 'direct_bt.debug.adapter.event': Debug messages about events, see debug_events
+ *
+ *
+ */
class DBTAdapter : public DBTObject
{
private:
@@ -156,6 +165,7 @@ namespace direct_bt {
static std::shared_ptr findDevice(std::vector> & devices, EUI48 const & mac, const BDAddressType macType);
std::shared_ptr findDevice(std::vector> & devices, DBTDevice const & device);
+ const bool debug_event;
DBTManager& mgmt;
std::shared_ptr adapterInfo;
NameAndShortName localName;
diff --git a/api/direct_bt/DBTManager.hpp b/api/direct_bt/DBTManager.hpp
index cd6aa3b7..f5e75d7a 100644
--- a/api/direct_bt/DBTManager.hpp
+++ b/api/direct_bt/DBTManager.hpp
@@ -50,6 +50,12 @@ namespace direct_bt {
*
* Implementation utilizes a lock free ringbuffer receiving data within its separate thread.
*
+ *
+ * Controlling Environment variables:
+ *
+ * - 'direct_bt.debug.manager.event': Debug messages about events, see debug_event
+ *
+ *
*/
class DBTManager : public JavaUplink {
public:
@@ -78,6 +84,8 @@ namespace direct_bt {
};
std::vector> whitelist;
+ 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 3f671fe8..25546f62 100644
--- a/api/direct_bt/GATTHandler.hpp
+++ b/api/direct_bt/GATTHandler.hpp
@@ -61,6 +61,12 @@ namespace direct_bt {
*
* Implementation utilizes a lock free ringbuffer receiving data within its separate thread.
*
+ *
+ * Controlling Environment variables:
+ *
+ * - 'direct_bt.debug.gatt.data': Debug messages about detailed GATT data, see debug_data
+ *
+ *
*/
class GATTHandler {
public:
@@ -84,6 +90,8 @@ namespace direct_bt {
static inline int number(const Defaults d) { return static_cast(d); }
private:
+ const bool debug_data;
+
/** GATTHandle's device weak back-reference */
std::weak_ptr wbr_device;
diff --git a/api/direct_bt/HCIHandler.hpp b/api/direct_bt/HCIHandler.hpp
index 412c1345..f30f1fbb 100644
--- a/api/direct_bt/HCIHandler.hpp
+++ b/api/direct_bt/HCIHandler.hpp
@@ -95,6 +95,12 @@ namespace direct_bt {
*
* Implementation utilizes a lock free ringbuffer receiving data within its separate thread.
*
+ *
+ * Controlling Environment variables:
+ *
+ * - 'direct_bt.debug.hci.event': Debug messages about events, see debug_event
+ *
+ *
*/
class HCIHandler {
public:
@@ -118,6 +124,7 @@ namespace direct_bt {
private:
static MgmtEvent::Opcode translate(HCIEventType evt, HCIMetaEventType met);
+ const bool debug_event;
const BTMode btMode;
const uint16_t dev_id;
POctets rbuffer;
--
cgit v1.2.3