Remove old capi code 04/231204/2
authorDewal Agarwal <d1.agarwal@samsung.com>
Mon, 20 Apr 2020 05:39:58 +0000 (11:09 +0530)
committerDewal Agarwal <d1.agarwal@samsung.com>
Mon, 20 Apr 2020 05:50:22 +0000 (11:20 +0530)
Change-Id: I86f3e7a66f30fff87340bd92af9d6ae40291d4bc
Signed-off-by: Dewal Agarwal <d1.agarwal@samsung.com>
include/bm_power_engine.h
include/bm_server.h
include/bm_server_db.h
packaging/battery-monitor.xml
packaging/org.tizen.battery.monitor.conf
src/bm_power_engine.c
src/bm_server.c
src/bm_server_db.c

index 48d0a4e..304d435 100644 (file)
@@ -30,8 +30,8 @@ struct battery_total_consumption_s {
        int cpu_val;
        int dp_val;
        int dn_val;
-#ifdef DISABLE_FEATURE_DATA_FROM_GPS_HRM_PLUGIN
        int gps_val;
+#ifdef DISABLE_FEATURE_DATA_FROM_GPS_HRM_PLUGIN
        int hrm_val;
 #endif /* DISABLE_FEATURE_DATA_FROM_GPS_HRM_PLUGIN */
        int bat_val;
@@ -67,15 +67,6 @@ struct bm_req_feature_data_handle_flag_s {
 
 void bm_engine_set_req_flag_handle(bm_plugin_id_e req_plugin_id, bool value);
 
-/* Get functions for fixed duration queries used in % */
-int bm_engine_get_usage_by_app_id_for_resource_id(const gchar *app_id, gint resource_id, gint duration, int *b_usage);
-
-int bm_engine_get_total_usage_by_app_id(const gchar *app_id, gint duration, int *b_usage);
-
-int bm_engine_get_total_usage_by_resource_id(gint resource_id, gint duration, int *b_usage);
-
-int bm_engine_get_all_resource_usage(const gchar *app_id, gint duration, bm_total_consumption_h data);
-
 /* Get functions for custome interval queries used in mAs */
 int bm_engine_get_mah_usage_by_app_id_for_resource_id_ci(const gchar* app_id, gint resource_id, gint64 start_time, gint64 end_time, double* battery_usage);
 
index 4637bff..76703da 100644 (file)
 extern "C" {
 #endif
 
-
-gboolean bm_get_usage_by_app_id_for_resource_id(BatteryMonitor *obj, GDBusMethodInvocation *invocation,
-                               const gchar *app_id, gint resource_id, gint duration, gint uid);
-
 gboolean bm_get_mah_usage_by_app_id_for_resource_id_custom_interval(BatteryMonitor *obj, GDBusMethodInvocation *invocation,
                                const gchar *app_id, gint resource_id, gint64 start_time, gint64 end_time, gint uid);
 
-gboolean bm_get_total_usage_by_app_id(BatteryMonitor *obj, GDBusMethodInvocation *invocation, const gchar *app_id,
-                               gint duration, gint uid);
-
 gboolean bm_get_total_mah_usage_by_app_id_custom_interval(BatteryMonitor *obj, GDBusMethodInvocation *invocation,
                                const gchar *app_id, gint64 start_time, gint64 end_time, gint uid);
 
-gboolean bm_get_total_usage_by_resource_id(BatteryMonitor *obj, GDBusMethodInvocation *invocation, gint resource_id,
-                               gint duration, gint uid);
-
 gboolean bm_get_total_mah_usage_by_resource_id_custom_interval(BatteryMonitor *obj, GDBusMethodInvocation *invocation,
                                gint resource_id, gint64 start_time, gint64 end_time, gint uid);
 
-gboolean bm_get_all_resource_usage(BatteryMonitor *obj, GDBusMethodInvocation *invocation, const gchar *app_id,
-                               gint duration, gint uid);
-
 gboolean bm_get_usage_handle_by_app_id_for_all_resource_id_custom_interval(BatteryMonitor *obj, GDBusMethodInvocation *invocation,
                                const gchar *app_id, gint64 start_time, gint64 end_time, gint uid);
 
index c6004a8..887105b 100644 (file)
@@ -28,8 +28,6 @@
 extern "C" {
 #endif
 
-/* BATTERY_DB */
-/* THIS DB IS THE DEFAULT DB TO BE USED FOR LOGGING APP BASED USAGE AND RESOURCE BASED USAGE IT WILL BE USED TO STORE PROCESSED VALUE OF THE USAGE, AND WILL BE REFERRED FOR ANSWERING API CALLS */
 
 /* List of Resources
 BM_RESOURCE_ID_BLE ==> rId_ble,
index c108be6..cb74dcb 100644 (file)
@@ -1,13 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <node name="/org/tizen/battery/monitor">
   <interface name="org.tizen.battery.monitor">
-    <method name="get_usage_by_app_id_for_resource_id">
-       <arg type="s" name="app_id" direction="in" />
-       <arg type="i" name="resource_id" direction="in" />
-       <arg type="i" name="duration" direction="in" />
-       <arg type="i" name="uid" direction="in" />
-       <arg type="i" name="battery_usage" direction="out" />
-    </method>
     <method name="get_mah_usage_by_app_id_for_resource_id_custom_interval">
        <arg type="s" name="app_id" direction="in" />
        <arg type="i" name="resource_id" direction="in" />
@@ -16,12 +9,6 @@
        <arg type="i" name="uid" direction="in" />
        <arg type="d" name="battery_usage" direction="out" />
     </method>
-    <method name="get_total_usage_by_app_id">
-       <arg type="s" name="app_id" direction="in" />
-       <arg type="i" name="duration" direction="in" />
-       <arg type="i" name="uid" direction="in" />
-       <arg type="i" name="battery_usage" direction="out" />
-    </method>
     <method name="get_total_mah_usage_by_app_id_custom_interval">
        <arg type="s" name="app_id" direction="in" />
        <arg type="x" name="start_time" direction="in" />
        <arg type="i" name="uid" direction="in" />
        <arg type="d" name="battery_usage" direction="out" />
     </method>
-    <method name="get_total_usage_by_resource_id">
-       <arg type="i" name="resource_id" direction="in" />
-       <arg type="i" name="duration" direction="in" />
-       <arg type="i" name="uid" direction="in" />
-       <arg type="i" name="battery_usage" direction="out" />
-    </method>
     <method name="get_total_mah_usage_by_resource_id_custom_interval">
        <arg type="i" name="resource_id" direction="in" />
        <arg type="x" name="start_time" direction="in" />
        <arg type="i" name="uid" direction="in" />
        <arg type="d" name="battery_usage" direction="out" />
     </method>
-    <method name="get_all_resource_usage">
-       <arg type="s" name="app_id" direction="in" />
-       <arg type="i" name="duration" direction="in" />
-       <arg type="i" name="uid" direction="in" />
-       <arg type="a{sv}" name="battery_data" direction="out" />
-    </method>
     <method name="get_usage_handle_by_app_id_for_all_resource_id_custom_interval">
        <arg type="s" name="app_id" direction="in" />
        <arg type="x" name="start_time" direction="in" />
index 8155a62..56249b8 100644 (file)
                <deny send_destination="org.tizen.battery.monitor" send_interface="org.tizen.battery.monitor"/>
 
                <check send_destination="org.tizen.battery.monitor" send_interface="org.tizen.battery.monitor"
-                       send_member="get_usage_by_app_id_for_resource_id" privilege="http://tizen.org/privilege/systemmonitor"/>
-               <check send_destination="org.tizen.battery.monitor" send_interface="org.tizen.battery.monitor"
                        send_member="get_mah_usage_by_app_id_for_resource_id_custom_interval" privilege="http://tizen.org/privilege/systemmonitor"/>
                <check send_destination="org.tizen.battery.monitor" send_interface="org.tizen.battery.monitor"
-                       send_member="get_total_usage_by_app_id" privilege="http://tizen.org/privilege/systemmonitor"/>
-               <check send_destination="org.tizen.battery.monitor" send_interface="org.tizen.battery.monitor"
                        send_member="get_total_mah_usage_by_app_id_custom_interval" privilege="http://tizen.org/privilege/systemmonitor"/>
                <check send_destination="org.tizen.battery.monitor" send_interface="org.tizen.battery.monitor"
-                       send_member="get_total_usage_by_resource_id" privilege="http://tizen.org/privilege/systemmonitor"/>
-               <check send_destination="org.tizen.battery.monitor" send_interface="org.tizen.battery.monitor"
                        send_member="get_total_mah_usage_by_resource_id_custom_interval" privilege="http://tizen.org/privilege/systemmonitor"/>
                <check send_destination="org.tizen.battery.monitor" send_interface="org.tizen.battery.monitor"
-                       send_member="get_all_resource_usage" privilege="http://tizen.org/privilege/systemmonitor"/>
-               <check send_destination="org.tizen.battery.monitor" send_interface="org.tizen.battery.monitor"
                        send_member="get_usage_handle_by_app_id_for_all_resource_id_custom_interval" privilege="http://tizen.org/privilege/systemmonitor"/>
        </policy>
 </busconfig>
index 4763732..39364b6 100644 (file)
@@ -40,60 +40,6 @@ int battery_capacity = 500;
 int gtimeo_id[2];
 static int data_collection_period = 600000;
 
-int bm_engine_get_usage_by_app_id_for_resource_id(const gchar *app_id, gint resource_id, gint duration, int *b_usage)
-{
-       ENTER;
-
-       BM_CHECK_INPUT_PARAM(app_id);
-
-       BM_RETURN_VAL((resource_id < BM_PLUGIN_ID_MAX), {},
-                       BATTERY_MONITOR_ERROR_INVALID_PARAMETER, "invalid resource-id param");
-
-       BM_RETURN_VAL((duration < BM_DURATION_TYPE_MAX), {},
-                       BATTERY_MONITOR_ERROR_INVALID_PARAMETER, "invalid duration param");
-
-       _INFO("usage requested - app-id[%s], resource_id[%d], duration[%d]",
-                               app_id, resource_id, duration);
-
-       int error = BATTERY_MONITOR_ERROR_NONE;
-
-       appid_usage_s *app_usage = bm_server_query_app_usage_by_appid(app_id, duration, &error);
-
-       if (!app_usage) {
-               _ERR("battery usage data for app_id(%s) is not available", app_id);
-               return BATTERY_MONITOR_ERROR_INTERNAL;
-       }
-
-       if (error != BATTERY_MONITOR_ERROR_NONE) {
-               _ERR("error reported, error = %d", error);
-               return BATTERY_MONITOR_ERROR_INTERNAL;
-       }
-
-       if (resource_id == BM_PLUGIN_ID_BLE)
-               *b_usage = bm_calc_individual_consumption(app_usage->rId_ble, battery_capacity);
-       else if (resource_id == BM_PLUGIN_ID_WIFI)
-               *b_usage = bm_calc_individual_consumption(app_usage->rId_wifi, battery_capacity);
-       else if (resource_id == BM_PLUGIN_ID_CPU)
-               *b_usage = bm_calc_individual_consumption(app_usage->rId_cpu, battery_capacity);
-       else if (resource_id == BM_PLUGIN_ID_DISPLAY)
-               *b_usage = bm_calc_individual_consumption(app_usage->rId_display, battery_capacity);
-       else if (resource_id == BM_PLUGIN_ID_DEVICE_NETWORK)
-               *b_usage = bm_calc_individual_consumption(app_usage->rId_device_network, battery_capacity);
-#ifdef DISABLE_FEATURE_DATA_FROM_GPS_HRM_PLUGIN
-       else if (resource_id == BM_PLUGIN_ID_GPS_SENSOR)
-               *b_usage = bm_calc_individual_consumption(app_usage->rId_gps, battery_capacity);
-       else if (resource_id == BM_PLUGIN_ID_HRM_SENSOR)
-               *b_usage = bm_calc_individual_consumption(app_usage->rId_hrm, battery_capacity);
-       else if (resource_id == BM_PLUGIN_CONST_BATTERY)
-               *b_usage = bm_calc_individual_consumption(app_usage->rId_battery, battery_capacity);
-#endif /* DISABLE_FEATURE_DATA_FROM_GPS_HRM_PLUGIN */
-
-       bm_appid_usage_free(app_usage);
-
-       EXIT;
-       return BATTERY_MONITOR_ERROR_NONE;
-}
-
 int bm_engine_get_mah_usage_by_app_id_for_resource_id_ci(const gchar* app_id, gint resource_id, gint64 start_time, gint64 end_time, double *battery_usage)
 {
        ENTER;
@@ -144,47 +90,6 @@ int bm_engine_get_mah_usage_by_app_id_for_resource_id_ci(const gchar* app_id, gi
        return BATTERY_MONITOR_ERROR_NONE;
 }
 
-int bm_engine_get_total_usage_by_app_id(const gchar *app_id, gint duration, int *b_usage)
-{
-       ENTER;
-
-       BM_CHECK_INPUT_PARAM(app_id);
-
-       BM_RETURN_VAL((duration < BM_DURATION_TYPE_MAX), {},
-                       BATTERY_MONITOR_ERROR_INVALID_PARAMETER, "invalid duration param");
-
-       _INFO("usage requested - app-id[%s], duration[%d]", app_id, duration);
-
-       int error = BATTERY_MONITOR_ERROR_NONE;
-
-       appid_usage_s *app_usage = bm_server_query_app_usage_by_appid(app_id, duration, &error);
-
-       if (!app_usage) {
-               _ERR("battery usage data for app_id(%s) is not available", app_id);
-               return BATTERY_MONITOR_ERROR_INTERNAL;
-       }
-
-       if (error != BATTERY_MONITOR_ERROR_NONE) {
-               _ERR("error reported, error = %d", error);
-               return BATTERY_MONITOR_ERROR_INTERNAL;
-       }
-
-       int total_consumption = (app_usage->rId_ble + app_usage->rId_wifi + app_usage->rId_cpu + \
-                               app_usage->rId_display + app_usage->rId_device_network);
-
-#ifdef DISABLE_FEATURE_DATA_FROM_GPS_HRM_PLUGIN
-       total_consumption += (app_usage->rId_gps + app_usage->rId_hrm);
-#endif /* DISABLE_FEATURE_DATA_FROM_GPS_HRM_PLUGIN */
-
-       *b_usage = bm_calc_individual_consumption(total_consumption, battery_capacity);
-       _INFO("total battery consumption is [%d] for app-id[%s]", *b_usage, app_id);
-
-       bm_appid_usage_free(app_usage);
-
-       EXIT;
-       return BATTERY_MONITOR_ERROR_NONE;
-}
-
 int bm_engine_get_total_mah_usage_by_app_id_ci(const gchar* app_id, gint64 start_time, gint64 end_time, double *battery_usage)
 {
        ENTER;
@@ -221,49 +126,6 @@ int bm_engine_get_total_mah_usage_by_app_id_ci(const gchar* app_id, gint64 start
        return BATTERY_MONITOR_ERROR_NONE;
 }
 
-int bm_engine_get_total_usage_by_resource_id(gint resource_id, gint duration, int *b_usage)
-{
-       ENTER;
-
-       BM_RETURN_VAL((resource_id < BM_PLUGIN_ID_MAX), {},
-                       BATTERY_MONITOR_ERROR_INVALID_PARAMETER, "invalid resource-id");
-
-       BM_RETURN_VAL((duration < BM_DURATION_TYPE_MAX), {},
-                       BATTERY_MONITOR_ERROR_INVALID_PARAMETER, "invalid duration param");
-
-       _INFO("usage requested - resource_id[%d], duration[%d]", resource_id, duration);
-
-       int error = BATTERY_MONITOR_ERROR_NONE;
-
-       const char *resource_id_str = NULL;
-       resource_id_str = bm_get_resource_id_string(resource_id);
-       if (g_strcmp0(resource_id_str, "UNKNOWN RESOURCE-ID") == 0) {
-               _ERR("invalid resource-id");
-               return BATTERY_MONITOR_ERROR_INTERNAL;
-       }
-
-       _INFO("resource string - [%s]", resource_id_str);
-
-       resourceid_usage_s *resource_usage = bm_server_query_resource_usage_resourceid(resource_id_str, duration, &error);
-
-       if (!resource_usage) {
-               _ERR("battery usage data for resource-id(%s) is not available", resource_id_str);
-               return BATTERY_MONITOR_ERROR_INTERNAL;
-       }
-
-       if (error != BATTERY_MONITOR_ERROR_NONE) {
-               _ERR("error reported, error = %d", error);
-               return BATTERY_MONITOR_ERROR_INTERNAL;
-       }
-
-       *b_usage = bm_calc_individual_consumption(resource_usage->usage, battery_capacity);
-
-       bm_resourceid_usage_free(resource_usage);
-
-       EXIT;
-       return BATTERY_MONITOR_ERROR_NONE;
-}
-
 int bm_engine_get_total_mah_usage_by_resource_id_ci(gint resource_id, gint64 start_time, gint64 end_time, double *battery_usage)
 {
        ENTER;
@@ -297,48 +159,6 @@ int bm_engine_get_total_mah_usage_by_resource_id_ci(gint resource_id, gint64 sta
        return BATTERY_MONITOR_ERROR_NONE;
 }
 
-int bm_engine_get_all_resource_usage(const gchar *app_id, gint duration, bm_total_consumption_h data)
-{
-       ENTER;
-
-       BM_CHECK_INPUT_PARAM(app_id);
-
-       BM_CHECK_INPUT_PARAM(data);
-
-       BM_RETURN_VAL((duration < BM_DURATION_TYPE_MAX), {},
-                       BATTERY_MONITOR_ERROR_INVALID_PARAMETER, "invalid duration param");
-
-       _INFO("usage requested - app-id[%s], duration[%d]", app_id, duration);
-
-       int error = BATTERY_MONITOR_ERROR_NONE;
-
-       appid_usage_s *app_usage = bm_server_query_app_usage_by_appid(app_id, duration, &error);
-       if (!app_usage) {
-               _ERR("battery usage data for app_id(%s) is not available", app_id);
-               return BATTERY_MONITOR_ERROR_INTERNAL;
-       }
-       if (error != BATTERY_MONITOR_ERROR_NONE) {
-               _ERR("error reported, error = %d", error);
-               return BATTERY_MONITOR_ERROR_INTERNAL;
-       }
-
-       data->ble_val = bm_calc_individual_consumption(app_usage->rId_ble, battery_capacity);
-       data->wifi_val = bm_calc_individual_consumption(app_usage->rId_wifi, battery_capacity);
-       data->cpu_val = bm_calc_individual_consumption(app_usage->rId_cpu, battery_capacity);
-       data->dp_val = bm_calc_individual_consumption(app_usage->rId_display, battery_capacity);
-       data->dn_val = bm_calc_individual_consumption(app_usage->rId_device_network, battery_capacity);
-#ifdef DISABLE_FEATURE_DATA_FROM_GPS_HRM_PLUGIN
-       data->gps_val = bm_calc_individual_consumption(app_usage->rId_gps, battery_capacity);
-       data->hrm_val = bm_calc_individual_consumption(app_usage->rId_hrm, battery_capacity);
-       data->bat_val = app_usage->rId_battery;
-#endif /* DISABLE_FEATURE_DATA_FROM_GPS_HRM_PLUGIN */
-
-       bm_appid_usage_free(app_usage);
-
-       EXIT;
-       return BATTERY_MONITOR_ERROR_NONE;
-}
-
 int bm_engine_get_all_resource_usage_handle_ci(const gchar* app_id, gint64 start_time, gint64 end_time, bm_total_consumption_h battery_data)
 {
        ENTER;
index 61f6e8f..177d9c6 100644 (file)
@@ -70,48 +70,6 @@ static void bm_set_signal_handling_info()
 }
 
 gboolean
-bm_get_usage_by_app_id_for_resource_id(BatteryMonitor *obj, GDBusMethodInvocation *invocation, const gchar *app_id,
-                                                       gint resource_id, gint duration, gint uid)
-{
-       ENTER;
-
-       _INFO("app_id [%s], resource_id [%d], duration [%d]", app_id, resource_id, duration);
-
-       if (!app_id || (resource_id >= BM_PLUGIN_ID_MAX) || (duration >= BM_DURATION_TYPE_MAX)) {
-               _ERR("invalid function param");
-               return false;
-       }
-
-       int ret_val = bm_check_privilege_battery(invocation);
-       if (ret_val != BATTERY_MONITOR_ERROR_NONE) {
-               _ERR("privilege check failed, ret-val - %d", ret_val);
-               goto RETURN;
-       }
-
-       int battery_usage = 0;
-
-       ret_val = bm_engine_get_usage_by_app_id_for_resource_id(app_id, resource_id, duration, &battery_usage);
-       if (ret_val != BATTERY_MONITOR_ERROR_NONE) {
-               _ERR("failed to get battery usage");
-               goto RETURN;
-       }
-
-       _INFO("battery usage - %d", battery_usage);
-
-RETURN:
-       if (ret_val != BATTERY_MONITOR_ERROR_NONE) {
-               GError* error = g_error_new(bm_error_quark(), ret_val, "info not available");
-               g_dbus_method_invocation_return_gerror(invocation, error);
-               g_error_free(error);
-       } else {
-               battery_monitor_complete_get_usage_by_app_id_for_resource_id(obj, invocation, battery_usage);
-       }
-
-       EXIT;
-       return true;
-}
-
-gboolean
 bm_get_mah_usage_by_app_id_for_resource_id_custom_interval(BatteryMonitor *obj, GDBusMethodInvocation *invocation, const gchar *app_id,
                                                        gint resource_id, gint64 start_time, gint64 end_time, gint uid)
 {
@@ -137,7 +95,6 @@ bm_get_mah_usage_by_app_id_for_resource_id_custom_interval(BatteryMonitor *obj,
                _ERR("failed to get battery usage");
                goto RETURN;
        }
-//     battery_usage = 22.50;
 
        _INFO("battery usage - %lf", battery_usage);
 
@@ -155,48 +112,6 @@ RETURN:
 }
 
 gboolean
-bm_get_total_usage_by_app_id(BatteryMonitor *obj, GDBusMethodInvocation *invocation,
-                                       const gchar *app_id, gint duration, gint uid)
-{
-       ENTER;
-
-       _INFO("app_id [%s], duration [%d]", app_id, duration);
-
-       if (!app_id || (duration >= BM_DURATION_TYPE_MAX))  {
-               _ERR("invalid function param");
-               return false;
-       }
-
-       int ret_val = bm_check_privilege_battery(invocation);
-       if (ret_val != BATTERY_MONITOR_ERROR_NONE) {
-               _ERR("privilege check failed, ret-val - %d", ret_val);
-               goto RETURN;
-       }
-
-       int battery_usage = 0;
-
-       ret_val = bm_engine_get_total_usage_by_app_id(app_id, duration, &battery_usage);
-       if (ret_val != BATTERY_MONITOR_ERROR_NONE) {
-               _ERR("failed to get battery usage");
-               goto RETURN;
-       }
-
-       _INFO("battery usage - %d", battery_usage);
-
-RETURN:
-       if (ret_val != BATTERY_MONITOR_ERROR_NONE) {
-               GError* error = g_error_new(bm_error_quark(), ret_val, "info not available");
-               g_dbus_method_invocation_return_gerror(invocation, error);
-               g_error_free(error);
-       } else {
-               battery_monitor_complete_get_total_usage_by_app_id(obj, invocation, battery_usage);
-       }
-
-       EXIT;
-       return true;
-}
-
-gboolean
 bm_get_total_mah_usage_by_app_id_custom_interval(BatteryMonitor *obj, GDBusMethodInvocation *invocation,
                                const gchar *app_id, gint64 start_time, gint64 end_time, gint uid)
 {
@@ -222,7 +137,6 @@ bm_get_total_mah_usage_by_app_id_custom_interval(BatteryMonitor *obj, GDBusMetho
                _ERR("failed to get battery usage");
                goto RETURN;
        }
-//     battery_usage = 90.35;
 
        _DBG("Battery Usage %lf ", battery_usage);
 
@@ -240,48 +154,6 @@ RETURN:
 }
 
 gboolean
-bm_get_total_usage_by_resource_id(BatteryMonitor *obj, GDBusMethodInvocation *invocation,
-                                       gint resource_id, gint duration, gint uid)
-{
-       ENTER;
-
-       _INFO("resource_id [%d], duration [%d]", resource_id, duration);
-
-       if ((resource_id >= BM_PLUGIN_ID_MAX) || (duration >= BM_DURATION_TYPE_MAX))  {
-               _ERR("invalid function param");
-               return false;
-       }
-
-       int ret_val = bm_check_privilege_battery(invocation);
-       if (ret_val != BATTERY_MONITOR_ERROR_NONE) {
-               _ERR("privilege check failed, ret-val - %d", ret_val);
-               goto RETURN;
-       }
-
-       int battery_usage = 0;
-
-       ret_val = bm_engine_get_total_usage_by_resource_id(resource_id, duration, &battery_usage);
-       if (ret_val != BATTERY_MONITOR_ERROR_NONE) {
-               _ERR("failed to get battery usage");
-               goto RETURN;
-       }
-
-       _INFO("battery usage - %d", battery_usage);
-
-RETURN:
-       if (ret_val != BATTERY_MONITOR_ERROR_NONE) {
-               GError* error = g_error_new(bm_error_quark(), ret_val, "info not available");
-               g_dbus_method_invocation_return_gerror(invocation, error);
-               g_error_free(error);
-       } else {
-               battery_monitor_complete_get_total_usage_by_resource_id(obj, invocation, battery_usage);
-       }
-
-       EXIT;
-       return true;
-}
-
-gboolean
 bm_get_total_mah_usage_by_resource_id_custom_interval(BatteryMonitor *obj, GDBusMethodInvocation *invocation,
                                gint resource_id, gint64 start_time, gint64 end_time, gint uid)
 {
@@ -307,7 +179,6 @@ bm_get_total_mah_usage_by_resource_id_custom_interval(BatteryMonitor *obj, GDBus
                _ERR("failed to get battery usage");
                goto RETURN;
        }
-//     battery_usage = 30.55;
 
        _INFO("battery usage - %lf", battery_usage);
 
@@ -325,72 +196,6 @@ RETURN:
 }
 
 gboolean
-bm_get_all_resource_usage(BatteryMonitor *obj, GDBusMethodInvocation *invocation,
-                               const gchar *app_id, gint duration, gint uid)
-{
-       ENTER;
-
-       _INFO("app_id [%s], duration [%d]", app_id, duration);
-
-       if (!app_id || (duration >= BM_DURATION_TYPE_MAX))  {
-               _ERR("invalid function param");
-               return false;
-       }
-
-       bm_total_consumption_h battery_data = NULL;
-
-       int ret_val = bm_check_privilege_battery(invocation);
-       if (ret_val != BATTERY_MONITOR_ERROR_NONE) {
-               _ERR("privilege check failed, ret-val - %d", ret_val);
-               goto RETURN;
-       }
-
-       GVariant *battery_variant = NULL;
-
-       battery_data = (bm_total_consumption_h)calloc(1, sizeof(struct battery_total_consumption_s));
-       if (battery_data == NULL) {
-               ret_val = BATTERY_MONITOR_ERROR_OUT_OF_MEMORY;
-               _ERR("memory allocation failed");
-               goto RETURN;
-       }
-
-       _INFO("before request to engine");
-
-       ret_val = bm_engine_get_all_resource_usage(app_id, duration, battery_data);
-       if (ret_val != BATTERY_MONITOR_ERROR_NONE) {
-               _ERR("failed to get battery data");
-               goto RETURN;
-       }
-
-       _INFO("after request to engine");
-#ifdef DISABLE_FEATURE_DATA_FROM_GPS_HRM_PLUGIN
-       _INFO("data received - bt[%d], wifi[%d], cpu[%d], dp[%d], dn[%d], gps[%d], hrm[%d], bat[%d]",
-                       battery_data->ble_val, battery_data->wifi_val, battery_data->cpu_val, battery_data->dp_val,
-                       battery_data->dn_val, battery_data->gps_val, battery_data->hrm_val, battery_data->bat_val);
-#else
-       _INFO("data received - bt[%d], wifi[%d], cpu[%d], dp[%d], dn[%d], bat[%d]",
-                       battery_data->ble_val, battery_data->wifi_val, battery_data->cpu_val, battery_data->dp_val,
-                       battery_data->dn_val, battery_data->bat_val);
-#endif
-       if (ret_val == BATTERY_MONITOR_ERROR_NONE)
-               battery_variant = bm_marshal_serialized_data(battery_data);
-
-RETURN:
-       if (ret_val != BATTERY_MONITOR_ERROR_NONE) {
-               GError* error = g_error_new(bm_error_quark(), ret_val, "info not available");
-               g_dbus_method_invocation_return_gerror(invocation, error);
-               g_error_free(error);
-       } else {
-               battery_monitor_complete_get_all_resource_usage(obj, invocation, battery_variant);
-       }
-
-       BM_FREE(battery_data);
-
-       EXIT;
-       return true;
-}
-
-gboolean
 bm_get_usage_handle_by_app_id_for_all_resource_id_custom_interval(BatteryMonitor *obj, GDBusMethodInvocation *invocation,
                                const gchar *app_id, gint64 start_time, gint64 end_time, gint uid)
 {
@@ -412,7 +217,6 @@ bm_get_usage_handle_by_app_id_for_all_resource_id_custom_interval(BatteryMonitor
        }
 
        GVariant *battery_variant = NULL;
-       // Need to replace with double type structures
        battery_data = (bm_total_consumption_h)calloc(1, sizeof(struct battery_total_consumption_s));
        if (battery_data == NULL) {
                ret_val = BATTERY_MONITOR_ERROR_OUT_OF_MEMORY;
@@ -456,20 +260,12 @@ static int bm_set_dbus_interface_handles(BatteryMonitorIface *iface)
 
        BM_RETURN_VAL((iface != NULL), {}, BATTERY_MONITOR_ERROR_INVALID_PARAMETER, "interface handle is null");
 
-       iface->handle_get_usage_by_app_id_for_resource_id = &bm_get_usage_by_app_id_for_resource_id;
-
        iface->handle_get_mah_usage_by_app_id_for_resource_id_custom_interval = &bm_get_mah_usage_by_app_id_for_resource_id_custom_interval;
 
-       iface->handle_get_total_usage_by_app_id = &bm_get_total_usage_by_app_id;
-
        iface->handle_get_total_mah_usage_by_app_id_custom_interval = &bm_get_total_mah_usage_by_app_id_custom_interval;
 
-       iface->handle_get_total_usage_by_resource_id = &bm_get_total_usage_by_resource_id;
-
        iface->handle_get_total_mah_usage_by_resource_id_custom_interval = &bm_get_total_mah_usage_by_resource_id_custom_interval;
 
-       iface->handle_get_all_resource_usage = &bm_get_all_resource_usage;
-
        iface->handle_get_usage_handle_by_app_id_for_all_resource_id_custom_interval = &bm_get_usage_handle_by_app_id_for_all_resource_id_custom_interval;
 
        EXIT;
index 1b0bf60..da75f4f 100644 (file)
@@ -1518,18 +1518,6 @@ static appid_usage_s* bm_query_usage_by_appid(sqlite3 *bm_db_handle, const char
                                                NULL, ("The database isn't connected."));
        BM_MEMSET(query, 0x00, BATTERY_MONITOR_SQL_LEN_MAX);
 
-/*
-#ifdef DISABLE_FEATURE_DATA_FROM_GPS_HRM_PLUGIN
-       BM_SNPRINTF(query, sizeof(query), "SELECT AppId, sum(rId_ble), sum(rId_wifi), sum(rId_cpu), \
-               sum(rId_display), sum(rId_device_network), sum(rId_gps), sum(rId_hrm) FROM %s WHERE \
-               AppId = '%s' AND log_time >= %ld", BATTERY_MONITOR_APP_ID_USAGE_TABLE, app_id, duration);
-#else
-       BM_SNPRINTF(query, sizeof(query), "SELECT AppId, sum(rId_ble), sum(rId_wifi), sum(rId_cpu), \
-               sum(rId_display), sum(rId_device_network) FROM %s WHERE \
-               AppId = '%s' AND log_time >= %ld", BATTERY_MONITOR_APP_ID_USAGE_TABLE, app_id, duration);
-#endif
-*/
-
        BM_SNPRINTF(query, sizeof(query), "SELECT AppId, sum(rId_ble), sum(rId_wifi), sum(rId_cpu), \
                sum(rId_display), sum(rId_device_network), sum(rId_gps) FROM %s WHERE \
                AppId = ? AND log_time >= ?", BATTERY_MONITOR_APP_ID_USAGE_TABLE);
@@ -1601,18 +1589,6 @@ static appid_usage_s* bm_query_usage_by_appid_ci(sqlite3 *bm_db_handle, const ch
        long int e_t = (long)e_time;
        char query[BATTERY_MONITOR_SQL_LEN_MAX] = {0, };
        BM_MEMSET(query, 0x00, BATTERY_MONITOR_SQL_LEN_MAX);
-/*
-#ifdef DISABLE_FEATURE_DATA_FROM_GPS_HRM_PLUGIN
-       BM_SNPRINTF(query, sizeof(query), "SELECT AppId, sum(rId_ble), sum(rId_wifi), sum(rId_cpu), \
-               sum(rId_display), sum(rId_device_network), sum(rId_gps), sum(rId_hrm) FROM %s WHERE \
-               AppId = '%s' AND log_time > %ld AND log_time < %ld", BATTERY_MONITOR_APP_ID_USAGE_TABLE,
-               app_id, s_t, e_t);
-#else
-       BM_SNPRINTF(query, sizeof(query), "SELECT AppId, sum(rId_ble), sum(rId_wifi), sum(rId_cpu), \
-               sum(rId_display), sum(rId_device_network) FROM %s WHERE AppId = '%s' AND \
-               log_time > %ld AND log_time < %ld", BATTERY_MONITOR_APP_ID_USAGE_TABLE, app_id, s_t, e_t);
-#endif
-*/
        BM_SNPRINTF(query, sizeof(query), "SELECT AppId, sum(rId_ble), sum(rId_wifi), sum(rId_cpu), \
                sum(rId_display), sum(rId_device_network), sum(rId_gps) FROM %s WHERE \
                AppId = ? AND log_time > ? AND log_time < ? ", BATTERY_MONITOR_APP_ID_USAGE_TABLE);