bool GenSettingMenu::create()
{
- eprintf("entered in GenSettingMenu::create() of %s\n", name());
+ SCTRACE_DEBUG("entered in GenSettingMenu::create() of %s", name());
if(funcPrecreate)
(*funcPrecreate)(this);
MENURUN_ERROR GenSettingMenu::execute(string &title, int argc, char *argv[])
{
- eprintf("execute() of %s, %p, %p, %p\n", name(), funcExecute, funcPrecreate, funcValue);
+ SCTRACE_DEBUG("execute() of %s, %p, %p, %p", name(), funcExecute, funcPrecreate, funcValue);
if (funcExecute) {
printf("%s\n\n", title.c_str());
return (*funcExecute)(argc, argv, this);
MENURUN_ERROR GenSettingMenu::value(string &resultstr, int argc, char *argv[])
{
- eprintf("value() of %s, %p, %p, %p\n", name(), funcExecute, funcPrecreate, funcValue);
+ SCTRACE_DEBUG("value() of %s, %p, %p, %p", name(), funcExecute, funcPrecreate, funcValue);
if (funcValue) {
return (*funcValue)(resultstr, argc, argv, this);
}
#ifndef __SCDEBUG_H_
#define __SCDEBUG_H_
+#include <stdio.h>
+#include <string.h>
#include <glib.h>
#define SETTINGCMD_USING_PLATFORM_DBG
#ifdef LOG_TAG
#undef LOG_TAG
#endif
-
-
#define LOG_TAG "SETTINGCMD"
#endif
#ifdef SETTINGCMD_ENABLE_TRACE
#ifdef SETTINGCMD_USING_PLATFORM_DBG
-#define SETTINGCMD_TRACE_SECURE_DEBUG(fmt, arg...) do {\
+#define SCTRACE_SECURE_DEBUG(fmt, arg...) do {\
SECURE_LOGD("\033[0;32mDEBUG: " fmt "\033[0m\n", ##arg);\
} while (0)
-#define SETTINGCMD_TRACE_DEBUG(fmt, arg...) do {\
+#define SCTRACE_DEBUG(fmt, arg...) do {\
SECURE_LOGD("\033[0;32mDEBUG: " fmt "\033[0m\n", ##arg);\
} while (0)
-#define SETTINGCMD_TRACE(fmt, arg...) do {\
+#define SCTRACE(fmt, arg...) do {\
SECURE_LOGI("\033[0;36m" fmt "\033[0m\n", ##arg);\
} while (0)
-#define SETTINGCMD_TRACE_WARNING(fmt, arg...) do {\
+#define SCTRACE_WARNING(fmt, arg...) do {\
SECURE_LOGI("\033[0;33mWARRING: " fmt "\033[0m\n", ##arg);\
} while (0)
-#define SETTINGCMD_TRACE_ERROR(fmt, arg...) do {\
+#define SCTRACE_ERROR(fmt, arg...) do {\
SECURE_LOGE("\033[0;31mERROR: " fmt "\033[0m\n", ##arg);\
} while (0)
-#define SETTINGCMD_TRACE_BEGIN do {\
+#define SCTRACE_BEGIN do {\
SECURE_LOGD("\033[0;35mENTER FUNCTION: %s. \033[0m\n", \
__FUNCTION__);\
} while (0)
-#define SETTINGCMD_TRACE_END do {\
+#define SCTRACE_END do {\
SECURE_LOGD("\033[0;35mEXIT FUNCTION: %s. \033[0m\n", \
__FUNCTION__);\
} while (0)
#else
-#define SETTINGCMD_TRACE(fmt, arg...) do {\
+#define SCTRACE(fmt, arg...) do {\
printf("\n[SETTING]\033[0;36m" fmt "\033[0m\t%s:%d\n", \
##arg, (char*)(strrchr(__FILE__, '/')+1), __LINE__);\
} while (0)
-#define SETTINGCMD_TRACE_SECURE_DEBUG(fmt, arg...) do {\
+#define SCTRACE_SECURE_DEBUG(fmt, arg...) do {\
printf("\n[SETTING]\033[0;32mDEBUG: " fmt "\033[0m\t%s:%d\n", \
##arg, (char*)(strrchr(__FILE__, '/')+1), __LINE__);\
} while (0)
-#define SETTINGCMD_TRACE_DEBUG(fmt, arg...) do {\
+#define SCTRACE_DEBUG(fmt, arg...) do {\
printf("\n[SETTING]\033[0;32mDEBUG: " fmt "\033[0m\t%s:%d\n", \
##arg, (char*)(strrchr(__FILE__, '/')+1), __LINE__);\
} while (0)
-#define SETTINGCMD_TRACE_WARNING(fmt, arg...) do {\
+#define SCTRACE_WARNING(fmt, arg...) do {\
printf("[SETTING]\033[0;33mWARRING: " fmt \
"\033[0m\t%s:%d\n", ##arg, \
(char*)(strrchr(__FILE__, '/')+1), __LINE__);\
} while (0)
-#define SETTINGCMD_TRACE_ERROR(fmt, arg...) do {\
+#define SCTRACE_ERROR(fmt, arg...) do {\
fprintf(stderr, "[SETTING]\033[0;31mERROR: " fmt \
"\033[0m\t%s:%d\n", ##arg, \
(char*)(strrchr(__FILE__, '/')+1), __LINE__);\
} while (0)
-#define SETTINGCMD_TRACE_BEGIN do {\
+#define SCTRACE_BEGIN do {\
printf("\n[SETTING]\033[0;35mENTER FUNCTION: %s. \033[0m\t%s:%d\n", \
__FUNCTION__, \
(char*)(strrchr(__FILE__, '/')+1), __LINE__);\
} while (0)
-#define SETTINGCMD_TRACE_END do {\
+#define SCTRACE_END do {\
printf("\n[SETTING]\033[0;35mEXIT FUNCTION: %s. \033[0m\t%s:%d\n", \
__FUNCTION__, \
(char*)(strrchr(__FILE__, '/')+1), __LINE__);\
#else
-#define SETTINGCMD_TRACE(fmt, arg...) do {} while (0)
-#define SETTINGCMD_TRACE_SECURE_DEBUG(fmt, arg...) do {} while (0)
-#define SETTINGCMD_TRACE_DEBUG(fmt, arg...) do {} while (0)
-#define SETTINGCMD_TRACE_WARNING(fmt, arg...) do {} while (0)
-#define SETTINGCMD_TRACE_ERROR(fmt, arg...) do {} while (0)
-#define SETTINGCMD_TRACE_BEGIN do {} while (0)
-#define SETTINGCMD_TRACE_END do {} while (0)
+#define SCTRACE(fmt, arg...) do {} while (0)
+#define SCTRACE_SECURE_DEBUG(fmt, arg...) do {} while (0)
+#define SCTRACE_DEBUG(fmt, arg...) do {} while (0)
+#define SCTRACE_WARNING(fmt, arg...) do {} while (0)
+#define SCTRACE_ERROR(fmt, arg...) do {} while (0)
+#define SCTRACE_BEGIN do {} while (0)
+#define SCTRACE_END do {} while (0)
#endif
#define settingcmd_retvm_if(expr, val, fmt, arg...) do { \
if (expr) { \
- SETTINGCMD_TRACE_ERROR(fmt, ##arg); \
+ SCTRACE_ERROR(fmt, ##arg); \
return (val); \
} \
} while (0)
#define settingcmd_retm_if(expr, fmt, arg...) do { \
if (expr) { \
- SETTINGCMD_TRACE_ERROR(fmt, ##arg); \
+ SCTRACE_ERROR(fmt, ##arg); \
return; \
} \
} while (0)
#ifndef retv_if
#define retv_if(expr, val) do { \
if (expr) { \
- SETTINGCMD_TRACE_ERROR("(%s)", #expr); \
+ SCTRACE_ERROR("(%s)", #expr); \
return (val); \
} \
} while (0)
#ifndef ret_if
#define ret_if(expr) do { \
if (expr) { \
- SETTINGCMD_TRACE_ERROR("(%s)", #expr); \
+ SCTRACE_ERROR("(%s)", #expr); \
return ; \
} \
} while (0)
#ifndef warn_if
#define warn_if(expr, fmt, arg...) do { \
if (expr) { \
- SETTINGCMD_TRACE_ERROR(fmt, ##arg); \
+ SCTRACE_ERROR(fmt, ##arg); \
} \
} while (0)
#endif
#define FREE(arg) __FREE(free, arg)
#define G_FREE(arg) __FREE(g_free, arg)
-
-/////////////////////////////////////////////////////////////////////////////////////
-#include <stdio.h>
-
-//#define __SC_DEBUG__
-
-#ifdef __SC_DEBUG__
-#define eprintf(...) fprintf (stderr, __VA_ARGS__)
-#else
-#define eprintf(...) do {} while (0)
-#endif
-
#endif /* __SCDEBUG_H_ */
bool SCReportMenu::create()
{
-
+ return true;
}
MENURUN_ERROR SCReportMenu::execute(std::string &title, int argc, char *argv[])
{
if (argc < 1) {
- eprintf("argc : %d\n", argc);
+ SCTRACE_DEBUG("argc : %d", argc);
printf("Please give a path of file with report template\n > setting-cmd report [ template file ]\n\n");
return MENURUN_ERR_NORMAL;
}
FILE *pfile = fopen(argv[0], "rb");
if (pfile == NULL) {
- eprintf("fopen failed : %s !\n", argv[0]);
+ SCTRACE_ERROR("fopen failed : %s !", argv[0]);
return MENURUN_ERR_NORMAL;
}
fseek(pfile, 0, SEEK_END);
int fsize = ftell(pfile);
fseek(pfile, 0, SEEK_SET);
- eprintf("fsize : %d\n", fsize);
+ SCTRACE_DEBUG("fsize : %d", fsize);
int numread = fread(reportTemplate, sizeof(char), fsize, pfile);
if (numread != fsize) {
- eprintf("numread != fsize : %d\n", numread);
+ SCTRACE_DEBUG("numread != fsize : %d", numread);
fclose(pfile);
return MENURUN_ERR_NORMAL;
}
GenSettingMenu mainMenu("setting-cmd", "Main Menu", nullptr, nullptr, MainMemu_Precreate);
if (!mainMenu.create()) {
- eprintf("Main Menu failed to create\n");
+ SCTRACE_DEBUG("Main Menu failed to create");
return MENURUN_ERR_NORMAL;
}
int ret = system_info_get_platform_string("tizen.org/feature/profile", &profile_str);
if (ret != SYSTEM_INFO_ERROR_NONE) {
- eprintf("ERROR!! failed profile info from system info API \n");
+ SCTRACE_ERROR("ERROR!! failed profile info from system info API");
if (profile_str)
free((void*)profile_str);
return MOBILE_PROFILE; /* default value return */
if (profile_str == nullptr)
return MOBILE_PROFILE;
- eprintf("Profile : %s\n", profile_str);
+ SCTRACE_DEBUG("Profile : %s", profile_str);
if (!strcmp(profile_str, "mobile")) {
profile = MOBILE_PROFILE;
SettingCommand::SettingCommand(string& execstr, string& commandstr)
{
- eprintf("Entered into SettingCommand()\n");
+ SCTRACE_DEBUG("Entered into SettingCommand()");
string token = execstr;
stringstream ss_exec(execstr);
settingCommands.push_back(token);
stringstream ss_cmd(commandstr);
- eprintf("%s %s (", execstr.c_str(), commandstr.c_str());
while (getline(ss_cmd, token, '/')) {
- eprintf(" %s", token.c_str());
settingCommands.push_back(token);
}
- eprintf(")\n");
curPos = 0;
}
bool SettingMenu::create()
{
- eprintf("entered in SettingMenu::create() of %s\n", name());
+ SCTRACE_DEBUG("entered in SettingMenu::create() of %s", name());
for (auto it = subMenus.begin(); it != subMenus.end(); ++it) {
if (!(*it)->create()) {
destroy();
MENURUN_ERROR SettingMenu::execute(string &title, int argc, char *argv[])
{
- eprintf("execute() of %s\n", name());
+ SCTRACE_DEBUG("execute() of %s", name());
return MENURUN_ERR_NONE;
}
MENURUN_ERROR SettingMenu::value(string &resultstr, int argc, char *argv[])
{
- eprintf("value() of %s\n", name());
+ SCTRACE_DEBUG("value() of %s", name());
resultstr = string("[N/A]");
return MENURUN_ERR_NONE;
}
MENURUN_ERROR SettingMenu::run(SettingCommand &settingcmds, string &title, int argc, char *argv[])
{
- eprintf("run() of %s\n", name());
+ SCTRACE_DEBUG("run() of %s", name());
title += string(" - ") + name();
MENURUN_ERROR result = execute(title, argc, argv);
}
);
if (it == subMenus.end()) {
- eprintf("%s is not a valid command.\n\n", curcmd.c_str());
+ SCTRACE_ERROR("%s is not a valid command.", curcmd.c_str());
printUsage(settingcmds);
settingcmds.prev();
return MENURUN_ERR_ARG_INVAILD;
}
- eprintf("command %s is founded.\n", curcmd.c_str());
+ SCTRACE_DEBUG("command %s is founded.", curcmd.c_str());
result = ((*it)->run)(settingcmds, title, argc, argv);
settingcmds.prev();
MENURUN_ERROR SettingMenu::query(string &resultstr, SettingCommand &settingcmds, int argc, char *argv[])
{
- eprintf("query() of %s\n", name());
+ SCTRACE_DEBUG("query() of %s", name());
if (subMenus.empty()) {
MENURUN_ERROR result = value(resultstr, argc, argv);
}
);
if (it == subMenus.end()) {
- eprintf("%s is not a valid command.\n\n", curcmd.c_str());
+ SCTRACE_ERROR("%s is not a valid command.", curcmd.c_str());
settingcmds.prev();
return MENURUN_ERR_ARG_INVAILD;
}
- eprintf("command %s is founded.\n", curcmd.c_str());
+ SCTRACE_DEBUG("command %s is founded.", curcmd.c_str());
MENURUN_ERROR result = ((*it)->query)(resultstr, settingcmds, argc, argv);
settingcmds.prev();
void SettingMenu::printError(MENURUN_ERROR error)
{
- eprintf("[SettingMenu Error] ");
+ const char *errorheader = "[SettingMenu Error]";
switch (error) {
case MENURUN_ERR_NORMAL:
- eprintf("Normal error");
+ SCTRACE_DEBUG("%s Normal error", errorheader);
break;
case MENURUN_ERR_ARG_SHORT:
- eprintf("Lack of arguments");
+ SCTRACE_DEBUG("%s Lack of arguments",errorheader);
break;
case MENURUN_ERR_ARG_INVAILD:
- eprintf("Invalid argument");
+ SCTRACE_DEBUG("%s Invalid argument", errorheader);
break;
case MENURUN_ERR_NOTIMPL:
- eprintf("Not implemented");
+ SCTRACE_DEBUG("%s Not implemented", errorheader);
break;
default:
break;
}
- eprintf("\n");
}
mainMenu.subMenus.push_back(new SCReportMenu());
if (!mainMenu.create()) {
- eprintf("Main Menu failed to create\n");
+ SCTRACE_DEBUG("Main Menu failed to create");
return 0;
}
static bool __get_phone_model_name(char *szStr, int nSize)
{
if (szStr == nullptr) {
- eprintf("szStr parameter is nullptr\n");
+ SCTRACE_ERROR("szStr parameter is nullptr");
return false;
}
"http://tizen.org/system/model_name", &value);
if (ret != SYSTEM_INFO_ERROR_NONE) {
FREE(value);
- eprintf("fail to call system_info_get_platform_string");
+ SCTRACE_ERROR("fail to call system_info_get_platform_string");
snprintf(szStr, nSize, "%s", "Unavailable");
return false;
}
static bool __get_sw_version(char *szStr, int nSize)
{
if (szStr == nullptr) {
- eprintf("szStr parameter is nullptr\n");
+ SCTRACE_ERROR("szStr parameter is nullptr");
return false;
}
"http://tizen.org/feature/platform.version", &version);
if (ret != SYSTEM_INFO_ERROR_NONE) {
FREE(version);
- eprintf("fail to call system_info_get_platform_string");
+ SCTRACE_ERROR("fail to call system_info_get_platform_string");
snprintf(szStr, nSize, "%s", "Unavailable");
return false;
}
"http://tizen.org/system/platform.processor", &cpu_name);
if (SYSTEM_INFO_ERROR_NONE != ret) {
FREE(cpu_name);
- eprintf("fail to call system_info_get_platform_string");
+ SCTRACE_ERROR("fail to call system_info_get_platform_string");
snprintf(szStr, nSize, "%s", "Unavailable");
return false;
}
{
telephony_handle_list_s tel_h_list;
if (telephony_init(&tel_h_list) != TELEPHONY_ERROR_NONE) {
- eprintf("telephony_init failed");
+ SCTRACE_ERROR("telephony_init failed");
return false;
}
if ((int)tel_h_list.count < sim_number-1) {
- eprintf("\tThere is no SIM%d card\n", sim_number);
+ SCTRACE_ERROR("\tThere is no SIM%d card", sim_number);
if (telephony_deinit(&tel_h_list) != TELEPHONY_ERROR_NONE) {
- eprintf("telephony_deinit failed");
+ SCTRACE_ERROR("telephony_deinit failed");
return false;
}
return false;
char *phone_num = nullptr;
int ret = telephony_sim_get_subscriber_number(tel_h_list.handle[sim_number-1], &phone_num);
if (ret != 0 || phone_num == nullptr) {
- eprintf("\tThere is no SIM%d card, ret:%d phone_num addr:0x%x\n", sim_number, ret, (unsigned int)phone_num);
+ SCTRACE_ERROR("\tThere is no SIM%d card, ret:%d phone_num addr:0x%x", sim_number, ret, (unsigned int)phone_num);
if (telephony_deinit(&tel_h_list) != TELEPHONY_ERROR_NONE) {
- eprintf("telephony_deinit failed");
+ SCTRACE_ERROR("telephony_deinit failed");
return false;
}
return false;
free(phone_num);
if (telephony_deinit(&tel_h_list) != TELEPHONY_ERROR_NONE) {
- eprintf("telephony_deinit failed");
+ SCTRACE_ERROR("telephony_deinit failed");
return false;
}
{
telephony_handle_list_s tel_h_list;
if (telephony_init(&tel_h_list) != TELEPHONY_ERROR_NONE) {
- eprintf("telephony_init failed");
+ SCTRACE_ERROR("telephony_init failed");
return false;
}
if ((int)tel_h_list.count < sim_number-1) {
printf("\tThere is no SIM%d card\n", sim_number);
if (telephony_deinit(&tel_h_list) != TELEPHONY_ERROR_NONE) {
- eprintf("telephony_deinit failed");
+ SCTRACE_ERROR("telephony_deinit failed");
return false;
}
return false;
if (ret != 0 || ime_buffer == nullptr) {
printf("\tThere is no SIM%d card, ret:%d ime_buffer addr:0x%x\n", sim_number, ret, (unsigned int)ime_buffer);
if (telephony_deinit(&tel_h_list) != TELEPHONY_ERROR_NONE) {
- eprintf("telephony_deinit failed");
+ SCTRACE_ERROR("telephony_deinit failed");
return false;
}
return false;
free(ime_buffer);
if (telephony_deinit(&tel_h_list) != TELEPHONY_ERROR_NONE) {
- eprintf("telephony_deinit failed");
+ SCTRACE_ERROR("telephony_deinit failed");
return false;
}
snprintf(errmsg, sizeof(errmsg), "Bluetooth is disabled!\n");
else
snprintf(errmsg, sizeof(errmsg), "Bluetooth is unavailable!\n");
- eprintf("Fail to get BT address, error code: %s\n", errmsg);
+ SCTRACE_ERROR("Fail to get BT address, error code: %s", errmsg);
free(local_address);
return MENURUN_ERR_NORMAL;
}
if (ret != WIFI_MANAGER_ERROR_NONE && mac_addr) {
char errmsg[200];
snprintf(errmsg, sizeof(errmsg), "WIFI is unavailable!\n");
- eprintf("Fail to get WIFI address, error code: %s\n", errmsg);
+ SCTRACE_ERROR("Fail to get WIFI address, error code: %s", errmsg);
return MENURUN_ERR_NORMAL;
}
struct statvfs external;
if (storage_get_internal_memory_size(&internal) < 0) {
- eprintf("Fail to get internal memory size\n");
+ SCTRACE_ERROR("Fail to get internal memory size");
return MENURUN_ERR_NORMAL;
}
total = (long long int)internal.f_frsize
* (long long int)internal.f_bavail;
if (storage_get_external_memory_size(&external) < 0) {
- eprintf("Fail to get external memory size\n");
+ SCTRACE_ERROR("Fail to get external memory size");
}
else {
total += (long long int)external.f_frsize
/* check if values are appropriate*/
if (total < 0 || avail < 0 || total < avail) {
- eprintf("Fail to get internal memory size\n");
+ SCTRACE_ERROR("Fail to get internal memory size");
return MENURUN_ERR_NORMAL;
}
int fd = open(file, O_RDONLY);
if (fd == -1) {
- eprintf("open file fail\n");
+ SCTRACE_ERROR("open file fail");
return MENURUN_ERR_NORMAL;
}
char buf[MAX_DISPLAY_STR_LEN_ON_PHONE_INFO] = { '\0', };
int r = read(fd, buf, MAX_DISPLAY_STR_LEN_ON_PHONE_INFO);
if (r < 0 || r >= MAX_DISPLAY_STR_LEN_ON_PHONE_INFO) {
- eprintf("read file fail\n");
+ SCTRACE_ERROR("read file fail");
close(fd);
return MENURUN_ERR_NORMAL;
}
FILE *fp = fopen(SETTING_ABOUT_STAT_PATH, "r");
if (fp == nullptr) {
- eprintf("fp == nullptr\n");
+ SCTRACE_ERROR("fp == nullptr");
return -ENOENT;
}
char *cpu_info_p = fgets(cpu_info, MAX_COMMON_BUFFER_LEN, fp);
if (cpu_info_p == nullptr) {
- eprintf("fgets failed\n");
+ SCTRACE_ERROR("fgets failed");
fclose(fp); /* free - code */
return -ENOENT;
}
void precreate_ad(GenSettingMenu *menu)
{
- eprintf("entered precreate_ad\n");
+ SCTRACE_ERROR("entered precreate_ad");
menu->destroy();
menu->addSubmenus(ad_menulist, sizeof(ad_menulist) / sizeof(MenuItem));
}
int ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE, &ret_state);
if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
- eprintf("\tFlight mode get fail\n");
+ SCTRACE_ERROR("\tFlight mode get fail");
return MENURUN_ERR_NORMAL;
}
void precreate_am(GenSettingMenu *menu)
{
- eprintf("entered precreate_am\n");
+ SCTRACE_DEBUG("entered precreate_am");
menu->destroy();
menu->addSubmenus(am_menulist, sizeof(am_menulist) / sizeof(MenuItem));
}
Eina_List *apps;
ret = app_manager_foreach_app_info(_app_info_cb, &apps);
if (APP_MANAGER_ERROR_NONE != ret) {
- eprintf("app_manager_foreach_app_info() Fail(%s)", get_error_message(ret));
+ SCTRACE_ERROR("app_manager_foreach_app_info() Fail(%s)", get_error_message(ret));
}
apps = appmgr_utils_sort_apps_list(g_sorttype, apps);
void precreate_apps(GenSettingMenu *menu)
{
- eprintf("entered precreate_apps\n");
+ SCTRACE_DEBUG("entered precreate_apps");
menu->destroy();
menu->addSubmenus(apps_menulist, sizeof(apps_menulist) / sizeof(MenuItem));
}
ret = context_history_create(&handle);
if (ret != CONTEXT_HISTORY_ERROR_NONE) {
- eprintf("\tcontext_history_create(): %s\n", get_error_message(ret));
+ SCTRACE_ERROR("\tcontext_history_create(): %s", get_error_message(ret));
goto cleanup;
}
ret = context_history_filter_create(&filter);
if (ret != CONTEXT_HISTORY_ERROR_NONE) {
- eprintf("\tcontext_history_filter_create(): %s\n",
+ SCTRACE_ERROR("\tcontext_history_filter_create(): %s",
get_error_message(ret));
goto cleanup;
}
ret = context_history_get_list(handle,
CONTEXT_HISTORY_RECENT_BATTERY_USAGE, filter, &list);
if (ret != CONTEXT_HISTORY_ERROR_NONE) {
- eprintf("\tcontext_history_get_list(): %s\n", get_error_message(ret));
+ SCTRACE_ERROR("\tcontext_history_get_list(): %s", get_error_message(ret));
goto cleanup;
}
val = atoi(buf);
snprintf(str, sizeof(str), "%d %%", val);
} else {
- eprintf("read file fail\n");
+ SCTRACE_ERROR("read file fail");
snprintf(str, sizeof(str), "%s unavailable!\n", SETTING_ABOUT_POWER_SUPPLY_PATH);
}
printf("\tBattery percentage : ");
printf("%s\n\n", str);
} else {
- eprintf("open file fail\n");
+ SCTRACE_ERROR("open file fail");
snprintf(str, sizeof(str), "%s unavailable!\n", SETTING_ABOUT_POWER_SUPPLY_PATH);
}
static MENURUN_ERROR menugetstring_bt_st(string &resultstr, int argc, char *argv[], GenSettingMenu *menu)
{
if (bt_initialize() != BT_ERROR_NONE) {
- eprintf("bt_initialize() failed\n");
+ SCTRACE_ERROR("bt_initialize() failed");
return MENURUN_ERR_NORMAL;
}
bt_adapter_state_e bt_state;
if (bt_adapter_get_state(&bt_state) != BT_ERROR_NONE) {
- eprintf("bt_adapter_get_state() failed\n");
+ SCTRACE_ERROR("bt_adapter_get_state() failed");
bt_deinitialize();
return MENURUN_ERR_NORMAL;
}
void precreate_bt(GenSettingMenu *menu)
{
- eprintf("entered precreate_bt\n");
+ SCTRACE_DEBUG("entered precreate_bt");
menu->destroy();
menu->addSubmenus(bt_menulist, sizeof(bt_menulist) / sizeof(MenuItem));
}
int ret = stc_stats_rule_create(stc, &rule);
if (ret != STC_ERROR_NONE) {
- SETTINGCMD_TRACE_ERROR("stc_stats_rule_create() error: %s",
+ SCTRACE_ERROR("stc_stats_rule_create() error: %s",
get_error_message(ret));
stc_stats_rule_destroy(rule);
return true;
ret = stc_stats_rule_set_time_interval(rule, t_from, t_to);
if (ret != STC_ERROR_NONE) {
- SETTINGCMD_TRACE_ERROR("stc_stats_rule_set_time_interval() error: %s",
+ SCTRACE_ERROR("stc_stats_rule_set_time_interval() error: %s",
get_error_message(ret));
stc_stats_rule_destroy(rule);
return true;
ret = stc_stats_rule_set_iface_type(rule, iface);
if (ret != STC_ERROR_NONE) {
- SETTINGCMD_TRACE_ERROR("stc_stats_rule_set_iface_type() error: %s",
+ SCTRACE_ERROR("stc_stats_rule_set_iface_type() error: %s",
get_error_message(ret));
stc_stats_rule_destroy(rule);
return true;
}
- SETTINGCMD_TRACE_DEBUG("\033[1;33mObtaining per app data usage for ifce: %d",
+ SCTRACE_DEBUG("\033[1;33mObtaining per app data usage for ifce: %d",
iface);
ret = stc_foreach_stats(stc, rule, stats_cb, cb_data);
if (ret != STC_ERROR_NONE) {
- SETTINGCMD_TRACE_ERROR("stc_get_stats() error: %s",
+ SCTRACE_ERROR("stc_get_stats() error: %s",
get_error_message(ret));
if (STC_ERROR_IN_PROGRESS == ret) {
stc_stats_rule_destroy(rule);
ret = stc_stats_rule_create(stc, &rule);
if (ret != STC_ERROR_NONE) {
- SETTINGCMD_TRACE_ERROR("stc_stats_rule_create() error: %s",
+ SCTRACE_ERROR("stc_stats_rule_create() error: %s",
get_error_message(ret));
return true;
}
ret = stc_stats_rule_set_time_interval(rule, t_from, t_to);
if (ret != STC_ERROR_NONE) {
- SETTINGCMD_TRACE_ERROR("stc_stats_rule_set_time_interval() error: %s",
+ SCTRACE_ERROR("stc_stats_rule_set_time_interval() error: %s",
get_error_message(ret));
(void)stc_stats_rule_destroy(rule);
return true;
ret = stc_stats_rule_set_iface_type(rule, iface_type);
if (ret != STC_ERROR_NONE) {
- SETTINGCMD_TRACE_ERROR("stc_stats_rule_set_iface_type() error: %s",
+ SCTRACE_ERROR("stc_stats_rule_set_iface_type() error: %s",
get_error_message(ret));
(void)stc_stats_rule_destroy(rule);
return true;
}
- SETTINGCMD_TRACE_DEBUG("\033[1;34mObtaining total stats for ifce: %d",
+ SCTRACE_DEBUG("\033[1;34mObtaining total stats for ifce: %d",
iface_type);
ret = stc_get_total_stats(stc, rule, stats_cb, cb_data);
if (ret != STC_ERROR_NONE) {
- SETTINGCMD_TRACE_ERROR("stc_get_total_stats() error: %s",
+ SCTRACE_ERROR("stc_get_total_stats() error: %s",
get_error_message(ret));
(void)stc_stats_rule_destroy(rule);
if (STC_ERROR_IN_PROGRESS == ret)
ret = stc_restriction_rule_create(stc, &rule);
if (STC_ERROR_NONE != ret) {
- SETTINGCMD_TRACE_ERROR("stc_restriction_rule_create() error: %s",
+ SCTRACE_ERROR("stc_restriction_rule_create() error: %s",
get_error_message(ret));
return true;
}
ret = stc_restriction_rule_set_app_id(rule, "TOTAL_WIFI");
if (STC_ERROR_NONE != ret) {
- SETTINGCMD_TRACE_ERROR("stc_restriction_rule_set_app_id() error: %s",
+ SCTRACE_ERROR("stc_restriction_rule_set_app_id() error: %s",
get_error_message(ret));
stc_restriction_rule_destroy(rule);
return true;
ret = stc_restriction_rule_set_iface_type(rule, iface_type);
if (STC_ERROR_NONE != ret) {
- SETTINGCMD_TRACE_ERROR("stc_restriction_rule_get_iface_type() error: %s",
+ SCTRACE_ERROR("stc_restriction_rule_get_iface_type() error: %s",
get_error_message(ret));
stc_restriction_rule_destroy(rule);
return true;
}
- SETTINGCMD_TRACE_DEBUG("\033[1;35mObtaining restrictions for iface: %d",
+ SCTRACE_DEBUG("\033[1;35mObtaining restrictions for iface: %d",
iface_type);
ret = stc_foreach_restriction(stc, rule, restrictions_cb,
restriction_info_cb_data);
if (STC_ERROR_NONE != ret) {
- SETTINGCMD_TRACE_ERROR("SIM stc_foreach_restriction() error: %s",
+ SCTRACE_ERROR("SIM stc_foreach_restriction() error: %s",
get_error_message(ret));
(void)stc_restriction_rule_destroy(rule);
if (STC_ERROR_IN_PROGRESS == ret)
ret = telephony_sim_get_subscriber_id(handle, subscriber_id);
if (TELEPHONY_ERROR_NONE != ret) {
- SETTINGCMD_TRACE_ERROR("telephony_sim_get_msin(%p) %s",
+ SCTRACE_ERROR("telephony_sim_get_msin(%p) %s",
handle, get_error_message(ret));
return false;
}
int64_t limit,
int64_t warning_limit)
{
- SETTINGCMD_TRACE_BEGIN;
+ SCTRACE_BEGIN;
int ret = STC_ERROR_NONE;
ret = stc_restriction_rule_set_app_id(rule, "TOTAL_DATACALL");
if (STC_ERROR_NONE != ret) {
(void)stc_restriction_rule_destroy(rule);
- SETTINGCMD_TRACE_ERROR("stc_restriction_rule_set_app_id() error: %s",
+ SCTRACE_ERROR("stc_restriction_rule_set_app_id() error: %s",
get_error_message(ret));
return RESTRICTIONS_ERROR;
}
ret = stc_restriction_rule_set_iface_type(rule, STC_IFACE_DATACALL);
if (STC_ERROR_NONE != ret) {
(void)stc_restriction_rule_destroy(rule);
- SETTINGCMD_TRACE_ERROR("stc_restriction_rule_set_iface_type() error: %s",
+ SCTRACE_ERROR("stc_restriction_rule_set_iface_type() error: %s",
get_error_message(ret));
return RESTRICTIONS_ERROR;
}
ret = stc_restriction_rule_set_subscriber_id(rule, subscriber_id);
if (STC_ERROR_NONE != ret) {
(void)stc_restriction_rule_destroy(rule);
- SETTINGCMD_TRACE_ERROR("stc_restriction_rule_set_subscriber_id() error:"\
+ SCTRACE_ERROR("stc_restriction_rule_set_subscriber_id() error:"\
"%s", get_error_message(ret));
return RESTRICTIONS_ERROR;
ret = stc_restriction_rule_set_limit(rule, limit);
if (STC_ERROR_NONE != ret) {
(void)stc_restriction_rule_destroy(rule);
- SETTINGCMD_TRACE_ERROR("stc_restriction_rule_set_limit() error: %s",
+ SCTRACE_ERROR("stc_restriction_rule_set_limit() error: %s",
get_error_message(ret));
return RESTRICTIONS_ERROR;
}
ret = stc_restriction_rule_set_warning_limit(rule, warning_limit);
if (STC_ERROR_NONE != ret) {
(void)stc_restriction_rule_destroy(rule);
- SETTINGCMD_TRACE_ERROR(
+ SCTRACE_ERROR(
"stc_restriction_rule_set_warning_limit() error: %s",
get_error_message(ret));
return RESTRICTIONS_ERROR;
}
- SETTINGCMD_TRACE_END;
+ SCTRACE_END;
return RESTRICTIONS_OK;
}
restrictions_result set_mobile_limit_restrictions(stc_h stc_handle,
const char *subscriber_id, int64_t limit, int64_t warning_limit)
{
- SETTINGCMD_TRACE_BEGIN;
+ SCTRACE_BEGIN;
int ret = STC_ERROR_NONE;
stc_restriction_rule_h rule = nullptr;
restrictions_result result = RESTRICTIONS_OK;
ret = stc_restriction_rule_create(stc_handle, &rule);
if (STC_ERROR_NONE != ret) {
- SETTINGCMD_TRACE_ERROR("stc_restriction_rule_create() error: %s",
+ SCTRACE_ERROR("stc_restriction_rule_create() error: %s",
get_error_message(ret));
return RESTRICTIONS_ERROR;
}
result = set_mobile_restriction_rule_parameters(rule, subscriber_id, limit,
warning_limit);
if (RESTRICTIONS_OK != result) {
- SETTINGCMD_TRACE_ERROR("set_restriction_rule_parameters() error");
+ SCTRACE_ERROR("set_restriction_rule_parameters() error");
return result;
}
ret = stc_set_restriction(stc_handle, rule);
if (STC_ERROR_NONE != ret) {
(void)stc_restriction_rule_destroy(rule);
- SETTINGCMD_TRACE_ERROR("stc_set_restriction() error: %s",
+ SCTRACE_ERROR("stc_set_restriction() error: %s",
get_error_message(ret));
return RESTRICTIONS_ERROR;
}
(void)stc_restriction_rule_destroy(rule);
- SETTINGCMD_TRACE_END;
+ SCTRACE_END;
return RESTRICTIONS_OK;
}
restrictions_result restrictions_res = RESTRICTIONS_ERROR;
if (!user_data) {
- SETTINGCMD_TRACE_ERROR("_get_restrictions_to_unset_cb error: user_data == nullptr");
+ SCTRACE_ERROR("_get_restrictions_to_unset_cb error: user_data == nullptr");
g_main_loop_quit(multi_main_loop);
return STC_CALLBACK_CONTINUE;
}
stc_h stc = *((stc_h *)user_data);
- SETTINGCMD_TRACE_DEBUG("_get_restrictions_to_unset_cb:");
+ SCTRACE_DEBUG("_get_restrictions_to_unset_cb:");
if (STC_ERROR_NONE != result) {
- SETTINGCMD_TRACE_ERROR("_get_restrictions_to_unset_cb error: %s",
+ SCTRACE_ERROR("_get_restrictions_to_unset_cb error: %s",
get_error_message(result));
g_main_loop_quit(multi_main_loop);
return STC_CALLBACK_CONTINUE;
ret = stc_restriction_rule_get_type(rule, &type);
if (STC_ERROR_NONE != ret) {
- SETTINGCMD_TRACE_ERROR("stc_restriction_rule_get_type error: %s",
+ SCTRACE_ERROR("stc_restriction_rule_get_type error: %s",
get_error_message(ret));
g_main_loop_quit(multi_main_loop);
return STC_CALLBACK_CONTINUE;
ret = stc_restriction_rule_get_iface_type(rule, &iface_type);
if (STC_ERROR_NONE != ret) {
- SETTINGCMD_TRACE_ERROR("stc_restriction_rule_get_iface_type error: %s",
+ SCTRACE_ERROR("stc_restriction_rule_get_iface_type error: %s",
get_error_message(ret));
g_main_loop_quit(multi_main_loop);
return STC_CALLBACK_CONTINUE;
ret = stc_restriction_rule_get_subscriber_id(rule, &subscriber_id);
if (STC_ERROR_NONE != ret) {
- SETTINGCMD_TRACE_ERROR("stc_restriction_rule_get_subscriber_id error: %s",
+ SCTRACE_ERROR("stc_restriction_rule_get_subscriber_id error: %s",
get_error_message(ret));
g_main_loop_quit(multi_main_loop);
return STC_CALLBACK_CONTINUE;
ret = stc_restriction_rule_get_limit(rule, &limit);
if (STC_ERROR_NONE != ret) {
- SETTINGCMD_TRACE_ERROR("stc_restriction_rule_get_limit() error: %s",
+ SCTRACE_ERROR("stc_restriction_rule_get_limit() error: %s",
get_error_message(ret));
free(subscriber_id);
g_main_loop_quit(multi_main_loop);
ret = stc_restriction_rule_get_warning_limit(rule, &warning_limit);
if (STC_ERROR_NONE != ret) {
- SETTINGCMD_TRACE_ERROR(
+ SCTRACE_ERROR(
"stc_restriction_rule_get_warning_limit() error: %s",
get_error_message(ret));
free(subscriber_id);
ret = stc_restriction_rule_create(stc, &mobile_rule);
if (STC_ERROR_NONE != ret) {
- SETTINGCMD_TRACE_ERROR("stc_restriction_rule_create() error: %s",
+ SCTRACE_ERROR("stc_restriction_rule_create() error: %s",
get_error_message(ret));
free(subscriber_id);
g_main_loop_quit(multi_main_loop);
restrictions_res = set_mobile_restriction_rule_parameters(mobile_rule,
subscriber_id, limit, warning_limit);
if (restrictions_res != RESTRICTIONS_OK) {
- SETTINGCMD_TRACE_ERROR(
+ SCTRACE_ERROR(
"set_mobile_restriction_rule_parameters() error");
free(subscriber_id);
g_main_loop_quit(multi_main_loop);
ret = stc_unset_restriction(stc, mobile_rule);
if (STC_ERROR_NONE != ret) {
- SETTINGCMD_TRACE_ERROR("stc_unset_restriction() error: %s",
+ SCTRACE_ERROR("stc_unset_restriction() error: %s",
get_error_message(ret));
free(subscriber_id);
g_main_loop_quit(multi_main_loop);
}
free(subscriber_id);
- SETTINGCMD_TRACE_ERROR(
+ SCTRACE_ERROR(
"stc_unset_restriction() successful unset restriction");
g_main_loop_quit(multi_main_loop);
return STC_CALLBACK_CONTINUE;
break;
case CYCLE_MODE_CUSTOM:
if (limits->custom_mode_interval <= 0) {
- SETTINGCMD_TRACE_ERROR("Error: custom mode interval is %d",
+ SCTRACE_ERROR("Error: custom mode interval is %d",
limits->custom_mode_interval);
return;
}
int ret = STC_ERROR_NONE;
stc_iface_type_e iface_type = STC_IFACE_UNKNOWN;
- SETTINGCMD_TRACE_DEBUG("total stats cb, looking for subscriber id: %s",
+ SCTRACE_DEBUG("total stats cb, looking for subscriber id: %s",
subscriber_id_to_look_for);
if (STC_ERROR_NONE != result) {
- SETTINGCMD_TRACE_ERROR("Error in cb: %s", get_error_message(result));
+ SCTRACE_ERROR("Error in cb: %s", get_error_message(result));
g_main_loop_quit(multi_main_loop);
return STC_CALLBACK_CANCEL;
}
ret = stc_stats_info_get_iface_type(info, &iface_type);
if (STC_ERROR_NONE != ret) {
- SETTINGCMD_TRACE_ERROR("get interface error: %s", get_error_message(ret));
- eprintf(" There is no data usage.\n");
+ SCTRACE_ERROR("get interface error: %s", get_error_message(ret));
+ SCTRACE_DEBUG(" There is no data usage.");
g_main_loop_quit(multi_main_loop);
return STC_CALLBACK_CANCEL;
}
- SETTINGCMD_TRACE_DEBUG("Obtained iface: %d", iface_type);
+ SCTRACE_DEBUG("Obtained iface: %d", iface_type);
ret = stc_stats_info_get_counter(info, &incoming, &outgoing);
if (STC_ERROR_NONE == ret) {
subscriber_id_to_look_for)
) {
- SETTINGCMD_TRACE_DEBUG("Obtained SUBSCRIBER ID: %s",
+ SCTRACE_DEBUG("Obtained SUBSCRIBER ID: %s",
subscriber_id);
printf(" total in: %lld byte out: %lld byte\n", incoming, outgoing);
} else {
- SETTINGCMD_TRACE_ERROR("stc_stats_info_get_subscriber_id() error: %s",
+ SCTRACE_ERROR("stc_stats_info_get_subscriber_id() error: %s",
get_error_message(ret));
}
free(subscriber_id);
printf(" total in: %lld byte out: %lld byte\n", incoming, outgoing);
}
} else {
- SETTINGCMD_TRACE_ERROR("get counter error: %s", get_error_message(ret));
+ SCTRACE_ERROR("get counter error: %s", get_error_message(ret));
g_main_loop_quit(multi_main_loop);
return STC_CALLBACK_CANCEL;
}
stc_iface_type_e iface_type = STC_IFACE_UNKNOWN;
stc_restriction_type_e type = STC_RSTN_TYPE_UNKNOWN;
- SETTINGCMD_TRACE_DEBUG("restriction cb:");
+ SCTRACE_DEBUG("restriction cb:");
if (STC_ERROR_NONE != result) {
- SETTINGCMD_TRACE_ERROR("_get_restrictions_cb error: %s",
+ SCTRACE_ERROR("_get_restrictions_cb error: %s",
get_error_message(result));
g_main_loop_quit(multi_main_loop);
return STC_CALLBACK_CONTINUE;
g_main_loop_quit(multi_main_loop);
return STC_CALLBACK_CONTINUE;
}
- SETTINGCMD_TRACE_DEBUG("Obtaining restrictions for: %s", app_id);
+ SCTRACE_DEBUG("Obtaining restrictions for: %s", app_id);
free(app_id);
ret = stc_restriction_rule_get_type(rule, &type);
if (STC_ERROR_NONE != ret) {
- SETTINGCMD_TRACE_ERROR("stc_restriction_rule_get_type error: %s",
+ SCTRACE_ERROR("stc_restriction_rule_get_type error: %s",
get_error_message(ret));
g_main_loop_quit(multi_main_loop);
return STC_CALLBACK_CONTINUE;
}
(void)stc_restriction_rule_get_iface_type(rule, &iface_type);
- SETTINGCMD_TRACE_DEBUG("Obtained iface: %d", iface_type);
+ SCTRACE_DEBUG("Obtained iface: %d", iface_type);
if (iface_type == STC_IFACE_DATACALL) {
ret = stc_restriction_rule_get_subscriber_id(rule, &subscriber_id);
if (STC_ERROR_NONE == ret) {
- SETTINGCMD_TRACE_DEBUG("Obtained Subscriber ID: %s", subscriber_id);
+ SCTRACE_DEBUG("Obtained Subscriber ID: %s", subscriber_id);
int64_t limit_size = 0;
int64_t warning_size = 0;
stc_restriction_rule_get_limit(rule, &limit_size);
printf("\t warning_size : %s %s\n", buf, unit_s);
SIM++;
} else {
- SETTINGCMD_TRACE_ERROR("stc_stats_rule_get_subscriber_id() error: %s",
+ SCTRACE_ERROR("stc_stats_rule_get_subscriber_id() error: %s",
get_error_message(ret));
}
free(subscriber_id);
ret = stc_initialize(&stc);
if (ret != STC_ERROR_NONE) {
- eprintf("stc_initialize() error: %s\n", get_error_message(ret));
+ SCTRACE_ERROR("stc_initialize() error: %s\n", get_error_message(ret));
return MENURUN_ERR_NORMAL;
}
static MENURUN_ERROR menufunc_du_smwl(int argc, char *argv[], GenSettingMenu *menu)
{
if (argc < 2) {
- eprintf("Too short to execute this menu\n");
+ SCTRACE_ERROR("Too short to execute this menu");
printf("First argument = warning(MB)\n");
printf("Second argument = limit(MB)\n");
if (telephony_init(&tel_h_list) != TELEPHONY_ERROR_NONE) {
- eprintf("telephony_init failed");
+ SCTRACE_ERROR("telephony_init failed");
return MENURUN_ERR_NORMAL;
}
if (tel_h_list.count < 0) {
printf("\tThere is no SIM card\n");
if (telephony_deinit(&tel_h_list) != TELEPHONY_ERROR_NONE) {
- eprintf("telephony_deinit failed");
+ SCTRACE_ERROR("telephony_deinit failed");
return MENURUN_ERR_NORMAL;
}
return MENURUN_ERR_NORMAL;
ret = stc_initialize(&stc);
if (ret != STC_ERROR_NONE) {
- eprintf("stc_initialize() error: %s\n", get_error_message(ret));
+ SCTRACE_ERROR("stc_initialize() error: %s", get_error_message(ret));
return MENURUN_ERR_NORMAL;
}
int available_sim = 0;
tel_h_list.handle[i], &subscriber_id[i]);
if (ret == 0) {
- eprintf("get_subscriber_id_from_telephony_handle error! sim(%d) %d", i, ret);
+ SCTRACE_DEBUG("get_subscriber_id_from_telephony_handle error! sim(%d) %d", i, ret);
continue;
}
if (!limit && !warning) {
stc_deinitialize(stc);
if (telephony_deinit(&tel_h_list) != TELEPHONY_ERROR_NONE) {
- eprintf("telephony_deinit failed");
+ SCTRACE_DEBUG("telephony_deinit failed");
return MENURUN_ERR_NORMAL;
}
static MENURUN_ERROR menufunc_du_mo(int argc, char *argv[], GenSettingMenu *menu)
{
- eprintf("[menufunc_du_mo] arguments %d : %s %s\n", argc, argv[0], argv[1]);
+ SCTRACE_DEBUG("[menufunc_du_mo] arguments %d : %s %s", argc, argv[0], argv[1]);
if (argc < 2) {
- eprintf("Too short to execute this function\n");
+ SCTRACE_ERROR("Too short to execute this function");
printf("First argument = cycle mode, below.\n");
printf("CYCLE_MODE_MONTHLY = 0\n");
stc_h stc;
int ret = 0;
if (telephony_init(&tel_h_list) != TELEPHONY_ERROR_NONE) {
- eprintf("telephony_init failed");
+ SCTRACE_ERROR("telephony_init failed");
return MENURUN_ERR_NORMAL;
}
if (tel_h_list.count < 0) {
printf("\tThere is no SIM card\n");
if (telephony_deinit(&tel_h_list) != TELEPHONY_ERROR_NONE) {
- eprintf("telephony_deinit failed");
+ SCTRACE_ERROR("telephony_deinit failed");
return MENURUN_ERR_NORMAL;
}
return MENURUN_ERR_NORMAL;
ret = stc_initialize(&stc);
if (ret != STC_ERROR_NONE) {
- eprintf("stc_initialize() error: %s\n", get_error_message(ret));
+ SCTRACE_ERROR("stc_initialize() error: %s", get_error_message(ret));
return MENURUN_ERR_NORMAL;
}
int available_sim = 0;
tel_h_list.handle[i], &subscriber_id[i]);
if (ret == 0) {
- eprintf("get_subscriber_id_from_telephony_handle error! sim(%d) %d\n", i, ret);
+ SCTRACE_ERROR("get_subscriber_id_from_telephony_handle error! sim(%d) %d", i, ret);
continue;
}
stc_deinitialize(stc);
if (telephony_deinit(&tel_h_list) != TELEPHONY_ERROR_NONE) {
- eprintf("telephony_deinit failed");
+ SCTRACE_ERROR("telephony_deinit failed");
return MENURUN_ERR_NORMAL;
}
static MENURUN_ERROR menufunc_du_wi(int argc, char *argv[], GenSettingMenu *menu)
{
if (argc < 2) {
- eprintf("Too short to execute this function\n");
+ SCTRACE_ERROR("Too short to execute this function");
printf("First argument = cycle mode, below.\n");
printf("CYCLE_MODE_MONTHLY = 0\n");
ret = stc_initialize(&stc);
if (ret != STC_ERROR_NONE) {
- eprintf("stc_initialize() error: %s\n", get_error_message(ret));
+ SCTRACE_ERROR("stc_initialize() error: %s", get_error_message(ret));
return MENURUN_ERR_NORMAL;
}
void precreate_du(GenSettingMenu *menu)
{
- eprintf("entered precreate_du\n");
+ SCTRACE_DEBUG("entered precreate_du");
menu->destroy();
menu->addSubmenus(du_menulist, sizeof(du_menulist) / sizeof(MenuItem));
}
int ret = vconf_get_bool(VCONFKEY_SETAPPL_STATE_AUTOMATIC_TIME_UPDATE_BOOL, &auto_update);
if (ret != 0) {
- eprintf("\tFail to get Auto update!\n");
+ SCTRACE_ERROR("\tFail to get Auto update!");
return MENURUN_ERR_NORMAL;
}
void precreate_dt(GenSettingMenu *menu)
{
- eprintf("entered precreate_dt\n");
+ SCTRACE_DEBUG("entered precreate_dt");
menu->destroy();
menu->addSubmenus(dt_menulist, sizeof(dt_menulist) / sizeof(MenuItem));
}
int auto_bright = 0;
int ret = vconf_get_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, &auto_bright);
if (ret != 0) {
- eprintf("\tAuto Bright get fail!\n");
+ SCTRACE_ERROR("\tAuto Bright get fail!");
return MENURUN_ERR_NORMAL;
}
int ret = vconf_get_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, &brightness);
if (ret != 0) {
- eprintf("\tbrightness get fail!\n");
+ SCTRACE_ERROR("\tbrightness get fail!");
return MENURUN_ERR_NORMAL;
}
int ret = system_settings_get_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, &fontsize);
if (ret != 0) {
- eprintf("\tFont get fail!\n");
+ SCTRACE_ERROR("\tFont get fail!");
return MENURUN_ERR_NORMAL;
}
void precreate_di(GenSettingMenu *menu)
{
- eprintf("entered precreate_di\n");
+ SCTRACE_DEBUG("entered precreate_di");
menu->destroy();
menu->addSubmenus(di_menulist, sizeof(di_menulist) / sizeof(MenuItem));
}
&info->noti_sound_stream_info)
!= SOUND_MANAGER_ERROR_NONE)
) {
- eprintf("Cannot create stream information ");
+ SCTRACE_ERROR("Cannot create stream information");
return false;
}
{
sound_stream_info_t sound_stream_info;
if (!_sound_manager_init(&sound_stream_info)) {
- eprintf("_sound_manager_init() failed!");
+ SCTRACE_ERROR("_sound_manager_init() failed!");
return MENURUN_ERR_NORMAL;
}
int vol = 0;
{
sound_stream_info_t sound_stream_info;
if (!_sound_manager_init(&sound_stream_info)) {
- eprintf("_sound_manager_init() failed!");
+ SCTRACE_ERROR("_sound_manager_init() failed!");
return MENURUN_ERR_NORMAL;
}
int vol = 0;
{
sound_stream_info_t sound_stream_info;
if (!_sound_manager_init(&sound_stream_info)) {
- eprintf("_sound_manager_init() failed!");
+ SCTRACE_ERROR("_sound_manager_init() failed!");
return MENURUN_ERR_NORMAL;
}
int vol = 0;
{
sound_stream_info_t sound_stream_info;
if (!_sound_manager_init(&sound_stream_info)) {
- eprintf("_sound_manager_init() failed!");
+ SCTRACE_ERROR("_sound_manager_init() failed!");
return MENURUN_ERR_NORMAL;
}
void precreate_so(GenSettingMenu *menu)
{
- eprintf("entered precreate_so\n");
+ SCTRACE_DEBUG("entered precreate_so");
menu->destroy();
menu->addSubmenus(so_menulist, sizeof(so_menulist) / sizeof(MenuItem));
}
static char *usb_otg_path = 0;
#define SETTING_CMD_MAX_STR_LEN 512
-
-#define __FREE(del, arg) do { \
- if (arg) { \
- /*cast any argument to (void*) to avoid build warring*/\
- del((void *)(arg)); \
- arg = nullptr; \
- } \
-} while (0)
-#define FREE(arg) __FREE(free, arg)
#define SAFE_STRDUP(src) (src) ? strdup(src) : nullptr
-#ifndef ret_if
-#define ret_if(expr) do { \
- if (expr) { \
- eprintf("(%s)\n", #expr); \
- return ; \
- } \
-} while (0)
-#endif
-
static void storage_get_external_storage_status(const char *path, double *total,
double *avail)
{
struct statvfs external;
if (storage_get_internal_memory_size(&internal) < 0) {
- eprintf("Fail to get internal memory size");
+ SCTRACE_ERROR("Fail to get internal memory size");
snprintf(str, size, "%s", "_unavailable");
return;
} else {
* (long long int)internal.f_blocks;
avail = (long long int)internal.f_bsize
* (long long int)internal.f_bavail;
-// eprintf("Total mem : %lld, Avail mem : %lld\n",
+// SCTRACE_DEBUG("Total mem : %lld, Avail mem : %lld",
// total, avail);
}
if (storage_get_external_memory_size(&external) < 0) {
- eprintf("Fail to get external memory size");
+ SCTRACE_ERROR("Fail to get external memory size");
} else {
total += (long long int)external.f_frsize
* (long long int)external.f_blocks;
avail += (long long int)external.f_bsize
* (long long int)external.f_bavail;
-// eprintf("Total mem : %lld, Avail mem : %lld\n",
+// SCTRACE_DEBUG("Total mem : %lld, Avail mem : %lld",
// total, avail);
}
/* check if values are appropriate*/
if (total < 0 || avail < 0 || total < avail) {
- eprintf("Fail to get internal memory size");
+ SCTRACE_ERROR("Fail to get internal memory size");
snprintf(str, size, "%s", "_unavailable");
return;
}
/*Set Filter*/
ret = media_filter_create(&filter);
if (MEDIA_CONTENT_ERROR_NONE != ret) {
- eprintf("media_filter_create() Fail(%d)", ret);
+ SCTRACE_ERROR("media_filter_create() Fail(%d)", ret);
return ret;
}
MEDIA_CONTENT_COLLATE_DEFAULT);
if (MEDIA_CONTENT_ERROR_NONE != ret) {
media_filter_destroy(filter);
- eprintf("media_filter_set_condition() Fail(%d)\n",
+ SCTRACE_ERROR("media_filter_set_condition() Fail(%d)",
ret);
return ret;
}
ret = media_info_foreach_media_from_db(filter, cb, sizes);
if (MEDIA_CONTENT_ERROR_NONE != ret) {
media_filter_destroy(filter);
- eprintf(
- "media_info_foreach_media_from_db() Fail(%d)\n",
+ SCTRACE_ERROR("media_info_foreach_media_from_db() Fail(%d)",
ret);
return ret;
}
ret = media_filter_destroy(filter);
if (MEDIA_CONTENT_ERROR_NONE != ret) {
- eprintf("media_filter_destroy() Fail(%d)\n", ret);
+ SCTRACE_ERROR("media_filter_destroy() Fail(%d)", ret);
return ret;
}
sizes->audio_total += size;
break;
default:
- eprintf("Invalid Type(%d)", type);
+ SCTRACE_ERROR("Invalid Type(%d)", type);
break;
}
media_info_get_file_path(media, &file_path);
#if 0
if (!ecore_file_exists(file_path)) {
- SETTINGCMD_TRACE_DEBUG("!ecore_file_exists(file_path)");
+ SCTRACE_ERROR("!ecore_file_exists(file_path)");
FREE(file_path);
return true;
}
multi_main_loop = g_main_loop_new(nullptr, FALSE);
pc_total_size = pkgmgr_client_new(PC_REQUEST);
if (nullptr == pc_total_size) {
- eprintf("pkgmgr_client_new() Fail");
+ SCTRACE_ERROR("pkgmgr_client_new() Fail");
return;
}
g_main_loop_run(multi_main_loop);
if(PACKAGE_MANAGER_ERROR_NONE != ret)
- eprintf("package_manager_get_total_package_size_info() Fail(%s)\n",
+ SCTRACE_ERROR("package_manager_get_total_package_size_info() Fail(%s)\n",
get_error_message(ret));
}
int ret;
ret = unmount_usb_storage(usb_otg_path);
if (ret < 0) {
- eprintf("unmount_usb_storage(%s) Fail(%d)\n",
- usb_otg_path, ret);
+ SCTRACE_ERROR("unmount_usb_storage(%s) Fail(%d)", usb_otg_path, ret);
usb_request = STORAGE_USB_REQ_NONE;
}
}
ret = mount_usb_storage(usb_otg_path);
if (ret < 0) {
- eprintf("mount_usb_storage(%s) Fail(%d)\n",
- usb_otg_path, ret);
+ SCTRACE_ERROR("mount_usb_storage(%s) Fail(%d)", usb_otg_path, ret);
usb_request = STORAGE_USB_REQ_NONE;
} else {
printf("USB mount success\n");
ret = format_usb_storage(usb_otg_path);
if (ret < 0) {
- eprintf("format_usb_storage(%s) Fail(%d)\n",
- usb_otg_path, ret);
+ SCTRACE_ERROR("format_usb_storage(%s) Fail(%d)", usb_otg_path, ret);
return MENURUN_ERR_NORMAL;
}
return MENURUN_ERR_NONE;
char avail_str[256] = { 0 };
if (!usb_otg_path) {
- eprintf("There is no usb otg path\n");
+ SCTRACE_ERROR("There is no usb otg path");
return;
}
ret_if(nullptr == path);
ret_if(nullptr == data);
- eprintf("path:%s type:%s", path, type);
+ SCTRACE_DEBUG("path:%s type:%s", path, type);
FREE(usb_otg_path);
usb_otg_path = SAFE_STRDUP(path);
} else if (!strcmp(type, "storage_mount")) {
usb_otg_status = SETTING_STORAGE_USB_OTG_MOUNT;
if (STORAGE_USB_REQ_UNMOUNT == usb_request) {
- eprintf("unmount_usb_storage() Fail\n");
+ SCTRACE_ERROR("unmount_usb_storage() Fail");
}
} else if (!strcmp(type, "storage_unmount")) {
usb_otg_status = SETTING_STORAGE_USB_OTG_UNMOUNT;
}
return;
} else if (STORAGE_USB_REQ_FORMAT == usb_request) {
- eprintf("format_usb_storage() Fail\n");
+ SCTRACE_ERROR("format_usb_storage() Fail");
} else if (STORAGE_USB_REQ_MOUNT == usb_request) {
- eprintf("mount_usb_storage() Fail\n");
+ SCTRACE_ERROR("mount_usb_storage() Fail");
}
} else if (!strcmp(type, "storage_updated")) {
if (mount == 0)
ret = init_usbhost_signal();
if (ret < 0)
- eprintf("init_usbhost_signal() Fail(%d)\n", ret);
+ SCTRACE_ERROR("init_usbhost_signal() Fail(%d)", ret);
ret = register_usb_storage_change_handler(storage_USB_cb, nullptr);
if (ret < 0) {
- eprintf(
- "register_usb_storage_change_handler() Fail(%d)\n",
- ret);
+ SCTRACE_ERROR("register_usb_storage_change_handler() Fail(%d)\n", ret);
deinit_usbhost_signal();
return;
}
ret = request_usb_storage_info();
if(ret < 0)
- eprintf("request_usb_storage_info() - There is no usb storage, ret = %d\n", ret);
+ SCTRACE_ERROR("request_usb_storage_info() - There is no usb storage, ret = %d", ret);
}
void storage_deinit_USB()
cond = "((MEDIA_TYPE < 4) AND (MEDIA_STORAGE_TYPE=0))";
ret = storage_get_media_info(cond, storage_get_media_item, &sizes);
if(MEDIA_CONTENT_ERROR_NONE != ret)
- eprintf("storage_get_media_info() Fail(%d)\n", ret);
+ SCTRACE_ERROR("storage_get_media_info() Fail(%d)", ret);
cond_misc = "((MEDIA_TYPE=4) AND (MEDIA_STORAGE_TYPE=0))";
ret = storage_get_media_info(cond_misc, storage_get_misces_item,
&sizes);
if(MEDIA_CONTENT_ERROR_NONE != ret)
- eprintf("storage_get_media_info() Fail(%d)\n", ret);
+ SCTRACE_ERROR("storage_get_media_info() Fail(%d)", ret);
storage_size_to_str(sizes.app_total, desc, sizeof(desc));
int media_ret = media_content_connect();
if (MEDIA_CONTENT_ERROR_NONE != media_ret) {
- eprintf("media_content_connect() Fail(0x%x)\n Please execute this app with \"owner\" user\n", (-1)*media_ret);
+ SCTRACE_ERROR("media_content_connect() Fail(0x%x)\n Please execute this app with \"owner\" user", (-1)*media_ret);
return MENURUN_ERR_NORMAL;
}
__get_storage_capacity(buf, SETTING_CMD_MAX_STR_LEN);
int ret = vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &sd_status);
if (ret != 0) {
- eprintf("vconf_get_int(%s) fail!\n", VCONFKEY_SYSMAN_MMC_STATUS);
+ SCTRACE_ERROR("vconf_get_int(%s) fail!", VCONFKEY_SYSMAN_MMC_STATUS);
return MENURUN_ERR_NORMAL;
}
if (sd_status != VCONFKEY_SYSMAN_MMC_MOUNTED){
- eprintf("SD card NOT mounted!\n");
+ SCTRACE_ERROR("SD card NOT mounted!");
return MENURUN_ERR_NORMAL;
}
int ret = vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &sd_status);
if (ret != 0) {
- eprintf("vconf_get_int(%s) fail!\n", VCONFKEY_SYSMAN_MMC_STATUS);
+ SCTRACE_ERROR("vconf_get_int(%s) fail!", VCONFKEY_SYSMAN_MMC_STATUS);
return MENURUN_ERR_NORMAL;
}
if (sd_status == VCONFKEY_SYSMAN_MMC_MOUNTED){
- eprintf("SD card already mounted!\n");
+ SCTRACE_ERROR("SD card already mounted!");
return MENURUN_ERR_NORMAL;
}
ret = storage_request_mount_mmc(&mmc_content);
if (ret == -1) {
- eprintf("storage_request_mount_mmc() Fail\n");
+ SCTRACE_ERROR("storage_request_mount_mmc() Fail");
return MENURUN_ERR_NORMAL;
}
int ret = vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &sd_status);
if (ret != 0) {
- eprintf("vconf_get_int(%s) fail!\n", VCONFKEY_SYSMAN_MMC_STATUS);
+ SCTRACE_ERROR("vconf_get_int(%s) fail!", VCONFKEY_SYSMAN_MMC_STATUS);
return MENURUN_ERR_NORMAL;
}
int ret = vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &sd_status);
if (ret != 0) {
- eprintf("vconf_get_int(%s) fail!\n", VCONFKEY_SYSMAN_MMC_STATUS);
+ SCTRACE_ERROR("vconf_get_int(%s) fail!", VCONFKEY_SYSMAN_MMC_STATUS);
return MENURUN_ERR_NORMAL;
}
if (sd_status != VCONFKEY_SYSMAN_MMC_MOUNTED){
- eprintf("SD card NOT mounted!\n");
+ SCTRACE_ERROR("SD card NOT mounted!");
return MENURUN_ERR_NORMAL;
}
ret = storage_request_unmount_mmc(&mmc_content, MNT_FORCE);
if (ret == -1) {
- eprintf("storage_request_unmount_mmc() Fail\n");
+ SCTRACE_ERROR("storage_request_unmount_mmc() Fail");
return MENURUN_ERR_NORMAL;
}
struct mmc_contents mmc_content = {0};
int ret = storage_request_format_mmc(&mmc_content);
if (ret == -1) {
- eprintf("failed to call storage_request_format_mmc\n");
+ SCTRACE_ERROR("failed to call storage_request_format_mmc");
return MENURUN_ERR_NORMAL;
}
int ret = vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_WIFI_DIRECT_INT, val);
if (ret != 0) {
- eprintf("vconf_get_int(%s) fail!\n", VCONFKEY_SETAPPL_DEFAULT_MEM_WIFI_DIRECT_INT);
+ SCTRACE_ERROR("vconf_get_int(%s) fail!", VCONFKEY_SETAPPL_DEFAULT_MEM_WIFI_DIRECT_INT);
return MENURUN_ERR_NORMAL;
}
ret = vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT, val);
if (ret != 0) {
- eprintf("vconf_get_int(%s) fail!\n", VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT);
+ SCTRACE_ERROR("vconf_get_int(%s) fail!", VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT);
return MENURUN_ERR_NORMAL;
}
printf("Set internal memory for default storage shared content\n");
int ret = vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_WIFI_DIRECT_INT, val);
if (ret != 0) {
- eprintf("vconf_get_int(%s) fail!\n", VCONFKEY_SETAPPL_DEFAULT_MEM_WIFI_DIRECT_INT);
+ SCTRACE_ERROR("vconf_get_int(%s) fail!", VCONFKEY_SETAPPL_DEFAULT_MEM_WIFI_DIRECT_INT);
return MENURUN_ERR_NORMAL;
}
ret = vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT, val);
if (ret != 0) {
- eprintf("vconf_get_int(%s) fail!\n", VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT);
+ SCTRACE_ERROR("vconf_get_int(%s) fail!", VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT);
return MENURUN_ERR_NORMAL;
}
printf("Set SD card for default storage shared content\n");
int ret = vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_INSTALL_APPLICATIONS_INT, val);
if (ret != 0) {
- eprintf("vconf_get_int(%s) fail!\n", VCONFKEY_SETAPPL_DEFAULT_MEM_INSTALL_APPLICATIONS_INT);
+ SCTRACE_ERROR("vconf_get_int(%s) fail!", VCONFKEY_SETAPPL_DEFAULT_MEM_INSTALL_APPLICATIONS_INT);
return MENURUN_ERR_NORMAL;
}
int ret = vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_INSTALL_APPLICATIONS_INT, val);
if (ret != 0) {
- eprintf("vconf_get_int(%s) fail!\n", VCONFKEY_SETAPPL_DEFAULT_MEM_INSTALL_APPLICATIONS_INT);
+ SCTRACE_ERROR("vconf_get_int(%s) fail!", VCONFKEY_SETAPPL_DEFAULT_MEM_INSTALL_APPLICATIONS_INT);
return MENURUN_ERR_NORMAL;
}
int ret = vconf_get_int(VCONFKEY_SETAPPL_DEFAULT_MEM_INSTALL_APPLICATIONS_INT, &val);
if (ret != 0) {
- eprintf("vconf_get_int(%s) fail!\n", VCONFKEY_SETAPPL_DEFAULT_MEM_INSTALL_APPLICATIONS_INT);
+ SCTRACE_ERROR("vconf_get_int(%s) fail!", VCONFKEY_SETAPPL_DEFAULT_MEM_INSTALL_APPLICATIONS_INT);
return MENURUN_ERR_NORMAL;
}
int ret = vconf_get_int(VCONFKEY_SETAPPL_DEFAULT_MEM_WIFI_DIRECT_INT, &val);
if (ret != 0) {
- eprintf("vconf_get_int(%s) fail!\n", VCONFKEY_SETAPPL_DEFAULT_MEM_WIFI_DIRECT_INT);
+ SCTRACE_ERROR("vconf_get_int(%s) fail!", VCONFKEY_SETAPPL_DEFAULT_MEM_WIFI_DIRECT_INT);
return MENURUN_ERR_NORMAL;
}
ret = vconf_get_int(VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT, &val);
if (ret != 0) {
- eprintf("vconf_get_int(%s) fail!\n", VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT);
+ SCTRACE_ERROR("vconf_get_int(%s) fail!", VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT);
return MENURUN_ERR_NORMAL;
}
- printf("Default storage shared content with bluetooth : %s\n", (val)?"Internal memory":"SD Card");
+ printf("Default storage shared content with bluetooth : %s", (val)?"Internal memory":"SD Card");
return MENURUN_ERR_NONE;
}
void precreate_st(GenSettingMenu *menu)
{
- eprintf("entered precreate_st\n");
+ SCTRACE_DEBUG("entered precreate_st");
menu->destroy();
menu->addSubmenus(st_menulist, sizeof(st_menulist) / sizeof(MenuItem));
}
int state = 0;
int ret = vconf_get_int(VCONFKEY_WIFI_STATE, &state);
if (ret != 0) {
- eprintf("\twifi state get fail!\n");
+ SCTRACE_ERROR("\twifi state get fail!");
return MENURUN_ERR_NORMAL;
}
bool state = false;
int ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION, &state);
if (ret != 0) {
- eprintf("\twifi notification get fail!\n");
+ SCTRACE_ERROR("\twifi notification get fail!\n");
return MENURUN_ERR_NORMAL;
}
void precreate_wf(GenSettingMenu *menu)
{
- eprintf("entered precreate_wf\n");
+ SCTRACE_DEBUG("entered precreate_wf");
menu->destroy();
menu->addSubmenus(wf_menulist, sizeof(wf_menulist)/ sizeof(MenuItem));
}