* battery_usage - battery usage consumption for the app-id
*/
- char app_name[56];
+ char app_name[56] = {0, };
int duration = -1;
int error_code = BATTERY_MONITOR_ERROR_NONE;
int battery_usage = -1;
testapp_print("\n Input AppID using Look Up table:\n");
- if (0 >= scanf("%55[^\n]", app_name)) {
+ if (0 >= scanf("%55s", app_name)) {
testapp_print("Invalid input ");
return FALSE;
}
+ testapp_print("\n AppID: %s \n", app_name);
testapp_print("\n Input Duration using Look Up table:\n");
if (0 >= scanf("%d", &duration)) {
testapp_print("Invalid input ");
return FALSE;
}
+ testapp_print("\n Duration: %d \n", duration);
error_code = battery_monitor_get_total_usage_by_app_id(app_name, duration, &battery_usage);
if (error_code == BATTERY_MONITOR_ERROR_NONE)
testapp_print("Invalid input ");
return FALSE;
}
+ testapp_print("\n ResourceID: %d \n", resource_id);
testapp_print("\n Input Duration using Look Up table:\n");
if (0 >= scanf("%d", &duration)) {
testapp_print("Invalid input ");
return FALSE;
}
+ testapp_print("\n Duration: %d \n", duration);
error_code = battery_monitor_get_total_usage_by_resource_id(resource_id, duration, &battery_usage);
if (error_code == BATTERY_MONITOR_ERROR_NONE)
*/
int duration = -1;
- char app_name[56];
+ char app_name[56] = {0, };
int error_code = BATTERY_MONITOR_ERROR_NONE;
battery_monitor_h data_handle = NULL;
testapp_print("\n Input AppID using Look Up table:\n");
- if (0 >= scanf("%55[^\n]", app_name)) {
+ if (0 >= scanf("%55s", app_name)) {
testapp_print("Invalid input ");
return FALSE;
}
+ testapp_print("\n AppID: %s \n", app_name);
testapp_print("\n Input Duration using Look Up table:\n");
if (0 >= scanf("%d", &duration)) {
testapp_print("Invalid input ");
return FALSE;
}
+ testapp_print("\n Duration: %d \n", duration);
error_code = battery_monitor_get_usage_by_app_id_for_all_resource_id(app_name, duration, &data_handle);
*/
int duration = -1;
- char app_name[56];
+ char app_name[56] = {0, };
int battery_usage = -1;
int resource_id = -1;
int error_code = BATTERY_MONITOR_ERROR_NONE;
testapp_print("\n Input AppID using Look Up table:\n");
- if (0 >= scanf("%55[^\n]", app_name)) {
- testapp_print("Invalid input ");
+ if (0 >= scanf("%55s", app_name)) {
+ testapp_print("Invalid input");
return FALSE;
}
+ testapp_print("\n AppID: %s \n", app_name);
testapp_print("\n Input Duration using Look Up table:\n");
if (0 >= scanf("%d", &duration)) {
testapp_print("Invalid input ");
return FALSE;
}
+ testapp_print("\n Duration: %d \n", duration);
testapp_print("\n Input Resource Id using Look Up Table: \n");
if (0 >= scanf("%d", &resource_id)) {
testapp_print("Invalid input ");
return FALSE;
}
+ testapp_print("\n ResourceID: %d \n", resource_id);
error_code = battery_monitor_get_usage_by_app_id_for_resource_id(app_name, resource_id, duration, &battery_usage);