4 * Copyright 2012 Samsung Electronics Co., Ltd
6 * Licensed under the Flora License, Version 1.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.tizenopensource.org/license
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 * This file declares wifi direct application util functions.
23 * @file wfd-app-util.h
24 * @author Sungsik Jang (sungsik.jang@samsung.com)
29 #ifndef __WFD_APP_UTIL_H__
30 #define __WFD_APP_UTIL_H__
33 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
34 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
39 #define WIFI_DIRECT_APP_MID "wfd-ugapp"
41 #define WFD_APP_LOG_LOW LOG_VERBOSE
42 #define WFD_APP_LOG_HIGH LOG_INFO
43 #define WFD_APP_LOG_ERROR LOG_ERROR
44 #define WFD_APP_LOG_WARN LOG_WARN
45 #define WFD_APP_LOG_ASSERT LOG_FATAL
46 #define WFD_APP_LOG_EXCEPTION LOG_FATAL
47 #define WFD_MAX_SIZE 128
48 #define WFD_MAC_ADDRESS_SIZE 18
50 char * wfd_app_trim_path(const char* filewithpath);
53 #define WFD_APP_LOG(log_level, format, args...) \
54 LOG(log_level, WIFI_DIRECT_APP_MID, "[%s:%04d,%d] " format, wfd_app_trim_path(__FILE__), __LINE__,wfd_app_gettid(),##args)
55 #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__)
56 #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__)
58 #else /** _DLOG_UTIL */
60 #define WFD_APP_LOG(log_level, format, args...) printf("[%s:%04d,%d] " format, wfd_app_trim_path(__FILE__), __LINE__,wfd_app_gettid(), ##args)
61 #define __WFD_APP_FUNC_ENTER__ printf("[%s:%04d,%d] Entering: %s()\n", wfd_app_trim_path(__FILE__), __LINE__,wfd_app_gettid(),__func__)
62 #define __WFD_APP_FUNC_EXIT__ printf("[%s:%04d,%d] Quit: %s()\n", wfd_app_trim_path(__FILE__), __LINE__,wfd_app_gettid(),__func__)
64 #endif /** _USE_DLOG_UTIL */
68 #define assertm_if(expr, fmt, arg...) do { \
70 WFD_APP_LOG(WFD_APP_LOG_ASSERT, " ##(%s) -> %s() assert!!## "fmt, #expr, __FUNCTION__, ##arg); \
73 } while (0) // retvm if
77 #endif /* __WFD_APP_UTIL_H__ */