aboutsummaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-09-19 03:40:01 +0200
committerSven Gothel <[email protected]>2020-09-19 03:40:01 +0200
commit60151ef8fdacfb2d8a1aaf6d6df6c51b65c3fe70 (patch)
tree11c6554e36e8220afed15471069d4c6f52b24d90 /api
parente18423feaf0e1f815f4a02ad16d6ef2fdaf8b774 (diff)
dbt_debug: Generalize ERR_PRINT2 -> ERR_PRINT_IMPL w/ prefix param; Add IRQ_PRINT(.. "Interrupted" ), to clarify class of event.
An interruption might not be an error, but expected behavior - e.g. if a device is powered off. Use IRQ_ERROR in GattHandler on: - l2cap write error -> disconnect + exception - l2cap nullptr reply (sendWithReply) -> disconnect + exception - l2cap read error (l2capReaderThread) -> disconnect We might find other occassions where this informal output fits.
Diffstat (limited to 'api')
-rw-r--r--api/direct_bt/dbt_debug.hpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/api/direct_bt/dbt_debug.hpp b/api/direct_bt/dbt_debug.hpp
index 7b42e47e..34b5d9e4 100644
--- a/api/direct_bt/dbt_debug.hpp
+++ b/api/direct_bt/dbt_debug.hpp
@@ -67,20 +67,23 @@ namespace direct_bt {
/** Use for unconditional error messages, prefix '[elapsed_time] Error @ file:line: '. Function also appends last errno and strerror(errno). */
void ERR_PRINTv(const char *file, const int line, const char * format, va_list args) noexcept;
- /** Use for unconditional error messages, prefix '[elapsed_time] Error @ file:line: '. Function also appends last errno and strerror(errno). */
- void ERR_PRINT2(const char *file, const int line, const char * format, ...) noexcept;
+ /** Use for unconditional error messages, prefix '[elapsed_time] 'prefix' @ file:line: '. Function also appends last errno and strerror(errno). */
+ void ERR_PRINT_impl(const char *prefix, const char *file, const int line, const char * format, ...) noexcept;
/** Use for unconditional error messages, prefix '[elapsed_time] Error @ FILE:LINE: '. Function also appends last errno and strerror(errno). */
- #define ERR_PRINT(...) { direct_bt::ERR_PRINT2(__FILE__, __LINE__, __VA_ARGS__); }
+ #define ERR_PRINT(...) { direct_bt::ERR_PRINT_impl("Error", __FILE__, __LINE__, __VA_ARGS__); }
+
+ /** Use for unconditional interruption messages, prefix '[elapsed_time] Interrupted @ FILE:LINE: '. Function also appends last errno and strerror(errno). */
+ #define IRQ_PRINT(...) { direct_bt::ERR_PRINT_impl("Interrupted", __FILE__, __LINE__, __VA_ARGS__); }
/** Use for unconditional warning messages, prefix '[elapsed_time] Warning @ file:line: ' */
void WARN_PRINTv(const char *file, const int line, const char * format, va_list args) noexcept;
/** Use for unconditional warning messages, prefix '[elapsed_time] Warning @ file:line: ' */
- void WARN_PRINT2(const char *file, const int line, const char * format, ...) noexcept;
+ void WARN_PRINT_impl(const char *file, const int line, const char * format, ...) noexcept;
/** Use for unconditional warning messages, prefix '[elapsed_time] Warning @ FILE:LINE: ' */
- #define WARN_PRINT(...) { direct_bt::WARN_PRINT2(__FILE__, __LINE__, __VA_ARGS__); }
+ #define WARN_PRINT(...) { direct_bt::WARN_PRINT_impl(__FILE__, __LINE__, __VA_ARGS__); }
/** Use for unconditional informal messages, prefix '[elapsed_time] Info: '. */
void INFO_PRINT(const char * format, ...) noexcept;