X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=popup-wifidirect%2Finclude%2Fwfd-app-util.h;h=b6a16b3f0d6289525223a41458d2f8b1140f3596;hb=ea0eb10918bf56338ccea1405cab0eaa5fac0782;hp=1936ab395881d474c6055d0217469267a2276072;hpb=35cc30241437eeacaae7ca61aeac70e16ef0c1ad;p=apps%2Fnative%2Fug-wifi-direct.git diff --git a/popup-wifidirect/include/wfd-app-util.h b/popup-wifidirect/include/wfd-app-util.h index 1936ab3..b6a16b3 100755 --- a/popup-wifidirect/include/wfd-app-util.h +++ b/popup-wifidirect/include/wfd-app-util.h @@ -1,13 +1,13 @@ /* * WiFi-Direct UG * -* Copyright 2012 Samsung Electronics Co., Ltd +* Copyright 2012 Samsung Electronics Co., Ltd -* Licensed under the Flora License, Version 1.1 (the "License"); +* Licensed under the Flora License, Version 1.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* http://floralicense.org/license +* http://www.tizenopensource.org/license * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -29,55 +29,92 @@ #ifndef __WFD_APP_UTIL_H__ #define __WFD_APP_UTIL_H__ +#ifdef VITA_FEATURE +#include + +#define WIFI_DIRECT_APP_MID "wfd-app" -#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] -#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x" +#define WFD_APP_LOG_LOW LOG_INFO +#define WFD_APP_LOG_HIGH LOG_INFO +#define WFD_APP_LOG_ERROR LOG_ERROR +#define WFD_APP_LOG_WARN LOG_WARN +#define WFD_APP_LOG_ASSERT LOG_FATAL +#define WFD_APP_LOG_EXCEPTION LOG_FATAL #define WFD_MAX_SIZE 128 #define WFD_MAC_ADDRESS_SIZE 18 -#ifdef USE_DLOG -#include - -#undef LOG_TAG -#define LOG_TAG "WIFI_DIRECT_POPUP" +char *wfd_app_trim_path(const char *filewithpath); +int wfd_app_gettid(); +/* TODO:: To change the log level as LOG_INFO */ +#define WFD_APP_LOG(log_level, format, args...) \ + LOG(LOG_ERROR, WIFI_DIRECT_APP_MID, "[%s:%04d,%d] " format, wfd_app_trim_path(__FILE__), __LINE__, wfd_app_gettid(), ##args) +#define WFD_APP_LOGSECURE(log_level, format, args...) \ + SECURE_LOG(LOG_ERROR, WIFI_DIRECT_APP_MID, "[%s:%04d,%d] " format, wfd_app_trim_path(__FILE__), __LINE__, wfd_app_gettid(), ##args) + +#if 0 +#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__) +#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__) +#else +#define __WFD_APP_FUNC_ENTER__ +#define __WFD_APP_FUNC_EXIT__ +#endif -#define WDPOP_LOGV(format, args...) LOGV(format, ##args) -#define WDPOP_LOGD(format, args...) LOGD(format, ##args) -#define WDPOP_LOGI(format, args...) LOGI(format, ##args) -#define WDPOP_LOGW(format, args...) LOGW(format, ##args) -#define WDPOP_LOGE(format, args...) LOGE(format, ##args) -#define WDPOP_LOGF(format, args...) LOGF(format, ##args) - -#define __WDPOP_LOG_FUNC_ENTER__ LOGV("Enter") -#define __WDPOP_LOG_FUNC_EXIT__ LOGV("Quit") +#else /** _DLOG_UTIL */ -#define assertm_if(expr, fmt, args...) do { \ +#define WFD_APP_LOG(log_level, format, args...) printf("[%s:%04d,%d] " format, wfd_app_trim_path(__FILE__), __LINE__, wfd_app_gettid(), ##args) +#if 0 +#define __WFD_APP_FUNC_ENTER__ printf("[%s:%04d,%d] Entering: %s()\n", wfd_app_trim_path(__FILE__), __LINE__, wfd_app_gettid(), __func__) +#define __WFD_APP_FUNC_EXIT__ printf("[%s:%04d,%d] Quit: %s()\n", wfd_app_trim_path(__FILE__), __LINE__, wfd_app_gettid(), __func__) +#else +#define __WFD_APP_FUNC_ENTER__ +#define __WFD_APP_FUNC_EXIT__ +#endif + +#endif /** _USE_DLOG_UTIL */ + +#define WFD_RET_IF(expr, fmt, args...) \ + do { \ + if(expr) { \ + WFD_APP_LOG(WFD_APP_LOG_ERROR, "[%s] Return, message "fmt, #expr, ##args );\ + return; \ + } \ + } while (0) + +#define WFD_IF_FREE_MEM(mem) \ + do { \ + if(mem) { \ + free(mem); \ + mem = NULL; \ + } \ + } while (0) + +#define WFD_RETV_IF(expr, val, fmt, args...) \ + do { \ + if(expr) { \ + WFD_APP_LOG(WFD_APP_LOG_ERROR, "[%s] Return value, message "fmt, #expr, ##args );\ + return (val); \ + } \ + } while (0) + +#define assertm_if(expr, fmt, arg...) do { \ if (expr) { \ - WDPOP_LOGF(" ##(%s) -> assert!!## "fmt, #expr, ##args); \ + WFD_APP_LOG(WFD_APP_LOG_ASSERT, " ##(%s) -> %s() assert!!## "fmt, #expr, __FUNCTION__, ##arg); \ exit(1); \ } \ } while (0) -#else /** _DLOG_UTIL */ +int wfd_app_util_register_hard_key_down_cb(void *data); +int wfd_app_util_register_vconf_callbacks(void *data); +int wfd_app_util_deregister_vconf_callbacks(void *data); -#define WDPOP_LOGV(format, args...) \ - printf("[V/WIFI_DIRECT_POPUP] %s: %s()(%4d)> "format, __FILE__, __FUNCTION__, __LINE__, ##args) -#define WDPOP_LOGD(format, args...) \ - printf("[D/WIFI_DIRECT_POPUP] %s: %s()(%4d)> "format, __FILE__, __FUNCTION__, __LINE__, ##args) -#define WDPOP_LOGI(format, args...) \ - printf("[I/WIFI_DIRECT_POPUP] %s: %s()(%4d)> "format, __FILE__, __FUNCTION__, __LINE__, ##args) -#define WDPOP_LOGW(format, args...) \ - printf("[W/WIFI_DIRECT_POPUP] %s: %s()(%4d)> "format, __FILE__, __FUNCTION__, __LINE__, ##args) -#define WDPOP_LOGE(format, args...) \ - printf("[E/WIFI_DIRECT_POPUP] %s: %s()(%4d)> "format, __FILE__, __FUNCTION__, __LINE__, ##args) -#define WDPOP_LOGF(format, args...) \ - printf("[F/WIFI_DIRECT_POPUP] %s: %s()(%4d)> "format, __FILE__, __FUNCTION__, __LINE__, ##args) - -#define __WDPOP_LOG_FUNC_ENTER__ \ - printf("[V/WIFI_DIRECT_POPUP] %s: %s()(%4d)> Enter", __FILE__, __FUNCTION__, __LINE__) -#define __WDPOP_LOG_FUNC_EXIT__ \ - printf("[V/WIFI_DIRECT_POPUP] %s: %s()(%4d)> Exit", __FILE__, __FUNCTION__, __LINE__) - -#endif /** _DLOG_UTIL */ +void wfd_app_util_del_notification(wfd_appdata_t *ad); +#ifdef NOT_CONNECTED_INDICATOR_ICON +void wfd_app_util_add_indicator_icon(void *user_data); +#endif +void wfd_app_util_add_wfd_turn_off_notification(void *user_data); +#ifdef WFD_SCREEN_MIRRORING_ENABLED +void wfd_app_util_set_screen_mirroring_deactivated(wfd_appdata_t *ad); +#endif +void wfd_app_util_del_wfd_connected_notification(wfd_appdata_t *ad); #endif /* __WFD_APP_UTIL_H__ */