1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
4 * BlueZ - Bluetooth protocol stack for Linux
6 * Copyright (C) 2011-2014 Intel Corporation
7 * Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
17 enum monitor_color { COLOR_AUTO, COLOR_ALWAYS, COLOR_NEVER };
18 void set_monitor_color(enum monitor_color);
20 #define COLOR_OFF "\x1B[0m"
21 #define COLOR_BLACK "\x1B[0;30m"
22 #define COLOR_RED "\x1B[0;31m"
23 #define COLOR_GREEN "\x1B[0;32m"
24 #define COLOR_YELLOW "\x1B[0;33m"
25 #define COLOR_BLUE "\x1B[0;34m"
26 #define COLOR_MAGENTA "\x1B[0;35m"
27 #define COLOR_CYAN "\x1B[0;36m"
28 #define COLOR_WHITE "\x1B[0;37m"
29 #define COLOR_WHITE_BG "\x1B[0;47;30m"
30 #define COLOR_HIGHLIGHT "\x1B[1;39m"
32 #define COLOR_RED_BOLD "\x1B[1;31m"
33 #define COLOR_GREEN_BOLD "\x1B[1;32m"
34 #define COLOR_BLUE_BOLD "\x1B[1;34m"
35 #define COLOR_MAGENTA_BOLD "\x1B[1;35m"
37 #define COLOR_ERROR "\x1B[1;31m"
38 #define COLOR_WARN "\x1B[1m"
39 #define COLOR_INFO COLOR_OFF
40 #define COLOR_DEBUG COLOR_WHITE
42 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
43 #define FALLBACK_TERMINAL_WIDTH 130
45 #define FALLBACK_TERMINAL_WIDTH 80
48 #define print_indent(indent, color1, prefix, title, color2, fmt, args...) \
50 printf("%*c%s%s%s%s" fmt "%s\n", (indent), ' ', \
51 use_color() ? (color1) : "", prefix, title, \
52 use_color() ? (color2) : "", ## args, \
53 use_color() ? COLOR_OFF : ""); \
56 #define print_text(color, fmt, args...) \
57 print_indent(8, COLOR_OFF, "", "", color, fmt, ## args)
59 #define print_field(fmt, args...) \
60 print_indent(8, COLOR_OFF, "", "", COLOR_OFF, fmt, ## args)
62 struct bitfield_data {
67 static inline uint64_t print_bitfield(int indent, uint64_t val,
68 const struct bitfield_data *table)
73 for (i = 0; table[i].str; i++) {
74 if (val & (((uint64_t) 1) << table[i].bit)) {
75 print_field("%*c%s", indent, ' ', table[i].str);
76 mask &= ~(((uint64_t) 1) << table[i].bit);
83 static inline void print_hex_field(const char *label, const uint8_t *data,
86 char str[len * 2 + 1];
91 for (i = 0; i < len; i++)
92 sprintf(str + (i * 2), "%2.2x", data[i]);
94 print_field("%s: %s", label, str);
97 #ifndef TIZEN_FEATURE_BLUEZ_MODIFY
98 void set_default_pager_num_columns(int num_columns);
100 int num_columns(void);
102 void open_pager(void);
103 void close_pager(void);