char *app_id = NULL;
int64_t incoming = 0;
int64_t outgoing = 0;
- stc_iface_type_e iface_type = STC_IFACE_UNKNOWN;
+ Eina_List **list = NULL;
+ stc_iface_type_e iface = (stc_iface_type_e)user_data;
int ret = stc_stats_info_get_app_id(info, &app_id);
if (ret != STC_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "[%s:%d] stc_stats_info_get_app_id() error: %s", __FILE__, __LINE__, get_error_message(ret));
+ SETTING_TRACE_ERROR("stc_stats_info_get_app_id() error: %s", get_error_message(ret));
return STC_CALLBACK_CONTINUE;
}
ret = stc_stats_info_get_counter(info, &incoming, &outgoing);
if (ret != STC_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "[%s:%d] stc_stats_info_get_counter() error: %s", __FILE__, __LINE__, get_error_message(ret));
+ SETTING_TRACE_ERROR("stc_stats_info_get_counter() error: %s", get_error_message(ret));
free(app_id);
return STC_CALLBACK_CONTINUE;
}
- dlog_print(DLOG_INFO, LOG_TAG, "[%s:%d] APP: %s in: %lld out: %lld",
- basename(__FILE__), __LINE__,
- app_id, incoming, outgoing);
-
- ret = stc_stats_info_get_iface_type(info, &iface_type);
- if (ret != STC_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "[%s:%d] stc_stats_info_get_iface_type() error: %s", __FILE__, __LINE__, get_error_message(ret));
- free(app_id);
- return STC_CALLBACK_CONTINUE;
- }
-
- if (iface_type == STC_IFACE_WIFI) {
+ if (iface == STC_IFACE_WIFI) {
+ list = &ad.wifi_apps;
ad.total_data_wifi += incoming + outgoing;
- _append_stats_list_item(&ad.wifi_apps, app_id, incoming + outgoing);
- } else if (iface_type == STC_IFACE_DATACALL) {
+ } else if (iface == STC_IFACE_DATACALL) {
+ list = &ad.sim_1_apps;
ad.total_data_sim += incoming + outgoing;
- _append_stats_list_item(&ad.sim_1_apps, app_id, incoming + outgoing);
+ } else {
+ SETTING_TRACE_ERROR("Unknown interface: %d", iface);
}
+ _append_stats_list_item(list, app_id, incoming + outgoing);
+
SETTING_TRACE_END;
return STC_CALLBACK_CONTINUE;
}
-static void _create_stats_list(Eina_List *list, stc_iface_type_e iface)
+//Test only
+void _dbg_app_list(Eina_List *list, char *title)
+{
+ SETTING_TRACE_BEGIN;
+ Eina_List *l;
+ data_usage_app_item_t *test_dua;
+
+ SETTING_TRACE("=============================== %s: [%p] %d ===============================", title, list, eina_list_count(list));
+
+ EINA_LIST_FOREACH(list, l, test_dua)
+ {
+ if (!test_dua) {
+ SETTING_TRACE_ERROR("[%s:%d] test_dua == NULL");
+ continue;
+ }
+
+ SETTING_TRACE("APP: %s PKG: %s icon: %s label: %s data: %lld",
+ test_dua->appid, test_dua->pkgid, test_dua->icon, test_dua->label, test_dua->data_usage_bytes);
+ }
+
+ SETTING_TRACE("===============================-------------===============================");
+
+ SETTING_TRACE_END;
+}
+
+static void _create_stats_list(stc_iface_type_e iface)
{
SETTING_TRACE_BEGIN;
stc_stats_rule_h rule = NULL;
int ret = stc_stats_rule_create(ad.stc, &rule);
if (ret != STC_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "[%s:%d] stc_stats_rule_create() error: %s", __FILE__, __LINE__, get_error_message(ret));
+ SETTING_TRACE_ERROR("stc_stats_rule_create() error: %s", get_error_message(ret));
return;
}
ret = stc_stats_rule_set_time_interval(rule, now - STC_TIME_PERIOD_MONTH, now);
if (ret != STC_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "[%s:%d] stc_stats_rule_set_time_interval() error: %s", __FILE__, __LINE__, get_error_message(ret));
+ SETTING_TRACE_ERROR("stc_stats_rule_set_time_interval() error: %s", get_error_message(ret));
return;
}
ret = stc_stats_rule_set_iface_type(rule, iface);
if (ret != STC_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "[%s:%d] stc_stats_rule_set_iface_type() error: %s", __FILE__, __LINE__, get_error_message(ret));
+ SETTING_TRACE_ERROR("stc_stats_rule_set_iface_type() error: %s", get_error_message(ret));
return;
}
- ret = stc_foreach_stats(ad.stc, rule, _stc_stats_info_cb, list);
+ ret = stc_foreach_stats(ad.stc, rule, _stc_stats_info_cb, (void *)iface);
if (ret != STC_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "[%s:%d] stc_get_stats() error: %s", __FILE__, __LINE__, get_error_message(ret));
+ SETTING_TRACE_ERROR("stc_get_stats() error: %s", get_error_message(ret));
return;
}
SETTING_TRACE_END;
}
+static Eina_Bool _timer_cb(void *data)
+{
+ SETTING_TRACE_BEGIN;
+
+ _dbg_app_list(ad.wifi_apps, "WIFI APPS");
+ _dbg_app_list(ad.sim_1_apps, "SIM APPS");
+
+ SETTING_TRACE_END;
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
static bool _create_app(void *data)
{
SmartMgrData *ad = data;
int ret = TELEPHONY_ERROR_NONE;
- dlog_print(DLOG_INFO, LOG_TAG, "[%s:%d] ==========================================================", basename(__FILE__), __LINE__);
- dlog_print(DLOG_INFO, LOG_TAG, "[%s:%d] ==========================================================", basename(__FILE__), __LINE__);
- dlog_print(DLOG_INFO, LOG_TAG, "[%s:%d] ==========================================================", basename(__FILE__), __LINE__);
- dlog_print(DLOG_INFO, LOG_TAG, "[%s:%d] BUILD: %s %s", basename(__FILE__), __LINE__, __DATE__, __TIME__);
- dlog_print(DLOG_INFO, LOG_TAG, "[%s:%d] ==========================================================", basename(__FILE__), __LINE__);
- dlog_print(DLOG_INFO, LOG_TAG, "[%s:%d] ==========================================================", basename(__FILE__), __LINE__);
- dlog_print(DLOG_INFO, LOG_TAG, "[%s:%d] ==========================================================", basename(__FILE__), __LINE__);
+ SETTING_TRACE("==========================================================");
+ SETTING_TRACE("==========================================================");
+ SETTING_TRACE("==========================================================");
+ SETTING_TRACE("BUILD: %s %s", __DATE__, __TIME__);
+ SETTING_TRACE("==========================================================");
+ SETTING_TRACE("==========================================================");
+ SETTING_TRACE("==========================================================");
if (!ad)
return false;
- dlog_print(DLOG_INFO, LOG_TAG, "_create_app");
+ SETTING_TRACE("_create_app");
+
+
bindtextdomain(SETTING_PACKAGE, SETTING_LOCALEDIR);
ret = telephony_init(&ad->telephony_handles);
ret = stc_initialize(&ad->stc);
if (ret != STC_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "[%s:%d] stc_initialize() error: %s", __FILE__, __LINE__, get_error_message(ret));
+ SETTING_TRACE_ERROR("stc_initialize() error: %s", get_error_message(ret));
return false;
}
- _create_stats_list(ad->wifi_apps, STC_IFACE_WIFI);
- _create_stats_list(ad->sim_1_apps, STC_IFACE_DATACALL);
+ _create_stats_list(STC_IFACE_WIFI);
+ _create_stats_list(STC_IFACE_DATACALL);
- dlog_print(DLOG_DEBUG, LOG_TAG, "[%s:%d] STC INITIALIZED", basename(__FILE__), __LINE__);
+ SETTING_TRACE("STC INITIALIZED");
init_main_view(ad);
setting_view_node_table_intialize();
setting_view_create(ad->main_view, ad);
setting_view_node_set_cur_view(ad->main_view);
+ ecore_timer_add(3.0, _timer_cb, NULL);
+
return true;
}