return BATTERY_MONITOR_ERROR_NONE;
}
+static int bd_print_uid_entry(int idx, history_tag_s *pool_info)
+{
+ ENTER;
+
+ GString *dump_p = g_string_sized_new(30);
+ g_string_append_printf(dump_p, "%d,", pool_info->uid);
+ if (pool_info->string_info != NULL) {
+ gchar *temp = g_strdup(pool_info->string_info->str);
+ dump_p = g_string_append(dump_p, temp);
+ g_free(temp);
+ }
+ dump_p = g_string_append(dump_p, "\n");
+ _DBG("%s", dump_p->str);//write
+ g_free(dump_p->str);
+
+ EXIT;
+ return BATTERY_MONITOR_ERROR_NONE;
+}
+static int bd_get_uid_entry_from_dump(void)
+{
+ ENTER;
+
+ // should be maintained at listeners for uniqueness
+ // move there and modify
+ GString *dump_p = g_string_sized_new(30);
+ dump_p = g_string_append(dump_p, TIZEN_DUMP_VERSION);
+ dump_p = g_string_append(dump_p, ",0");
+ dump_p = g_string_append(dump_p, ",i");
+ dump_p = g_string_append(dump_p, ",uid,");
+ int ret = BATTERY_MONITOR_ERROR_NONE;
+ int log_count = h_count;
+ for (int i = 0; i < log_count; i++) {
+ history_tag_s *pool_info = NULL;
+ if (history_data[i].event_tag != NULL) {
+ pool_info = history_data[i].event_tag;
+ _DBG("%s", dump_p->str);//write
+ ret = bd_print_uid_entry(i, pool_info);
+ if (ret != BATTERY_MONITOR_ERROR_NONE)
+ return BATTERY_MONITOR_ERROR_INTERNAL;
+ }
+ if (history_data[i].wakelock_tag != NULL) {
+ pool_info = history_data[i].wakelock_tag;
+ _DBG("%s", dump_p->str);//write
+ ret = bd_print_uid_entry(i, pool_info);
+ if (ret != BATTERY_MONITOR_ERROR_NONE)
+ return BATTERY_MONITOR_ERROR_INTERNAL;
+ }
+ if (history_data[i].wakereason_tag != NULL) {
+ pool_info = history_data[i].wakereason_tag;
+ _DBG("%s", dump_p->str);//write
+ ret = bd_print_uid_entry(i, pool_info);
+ if (ret != BATTERY_MONITOR_ERROR_NONE)
+ return BATTERY_MONITOR_ERROR_INTERNAL;
+ }
+ }
+ g_free(dump_p->str);
+
+ EXIT;
+ return BATTERY_MONITOR_ERROR_NONE;
+}
// The index passed in the fn should be preferrably continuous,
// Other things should be implemented at dumping function.
static int bd_get_history_detail_from_dump(int index, history_item_s* dump_node)
// fputs(dump_p->str, fp);//TEMP
g_free(dump_p->str);
}
+
+ //Dump i & l values after this
+ ret = bd_get_uid_entry_from_dump();
+ if (ret != BATTERY_MONITOR_ERROR_NONE)
+ _ERR("UID data dump failed");
+
h_flag = true;
// fclose(fp);//TEMP
EXIT;
}
/*
+int bd_set_old_state_to_history_item(history_item_s* nrec)
+{
+ ENTER;
+ //Move this with listeners
+ EXIT;
+ return BATTERY_MONITOR_ERROR_NONE;
+}
+*/
+
+/*
//: remove this
static int bd_test_fn()
{
h_count = 0; h_flag = true;
_INFO("Battery Dump Init Successful");
//Remove
-// bd_make_string_maps();
+ //bd_make_string_maps();
EXIT;
return BATTERY_MONITOR_ERROR_NONE;
}