ITs-device_display.c
ITs-device_power.c
ITs-device_ir.c
+ ITs-device_battery.c
)
ENDIF()
* @{
*/
-#ifndef COMMON_IOT
//& set: Device
bool g_bDeviceBatteryLevelCallback;
* @{
*/
+#if (defined(MOBILE) || defined(WEARABLE))
//& purpose: To get the battery charge percentage.
//& type: auto
/**
return 0;
}
-#endif //COMMON_IOT
+#endif //MOBILE || WEARABLE
+
+//& purpose: To get the battery health information.
+//& type: auto
+/**
+* @testcase ITc_device_battery_get_health_p
+* @since_tizen 3.0
+* @author SRID(arvin.mittal)
+* @reviewer SRID(a.pandia1)
+* @type auto
+* @description To get the battery health information.
+* @scenario Gets the battery health information.
+* @apicovered device_battery_get_health
+* @passcase When device_battery_get_health is successful
+* @failcase If target API device_battery_get_health fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_device_battery_get_health_p(void)
+{
+ START_TEST;
+
+ device_battery_health_e eDeviceBatteryHealth = -1;
+
+ // Target API
+ int nRet = device_battery_get_health(&eDeviceBatteryHealth);
+ PRINT_RESULT(DEVICE_ERROR_NONE, nRet, "device_battery_get_health", DeviceGetError(nRet));
+
+ if ( eDeviceBatteryHealth < DEVICE_BATTERY_HEALTH_GOOD || eDeviceBatteryHealth > DEVICE_BATTERY_HEALTH_OVER_VOLTAGE)
+ {
+ FPRINTF("[Line : %d][%s] device_battery_get_health failed with invalid value\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ return 0;
+}
+
+//& purpose: To get the battery power source information.
+//& type: auto
+/**
+* @testcase ITc_device_battery_get_power_source_p
+* @since_tizen 3.0
+* @author SRID(arvin.mittal)
+* @reviewer SRID(a.pandia1)
+* @type auto
+* @description To get the battery power source information.
+* @scenario Gets the battery power source information.
+* @apicovered device_battery_get_power_source
+* @passcase When device_battery_get_power_source is successful
+* @failcase If target API device_battery_get_power_source fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_device_battery_get_power_source_p(void)
+{
+ START_TEST;
+
+ device_battery_power_source_e eDeviceBatteryPowerSource = -1;
+
+ // Target API
+ int nRet = device_battery_get_power_source(&eDeviceBatteryPowerSource);
+ PRINT_RESULT(DEVICE_ERROR_NONE, nRet, "device_battery_get_power_source", DeviceGetError(nRet));
+
+ //If device is connected via USB then DEVICE_BATTERY_POWER_SOURCE_USB is used, otherwise it needs to be changed.
+ if ( eDeviceBatteryPowerSource < DEVICE_BATTERY_POWER_SOURCE_NONE || eDeviceBatteryPowerSource > DEVICE_BATTERY_POWER_SOURCE_WIRELESS)
+ {
+ FPRINTF("[Line : %d][%s] device_battery_get_power_source failed with wrong value\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ return 0;
+}
+
+//& purpose: To get the battery properties.
+//& type: auto
+/**
+* @testcase ITc_device_battery_get_property_p
+* @since_tizen 3.0
+* @author SRID(arvin.mittal)
+* @reviewer SRID(a.pandia1)
+* @type auto
+* @description To get the battery properties.
+* @scenario Gets the battery properties.
+* @apicovered device_battery_get_property
+* @passcase When device_battery_get_property is successful
+* @failcase If target API device_battery_get_property fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_device_battery_get_property_p(void)
+{
+ START_TEST;
+
+ device_battery_property_e eDeviceBatteryProperty[] = {DEVICE_BATTERY_PROPERTY_CAPACITY, DEVICE_BATTERY_PROPERTY_CURRENT_NOW, DEVICE_BATTERY_PROPERTY_CURRENT_AVERAGE};
+ int nDeviceBatteryPropertyArraySize = sizeof(eDeviceBatteryProperty) / sizeof(eDeviceBatteryProperty[0]);
+ int nValue;
+ int nRet, nLoopCount;
+ // Target API
+ for(nLoopCount = 0; nLoopCount < nDeviceBatteryPropertyArraySize; nLoopCount++)
+ {
+ nValue = -1;
+ nRet = device_battery_get_property(eDeviceBatteryProperty[nLoopCount], &nValue);
+ PRINT_RESULT(DEVICE_ERROR_NONE, nRet, "device_battery_get_property", DeviceGetError(nRet));
+ if (nValue < 0)
+ {
+ FPRINTF("[Line : %d][%s] device_battery_get_property failed with invalid value\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+//& purpose: To get the battery power source information.
+//& type: auto
+/**
+* @testcase ITc_device_battery_get_status_p
+* @since_tizen 3.0
+* @author SRID(arvin.mittal)
+* @reviewer SRID(a.pandia1)
+* @type auto
+* @description To get the battery power source information.
+* @scenario Gets the battery power source information.
+* @apicovered device_battery_get_status
+* @passcase When device_battery_get_status is successful
+* @failcase If target API device_battery_get_status fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_device_battery_get_status_p(void)
+{
+ START_TEST;
+
+ device_battery_status_e eDeviceBatteryStatus = -1;
+
+ // Target API
+ int nRet = device_battery_get_status(&eDeviceBatteryStatus);
+ PRINT_RESULT(DEVICE_ERROR_NONE, nRet, "device_battery_get_status", DeviceGetError(nRet));
+
+ if ( eDeviceBatteryStatus < DEVICE_BATTERY_STATUS_CHARGING || eDeviceBatteryStatus > DEVICE_BATTERY_STATUS_NOT_CHARGING)
+ {
+ FPRINTF("[Line : %d][%s] device_battery_get_status failed with wrong value\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ return 0;
+}
/** @} */
/** @} */
\ No newline at end of file
extern void ITs_device_display_cleanup(void);
extern void ITs_device_power_startup(void);
extern void ITs_device_power_cleanup(void);
+extern void ITs_device_battery_startup(void);
+extern void ITs_device_battery_cleanup(void);
extern int ITc_device_display_get_numbers_p(void);
extern int ITc_device_display_get_max_brightness_p(void);
extern int ITc_device_display_change_get_state_p(void);
extern int ITc_device_power_request_release_lock_p(void);
extern int ITc_power_wakeup_p(void);
+extern int ITc_device_battery_get_health_p(void);
+extern int ITc_device_battery_get_power_source_p(void);
+extern int ITc_device_battery_get_property_p(void);
+extern int ITc_device_battery_get_status_p(void);
testcase tc_array[] = {
{"ITc_device_display_get_numbers_p", ITc_device_display_get_numbers_p, ITs_device_display_startup, ITs_device_display_cleanup},
{"ITc_device_display_change_get_state_p", ITc_device_display_change_get_state_p, ITs_device_display_startup, ITs_device_display_cleanup},
{"ITc_device_power_request_release_lock_p", ITc_device_power_request_release_lock_p, ITs_device_power_startup, ITs_device_power_cleanup},
{"ITc_power_wakeup_p", ITc_power_wakeup_p, ITs_device_power_startup, ITs_device_power_cleanup},
+ {"ITc_device_battery_get_health_p", ITc_device_battery_get_health_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
+ {"ITc_device_battery_get_power_source_p", ITc_device_battery_get_power_source_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
+ {"ITc_device_battery_get_property_p", ITc_device_battery_get_property_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
+ {"ITc_device_battery_get_status_p", ITc_device_battery_get_status_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
{NULL, NULL}
};
extern int ITc_device_battery_get_percent_p(void);
extern int ITc_device_battery_is_charging_p(void);
extern int ITc_device_battery_get_level_status_p(void);
+extern int ITc_device_battery_get_health_p(void);
+extern int ITc_device_battery_get_power_source_p(void);
+extern int ITc_device_battery_get_property_p(void);
+extern int ITc_device_battery_get_status_p(void);
extern int ITc_device_display_get_numbers_p(void);
extern int ITc_device_display_get_max_brightness_p(void);
extern int ITc_device_display_set_get_brightness_p(void);
{"ITc_device_battery_get_percent_p", ITc_device_battery_get_percent_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
{"ITc_device_battery_is_charging_p", ITc_device_battery_is_charging_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
{"ITc_device_battery_get_level_status_p", ITc_device_battery_get_level_status_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
+ {"ITc_device_battery_get_health_p", ITc_device_battery_get_health_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
+ {"ITc_device_battery_get_power_source_p", ITc_device_battery_get_power_source_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
+ {"ITc_device_battery_get_property_p", ITc_device_battery_get_property_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
+ {"ITc_device_battery_get_status_p", ITc_device_battery_get_status_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
{"ITc_device_display_get_numbers_p", ITc_device_display_get_numbers_p, ITs_device_display_startup, ITs_device_display_cleanup},
{"ITc_device_display_get_max_brightness_p", ITc_device_display_get_max_brightness_p, ITs_device_display_startup, ITs_device_display_cleanup},
{"ITc_device_display_set_get_brightness_p", ITc_device_display_set_get_brightness_p, ITs_device_display_startup, ITs_device_display_cleanup},
extern void ITs_device_cleanup(void);
extern void ITs_device_ir_startup(void);
extern void ITs_device_ir_cleanup(void);
+extern void ITs_device_battery_startup(void);
+extern void ITs_device_battery_cleanup(void);
extern int ITc_device_display_get_numbers_p(void);
extern int ITc_device_display_change_get_state_p(void);
extern int ITc_device_add_remove_callback_p(void);
extern int ITc_device_ir_is_available_p(void);
extern int ITc_device_ir_transmit_p(void);
+extern int ITc_device_battery_get_health_p(void);
+extern int ITc_device_battery_get_power_source_p(void);
+extern int ITc_device_battery_get_property_p(void);
+extern int ITc_device_battery_get_status_p(void);
testcase tc_array[] = {
{"ITc_device_add_remove_callback_p", ITc_device_add_remove_callback_p, ITs_device_startup, ITs_device_cleanup},
{"ITc_device_ir_is_available_p", ITc_device_ir_is_available_p, ITs_device_ir_startup, ITs_device_ir_cleanup},
{"ITc_device_ir_transmit_p", ITc_device_ir_transmit_p, ITs_device_ir_startup, ITs_device_ir_cleanup},
+ {"ITc_device_battery_get_health_p", ITc_device_battery_get_health_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
+ {"ITc_device_battery_get_power_source_p", ITc_device_battery_get_power_source_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
+ {"ITc_device_battery_get_property_p", ITc_device_battery_get_property_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
+ {"ITc_device_battery_get_status_p", ITc_device_battery_get_status_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
{NULL, NULL}
};
extern int ITc_device_battery_get_percent_p(void);
extern int ITc_device_battery_is_charging_p(void);
extern int ITc_device_battery_get_level_status_p(void);
+extern int ITc_device_battery_get_health_p(void);
+extern int ITc_device_battery_get_power_source_p(void);
+extern int ITc_device_battery_get_property_p(void);
+extern int ITc_device_battery_get_status_p(void);
extern int ITc_device_display_get_numbers_p(void);
extern int ITc_device_display_get_max_brightness_p(void);
extern int ITc_device_display_set_get_brightness_p(void);
{"ITc_device_battery_get_percent_p", ITc_device_battery_get_percent_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
{"ITc_device_battery_is_charging_p", ITc_device_battery_is_charging_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
{"ITc_device_battery_get_level_status_p", ITc_device_battery_get_level_status_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
+ {"ITc_device_battery_get_health_p", ITc_device_battery_get_health_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
+ {"ITc_device_battery_get_power_source_p", ITc_device_battery_get_power_source_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
+ {"ITc_device_battery_get_property_p", ITc_device_battery_get_property_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
+ {"ITc_device_battery_get_status_p", ITc_device_battery_get_status_p, ITs_device_battery_startup, ITs_device_battery_cleanup},
{"ITc_device_display_get_numbers_p", ITc_device_display_get_numbers_p, ITs_device_display_startup, ITs_device_display_cleanup},
{"ITc_device_display_get_max_brightness_p", ITc_device_display_get_max_brightness_p, ITs_device_display_startup, ITs_device_display_cleanup},
{"ITc_device_display_set_get_brightness_p", ITc_device_display_set_get_brightness_p, ITs_device_display_startup, ITs_device_display_cleanup},