#include "bm_private.h"
#include "bd_private.h"
+//#define DUMP_DUMMY 1
#ifdef DUMP_DUMMY
#include "bd_history_item_dummy.h"
#endif
old_state->battery_temperature = -1;
old_state->battery_voltage = -1;
old_state->battery_charge = -1;
-
+ old_state->event_code = 0;
old_state->event_tag = NULL;
old_state->wakelock_tag = NULL;
old_state->wakereason_tag = NULL;
return BATTERY_MONITOR_ERROR_NONE;
}
+int bd_get_base_time_from_dump(long long *base_time)
+{
+ ENTER;
+
+ *base_time = history_data[0].time_s;
+
+ EXIT;
+ return BATTERY_MONITOR_ERROR_NONE;
+}
+
int bd_print_history_item_main(int fd, int num_h_items, long long base_time, bool chkin)
{
ENTER;
if (ret != BATTERY_MONITOR_ERROR_NONE)
_ERR("S pool data dump failed");
+ ret = bd_get_base_time_from_dump(&base_time);
+ if (ret != BATTERY_MONITOR_ERROR_NONE)
+ _ERR("Base time error");
+
int log_count = h_count; GString *dump_p = NULL;
for (int i = 0; i < log_count; i++) {
ret = bd_get_history_detail_from_dump(i, &new_state);
old_state.state_1 = new_state.state_1;
old_state.state_2 = new_state.state_2;
}
- _DBG("State assigned");
- _DBG("%s", dump_p->str);
- if (write(fd, dump_p->str, dump_p->len) < 0)
- _WARN("write error");
- g_free(dump_p->str);
+ _DBG("State assigned");
+ _DBG("%s", dump_p->str);
+ if (write(fd, dump_p->str, dump_p->len) < 0)
+ _WARN("write error");
+ g_free(dump_p->str);
}
// Dump the elapsed time from last event
int ret = BATTERY_MONITOR_ERROR_NONE;
+ h_count = 0; h_flag = true;
+
+#ifdef DUMP_DUMMY
+ bd_dummy_test_fn();
+#else
+ history_item_s ts;
+ ret = bd_print_history_item_reset(&ts);
+ if (ret == BATTERY_MONITOR_ERROR_NONE) {
+ ts.cmd_s = CM_CRR_TIME;
+ ret = bd_store_history_item(&ts);
+ if (ret != BATTERY_MONITOR_ERROR_NONE)
+ _WARN("Init Node addition failed");
+ }
+#endif
+
ret = dumpsys_system_register_dump_cb(bd_callback, "batterystats", (void **)&dumpsys_handler);
if (ret != TIZEN_ERROR_NONE) {
_ERR("dumpsys_system_register_dump_cb failed (%x)", ret);
return BATTERY_MONITOR_ERROR_NOT_INITIALIZED;
}
- h_count = 0; h_flag = true;
_INFO("Battery Dump Init Successful");
-#ifdef DUMP_DUMMY
- bd_dummy_test_fn();
-#endif
-
EXIT;
return BATTERY_MONITOR_ERROR_NONE;
}