Trident IoT Zigbee SDK
 
Loading...
Searching...
No Matches
tr_debug_print.h
Go to the documentation of this file.
1
10#ifndef TR_DEBUG_PRINT_H
11#define TR_DEBUG_PRINT_H
12#include "zb_common.h"
13#include "tr_plugin_config.h"
14
15// debug print colors
16#define DEBUG_BLACK "\033[30m"
17#define DEBUG_RED "\033[31m"
18#define DEBUG_GREEN "\033[32m"
19#define DEBUG_YELLOW "\033[33m"
20#define DEBUG_BLUE "\033[34m"
21#define DEBUG_MAGENTA "\033[35m"
22#define DEBUG_CYAN "\033[36m"
23#define DEBUG_WHITE "\033[37m"
24#define DEBUG_DEFAULT "\033[39m"
25#define DEBUG_RESET "\033[m"
26
27// set default color(s) if color print is disabled
28#ifndef TR_DEBUG_PRINT_COLOR_ENABLED
29#ifdef TR_DEBUG_PRINT_STACK_ENABLED
30#define TR_DEBUG_PRINT_STACK_COLOR DEBUG_DEFAULT
31#endif
32#ifdef TR_DEBUG_PRINT_CORE_ENABLED
33#define TR_DEBUG_PRINT_CORE_COLOR DEBUG_DEFAULT
34#endif
35#ifdef TR_DEBUG_PRINT_APP_ENABLED
36#define TR_DEBUG_PRINT_APP_COLOR DEBUG_DEFAULT
37#endif
38#ifdef TR_DEBUG_PRINT_ZCL_ENABLED
39#define TR_DEBUG_PRINT_ZCL_COLOR DEBUG_DEFAULT
40#endif
41#ifdef TR_DEBUG_PRINT_RX_MSGS_ENABLED
42#define TR_DEBUG_PRINT_RX_MSGS_COLOR DEBUG_DEFAULT
43#endif
44#endif /* ifndef TR_DEBUG_PRINT_COLOR_ENABLED */
45
46// print groups
56
57#ifdef TR_DEBUG_PRINT_STACK_ENABLED
58#define tr_stack_printf(...) tr_debug_printf(TR_DEBUG_PRINT_STACK, TR_DEBUG_PRINT_STACK_COLOR, __VA_ARGS__)
59#define tr_stack_println(...) tr_debug_println(TR_DEBUG_PRINT_STACK, TR_DEBUG_PRINT_STACK_COLOR, __VA_ARGS__)
60#else
61#define tr_stack_printf(...)
62#define tr_stack_println(...)
63#endif
64
65#ifdef TR_DEBUG_PRINT_CORE_ENABLED
66#define tr_core_printf(...) tr_debug_printf(TR_DEBUG_PRINT_CORE, TR_DEBUG_PRINT_CORE_COLOR, __VA_ARGS__)
67#define tr_core_println(...) tr_debug_println(TR_DEBUG_PRINT_CORE, TR_DEBUG_PRINT_CORE_COLOR, __VA_ARGS__)
68#else
69#define tr_core_printf(...)
70#define tr_core_println(...)
71#endif
72
73#ifdef TR_DEBUG_PRINT_APP_ENABLED
74#define tr_app_printf(...) tr_debug_printf(TR_DEBUG_PRINT_APP, TR_DEBUG_PRINT_APP_COLOR, __VA_ARGS__)
75#define tr_app_println(...) tr_debug_println(TR_DEBUG_PRINT_APP, TR_DEBUG_PRINT_APP_COLOR, __VA_ARGS__)
76#else
77#define tr_app_printf(...)
78#define tr_app_println(...)
79#endif
80
81#ifdef TR_DEBUG_PRINT_ZCL_ENABLED
82#define tr_zcl_printf(...) tr_debug_printf(TR_DEBUG_PRINT_ZCL, TR_DEBUG_PRINT_ZCL_COLOR, __VA_ARGS__)
83#define tr_zcl_println(...) tr_debug_println(TR_DEBUG_PRINT_ZCL, TR_DEBUG_PRINT_ZCL_COLOR, __VA_ARGS__)
84#else
85#define tr_zcl_printf(...)
86#define tr_zcl_println(...)
87#endif
88
89#ifdef TR_DEBUG_PRINT_RX_MSGS_ENABLED
90#define tr_rxmsgs_printf(...) tr_debug_printf(TR_DEBUG_PRINT_RX_MSGS, TR_DEBUG_PRINT_RX_MSGS_COLOR, __VA_ARGS__)
91#define tr_rxmsgs_println(...) tr_debug_println(TR_DEBUG_PRINT_RX_MSGS, TR_DEBUG_PRINT_RX_MSGS_COLOR, __VA_ARGS__)
92#else
93#define tr_rxmsgs_printf(...)
94#define tr_rxmsgs_println(...)
95#endif
96
106
109zb_uint32_t tr_get_print_group_mask(void);
110
114
118
123
125
130 const char *color,
131 const char *fmt,
132 ...);
133
135 const char *color,
136 const char *fmt,
137 ...);
138
140
141#endif // TR_DEBUG_PRINT_H
void tr_disable_print_group(tr_debug_print_group_t group)
TODO - documentation.
zb_uint32_t tr_get_print_group_mask(void)
TODO - documentation.
void tr_enable_print_group(tr_debug_print_group_t group)
TODO - documentation.
zb_bool_t tr_check_print_group(tr_debug_print_group_t group)
TODO - documentation.
void tr_debug_println(tr_debug_print_group_t group, const char *color, const char *fmt,...)
void tr_debug_printf(tr_debug_print_group_t group, const char *color, const char *fmt,...)
tr_debug_print_group_t
Definition tr_debug_print.h:48
@ TR_DEBUG_PRINT_ZCL
Definition tr_debug_print.h:52
@ TR_DEBUG_PRINT_APP
Definition tr_debug_print.h:51
@ TR_DEBUG_PRINT_CORE
Definition tr_debug_print.h:50
@ TR_DEBUG_PRINT_ALL
Definition tr_debug_print.h:54
@ TR_DEBUG_PRINT_RX_MSGS
Definition tr_debug_print.h:53
@ TR_DEBUG_PRINT_STACK
Definition tr_debug_print.h:49
char * tr_find_cluster_name(zb_uint16_t cluster_id)
zb_uint16_t cluster_id
Definition tr_nvram_attr.h:24