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__
35 #define WIFI_DIRECT_APP_MID "wfd-app"
37 #define WFD_APP_LOG_LOW LOG_INFO
38 #define WFD_APP_LOG_HIGH LOG_INFO
39 #define WFD_APP_LOG_ERROR LOG_ERROR
40 #define WFD_APP_LOG_WARN LOG_WARN
41 #define WFD_APP_LOG_ASSERT LOG_FATAL
42 #define WFD_APP_LOG_EXCEPTION LOG_FATAL
43 #define WFD_MAX_SIZE 128
44 #define WFD_MAC_ADDRESS_SIZE 18
46 char *wfd_app_trim_path(const char *filewithpath);
48 /* TODO:: To change the log level as LOG_INFO */
49 #define WFD_APP_LOG(log_level, format, args...) \
50 LOG(LOG_ERROR, WIFI_DIRECT_APP_MID, "[%s:%04d,%d] " format, wfd_app_trim_path(__FILE__), __LINE__, wfd_app_gettid(), ##args)
51 #define WFD_APP_LOGSECURE(log_level, format, args...) \
52 SECURE_LOG(LOG_ERROR, 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 #define __WFD_APP_FUNC_ENTER__
59 #define __WFD_APP_FUNC_EXIT__
62 #else /** _DLOG_UTIL */
64 #define WFD_APP_LOG(log_level, format, args...) printf("[%s:%04d,%d] " format, wfd_app_trim_path(__FILE__), __LINE__, wfd_app_gettid(), ##args)
66 #define __WFD_APP_FUNC_ENTER__ printf("[%s:%04d,%d] Entering: %s()\n", wfd_app_trim_path(__FILE__), __LINE__, wfd_app_gettid(), __func__)
67 #define __WFD_APP_FUNC_EXIT__ printf("[%s:%04d,%d] Quit: %s()\n", wfd_app_trim_path(__FILE__), __LINE__, wfd_app_gettid(), __func__)
69 #define __WFD_APP_FUNC_ENTER__
70 #define __WFD_APP_FUNC_EXIT__
73 #endif /** _USE_DLOG_UTIL */
75 #define WFD_RET_IF(expr, fmt, args...) \
78 WFD_APP_LOG(WFD_APP_LOG_ERROR, "[%s] Return, message "fmt, #expr, ##args );\
83 #define WFD_IF_FREE_MEM(mem) \
91 #define WFD_RETV_IF(expr, val, fmt, args...) \
94 WFD_APP_LOG(WFD_APP_LOG_ERROR, "[%s] Return value, message "fmt, #expr, ##args );\
99 #define assertm_if(expr, fmt, arg...) do { \
101 WFD_APP_LOG(WFD_APP_LOG_ASSERT, " ##(%s) -> %s() assert!!## "fmt, #expr, __FUNCTION__, ##arg); \
106 int wfd_app_util_register_hard_key_down_cb(void *data);
107 int wfd_app_util_register_vconf_callbacks(void *data);
108 int wfd_app_util_deregister_vconf_callbacks(void *data);
110 void wfd_app_util_del_notification(wfd_appdata_t *ad);
111 #ifdef NOT_CONNECTED_INDICATOR_ICON
112 void wfd_app_util_add_indicator_icon(void *user_data);
114 void wfd_app_util_add_wfd_turn_off_notification(void *user_data);
116 #ifdef WFD_SCREEN_MIRRORING_ENABLED
117 void wfd_app_util_set_screen_mirroring_deactivated(wfd_appdata_t *ad);
119 void wfd_app_util_del_wfd_connected_notification(wfd_appdata_t *ad);
120 #endif /* __WFD_APP_UTIL_H__ */