Make DUMP_DUMMY build flag 54/223254/6
authorKichan Kwon <k_c.kwon@samsung.com>
Tue, 28 Jan 2020 04:36:14 +0000 (13:36 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Wed, 19 Feb 2020 05:17:33 +0000 (14:17 +0900)
- To watch dump string, set DUMP_DUMMY as "ON"
- In addition, remove deprecated test function

Change-Id: I0e9a1e58f7bb75ecc442a0a2a2bd7c6d5877392e
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
CMakeLists.txt
packaging/batterymonitor.spec
src/battery_dump/bd_history_item.c

index e51e2a9..ea42ad4 100644 (file)
@@ -45,11 +45,14 @@ SET(SRCS
        src/bm_server_db.c
        src/bm_util.c
        src/bm_server.c
-       src/battery_dump/bd_history_item_dummy.c
        src/battery_dump/bd_history_item.c
        src/battery_dump/bm_listeners.c
 )
 
+IF("${DUMP_DUMMY}" STREQUAL "ON")
+       SET(SRCS ${SRCS} src/battery_dump/bd_history_item_dummy.c)
+ENDIF()
+
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
 
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/battery_monitor_stub.h DESTINATION include)
index 795f53e..ffcf15c 100644 (file)
@@ -36,6 +36,8 @@ Requires(postun): /sbin/ldconfig
 
 %define power_profile_config_path /usr/etc/batterymonitor/config
 
+%define dump_dummy OFF
+
 %description
 Battery-Monitor Service Daemon
 
@@ -55,7 +57,8 @@ cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
                -DINCLUDE_INSTALL_DIR=%{_includedir} \
                -DLIB_PATH=%{_lib} \
                -DFULLVER=%{version} \
-               -DMAJORVER=${MAJORVER}
+               -DMAJORVER=${MAJORVER} \
+               -DDUMP_DUMMY=%{dump_dummy}
 
 %install
 %make_install
index 1b975c3..d14d570 100644 (file)
 #include "bm_server_db.h"
 #include "bm_private.h"
 #include "bd_private.h"
-/* For Test Purpose Only */
+
+#ifdef DUMP_DUMMY
 #include "bd_history_item_dummy.h"
+#endif
 
 dump_data_s history_data[HISTORY_SIZE_MAX];
 int h_count = 0; int h_flag = false;
@@ -1156,75 +1158,6 @@ int bd_set_old_state_to_history_item(history_item_s* nrec)
 }
 */
 
-/*// remove this
-static int bd_test_fn()
-{
-       ENTER;
-
-       history_item_s ts;
-
-       bd_print_history_item_reset(&ts);
-       ts.cmd_s = CM_CRR_TIME; ts.event_code = ET_NONE;
-       ts.event_tag = NULL; ts.wakelock_tag = NULL;
-       ts.wakereason_tag = NULL;
-       bd_set_history_from_listener(&ts);
-
-       ts.cmd_s = CM_UPD; ts.time_s = 0;
-       ts.time_current = 0;
-       ts.state_1 = 0;
-       ts.state_1 = ST1_WIFI_SCAN_FLAG;
-       ts.state_1 |= (ST1_SCREEN_ON_FLAG);
-       ts.state_2 = ST2_VIDEO_ON_FLAG;
-       ts.battery_level = 99;
-       ts.battery_status = 'd';
-       ts.battery_health = 'g';
-       ts.battery_plugtype = 'a';
-       ts.battery_temperature = 226;
-       ts.battery_voltage = 400;
-       ts.battery_charge = 0;
-       ts.event_code = ET_PROC; //Dummy Event
-       ts.event_tag = (history_tag_s *)calloc(1, sizeof(history_tag_s));
-       if (ts.event_tag != NULL) {
-               _DBG("Memory created successfully");
-               GString *temp = ts.event_tag->string_info;
-               temp = g_string_sized_new(30);
-               BM_CHECK_MEM_ALLOC(temp, {});
-               ts.event_tag->uid = 0;
-               ts.event_tag->sp_idx = 1;
-               temp = g_string_append(temp, "tizen");
-               ts.event_tag->string_info = temp;
-               _DBG("%s _1", ts.event_tag->string_info->str);
-       }
-       ts.wakelock_tag = NULL;
-       ts.wakereason_tag = NULL;
-       // Node 1
-       bd_set_history_from_listener(&ts);
-
-       ts.event_code = ET_NONE;
-       ts.event_tag = NULL;
-       ts.state_1 &= ~(ST1_WIFI_SCAN_FLAG);
-       // Node 2
-       bd_set_history_from_listener(&ts);
-
-       EXIT;
-       return BATTERY_MONITOR_ERROR_NONE;
-}*/
-
-/*
-static int bd_make_string_maps()
-{
-       ENTER;
-
-       bd_test_fn();
-       history_item_s ts;
-       for (int i = 0; i < h_count; i++)
-               bd_get_history_detail_from_dump(i, &ts);
-       bd_print_history_item_main(0, 1576753138, true);
-
-       EXIT;
-       return BATTERY_MONITOR_ERROR_NONE;
-}*/
-
 static int *dumpsys_handler;
 
 int bd_callback(const int fd, const int argc, char **argv)
@@ -1267,9 +1200,10 @@ int bd_initialize_battery_dump()
 
        h_count = 0; h_flag = true;
        _INFO("Battery Dump Init Successful");
-       //Remove
-       // Uncomment to test
+
+#ifdef DUMP_DUMMY
        bd_dummy_test_fn();
+#endif
 
        EXIT;
        return BATTERY_MONITOR_ERROR_NONE;