2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #ifndef _BT_CORE_COMMON_H_
20 #define _BT_CORE_COMMON_H_
22 #include <sys/types.h>
29 #define LOG_TAG "BLUETOOTH_FRWK_CORE"
31 #define LOG_COLOR_RESET "\033[0m"
32 #define LOG_COLOR_RED "\033[31m"
33 #define LOG_COLOR_YELLOW "\033[33m"
34 #define LOG_COLOR_GREEN "\033[32m"
35 #define LOG_COLOR_BLUE "\033[36m"
36 #define LOG_COLOR_PURPLE "\033[35m"
38 #define BT_DBG(fmt, args...) \
40 #define BT_INFO(fmt, args...) \
42 #define BT_ERR(fmt, args...) \
45 #define BT_INFO_C(fmt, arg...) \
46 SLOGI_IF(TRUE, LOG_COLOR_GREEN" "fmt" "LOG_COLOR_RESET, ##arg)
47 #define BT_ERR_C(fmt, arg...) \
48 SLOGI_IF(TRUE, LOG_COLOR_RED" "fmt" "LOG_COLOR_RESET, ##arg)
50 #define DBG_SECURE(fmt, args...) SECURE_SLOGD(fmt, ##args)
51 #define ERR_SECURE(fmt, args...) SECURE_SLOGE(fmt, ##args)
53 #define ret_if(expr) \
56 BT_ERR("(%s) return", #expr); \
61 #define retv_if(expr, val) \
64 BT_ERR("(%s) return", #expr); \
69 #define BT_FREE_PARAMS(IP1, IP2, IP3, IP4, OP) \
72 g_array_free(IP1, TRUE); \
74 g_array_free(IP2, TRUE); \
76 g_array_free(IP3, TRUE); \
78 g_array_free(IP4, TRUE); \
80 g_array_free(OP, TRUE); \
83 #define BT_ALLOC_PARAMS(IP1, IP2, IP3, IP4, OP) \
85 IP1 = g_array_new(TRUE, TRUE, sizeof(gchar)); \
86 IP2 = g_array_new(TRUE, TRUE, sizeof(gchar)); \
87 IP3 = g_array_new(TRUE, TRUE, sizeof(gchar)); \
88 IP4 = g_array_new(TRUE, TRUE, sizeof(gchar)); \
93 #endif /* __cplusplus */
94 #endif /*_BT_CORE_COMMON_H_*/