2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
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.
18 * This file declares wifi direct application util functions.
20 * @file wfd-app-util.h
21 * @author Sungsik Jang (sungsik.jang@samsung.com)
26 #ifndef __WFD_APP_UTIL_H__
27 #define __WFD_APP_UTIL_H__
30 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
31 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
36 #define WIFI_DIRECT_APP_MID "wfd-app"
38 #define WFD_APP_LOG_LOW LOG_VERBOSE
39 #define WFD_APP_LOG_HIGH LOG_INFO
40 #define WFD_APP_LOG_ERROR LOG_ERROR
41 #define WFD_APP_LOG_WARN LOG_WARN
42 #define WFD_APP_LOG_ASSERT LOG_FATAL
43 #define WFD_APP_LOG_EXCEPTION LOG_FATAL
45 char *wfd_app_trim_path(const char *filewithpath);
48 #define WFD_APP_LOG(log_level, format, args...) \
49 LOG(log_level, WIFI_DIRECT_APP_MID, "[%s:%04d,%d] " format, wfd_app_trim_path(__FILE__), __LINE__,wfd_app_gettid(),##args)
50 #define __WFD_APP_FUNC_ENTER__ LOG(LOG_VERBOSE, WIFI_DIRECT_APP_MID, "[%s:%04d,%d] Enter: %s()\n", wfd_app_trim_path(__FILE__), __LINE__,wfd_app_gettid(),__func__)
51 #define __WFD_APP_FUNC_EXIT__ LOG(LOG_VERBOSE, WIFI_DIRECT_APP_MID, "[%s:%04d,%d] Quit: %s()\n", wfd_app_trim_path(__FILE__), __LINE__,wfd_app_gettid(),__func__)
53 #else /** _DLOG_UTIL */
55 #define WFD_APP_LOG(log_level, format, args...) printf("[%s:%04d,%d] " format, wfd_app_trim_path(__FILE__), __LINE__,wfd_app_gettid(), ##args)
56 #define __WFD_APP_FUNC_ENTER__ printf("[%s:%04d,%d] Entering: %s()\n", wfd_app_trim_path(__FILE__), __LINE__,wfd_app_gettid(),__func__)
57 #define __WFD_APP_FUNC_EXIT__ printf("[%s:%04d,%d] Quit: %s()\n", wfd_app_trim_path(__FILE__), __LINE__,wfd_app_gettid(),__func__)
59 #endif /** _USE_DLOG_UTIL */
63 #define assertm_if(expr, fmt, arg...) do { \
65 WFD_APP_LOG(WFD_APP_LOG_ASSERT, " ##(%s) -> %s() assert!!## "fmt, #expr, __FUNCTION__, ##arg); \
72 #endif /* __WFD_APP_UTIL_H__ */