From: Priya Kohli Date: Fri, 22 Feb 2019 07:09:03 +0000 (+0530) Subject: [ITC][device][ACR-1343][Added device thermal API to get temperature with thermal... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5800cdfa5f0697b5084779b98d7de16da037705b;p=test%2Ftct%2Fnative%2Fapi.git [ITC][device][ACR-1343][Added device thermal API to get temperature with thermal type] Change-Id: I400ad4314a09734ccc8fc9a46f614019f650e4b7 Signed-off-by: Priya Kohli --- diff --git a/src/itc/device/CMakeLists.txt b/src/itc/device/CMakeLists.txt index 5009f31c4..e5886fff3 100755 --- a/src/itc/device/CMakeLists.txt +++ b/src/itc/device/CMakeLists.txt @@ -15,6 +15,7 @@ SET(TC_SOURCES ITs-device_led.c ITs-device_power.c ITs-device_ir.c + ITs-device_thermal.c ) ENDIF() @@ -28,6 +29,7 @@ SET(TC_SOURCES ITs-device_led.c ITs-device_power.c ITs-device_ir.c + ITs-device_thermal.c ) ENDIF() @@ -41,15 +43,17 @@ SET(TC_SOURCES ITs-device_led.c ITs-device_power.c ITs-device_ir.c + ITs-device_thermal.c ) ENDIF() IF( DEFINED TV ) SET(TC_SOURCES ITs-device.c - ITs-device-common.c - ITs-device_display.c + ITs-device-common.c + ITs-device_display.c ITs-device_power.c ITs-device_ir.c + ITs-device_thermal.c ) ENDIF() diff --git a/src/itc/device/ITs-device-common.h b/src/itc/device/ITs-device-common.h index b9f72d790..033909354 100755 --- a/src/itc/device/ITs-device-common.h +++ b/src/itc/device/ITs-device-common.h @@ -43,6 +43,9 @@ #define DISPLAY_FEATURE "http://tizen.org/feature/camera.back.flash" #define IR_FEATURE "http://tizen.org/feature/consumer_ir" #define DISPLAY_STATE_FEATURE "http://tizen.org/feature/display.state" +#define THERMAL_AP_FEATURE "http://tizen.org/feature/thermistor.ap" +#define THERMAL_CP_FEATURE "http://tizen.org/feature/thermistor.cp" +#define THERMAL_BATTERY_FEATURE "http://tizen.org/feature/thermistor.battery" GMainLoop *g_pDeviceMainLoop; diff --git a/src/itc/device/ITs-device_thermal.c b/src/itc/device/ITs-device_thermal.c new file mode 100755 index 000000000..febe8ba42 --- /dev/null +++ b/src/itc/device/ITs-device_thermal.c @@ -0,0 +1,129 @@ +// +// Copyright (c) 2019 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#include +#include "ITs-device-common.h" + +bool g_bIsThermalAPFeatureSupported; +bool g_bIsThermalCPFeatureSupported; +bool g_bIsThermalBATTERYFeatureSupported; + +/** @addtogroup itc-device +* @ingroup itc +* @{ +*/ + + +//& set: Device + +/** +* @function ITs_device_thermal_startup +* @description Called before each test +* @parameter NA +* @return NA +*/ +void ITs_device_thermal_startup(void) +{ + struct stat stBuff; + if ( stat(ERR_LOG, &stBuff) == 0 ) + { + remove(ERR_LOG); + } + +#if DEBUG + FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_Device_p\\n", __LINE__, API_NAMESPACE); +#endif + + g_bIsThermalAPFeatureSupported = TCTCheckSystemInfoFeatureSupported(THERMAL_AP_FEATURE, API_NAMESPACE); + g_bIsThermalCPFeatureSupported = TCTCheckSystemInfoFeatureSupported(THERMAL_CP_FEATURE, API_NAMESPACE); + g_bIsThermalBATTERYFeatureSupported = TCTCheckSystemInfoFeatureSupported(THERMAL_BATTERY_FEATURE, API_NAMESPACE); + + return; +} + +/** +* @function ITs_device_thermal_cleanup +* @description Called after each test +* @parameter NA +* @return NA +*/ +void ITs_device_thermal_cleanup(void) +{ +#if DEBUG + FPRINTF("[Line : %d][%s] TEST SUIT clean-up: ITs_Device_p\\n", __LINE__, API_NAMESPACE); +#endif + return; +} + + +/** @addtogroup itc-device-thermal +* @brief Integration testcases for module device-thermal +* @ingroup itc-device-thermal +* @{ +*/ + +//& purpose: Gets the temperature value. +//& type: auto +/** +* @testcase ITc_device_thermal_get_temperature_p +* @since_tizen 5.5 +* @author SRID(priya.kohli) +* @reviewer SRID(manoj.g2) +* @type auto +* @description Gets the temperature value. +* @scenario Gets the temperature value in degrees Celsius. +* @apicovered device_thermal_get_temperature +* @passcase If target api device_thermal_get_temperature returns 0. +* @failcase If target api device_thermal_get_temperature fails. +* @precondition NA +* @postcondition NA +*/ +int ITc_device_thermal_get_temperature_p(void) +{ + START_TEST; + + int nRet = -1; + int nThermalType; + + device_thermal_e eDeviceThermalType[] = {DEVICE_THERMAL_AP, + DEVICE_THERMAL_CP, + DEVICE_THERMAL_BATTERY}; + + int nEnumCounter = 0; + int nEnumSize = sizeof(eDeviceThermalType) / sizeof(eDeviceThermalType[0]); + + for (nEnumCounter=0; nEnumCounter < nEnumSize; nEnumCounter++) + { + int nValue; + nThermalType = eDeviceThermalType[nEnumCounter]; + nRet = device_thermal_get_temperature(nThermalType, &nValue); + if ( (!g_bIsThermalAPFeatureSupported && nThermalType == DEVICE_THERMAL_AP) || (!g_bIsThermalCPFeatureSupported && nThermalType == DEVICE_THERMAL_CP) || (!g_bIsThermalBATTERYFeatureSupported && nThermalType == DEVICE_THERMAL_BATTERY) ) + { + PRINT_RESULT(DEVICE_ERROR_NOT_SUPPORTED, nRet, "device_thermal_get_temperature", "Feature Mismatch"); + continue; + } + PRINT_RESULT(DEVICE_ERROR_NONE, nRet, "device_thermal_get_temperature", DeviceGetError(nRet)); + if(nValue < 0) + { + FPRINTF("[Line : %d][%s] device_thermal_get_temperature returns negative nValue value = %d\\n", __LINE__, API_NAMESPACE, nValue); + return 1; + } + } + + return 0; +} + +/** @} */ +/** @} */ diff --git a/src/itc/device/tct-device-native_mobile.h b/src/itc/device/tct-device-native_mobile.h index d5e063a85..b4d0d9e0f 100755 --- a/src/itc/device/tct-device-native_mobile.h +++ b/src/itc/device/tct-device-native_mobile.h @@ -33,6 +33,8 @@ extern void ITs_device_power_startup(void); extern void ITs_device_power_cleanup(void); extern void ITs_device_ir_startup(void); extern void ITs_device_ir_cleanup(void); +extern void ITs_device_thermal_startup(void); +extern void ITs_device_thermal_cleanup(void); extern int ITc_device_add_remove_callback_p(void); extern int ITc_device_haptic_vibrate_stop_p(void); @@ -56,6 +58,7 @@ extern int ITc_device_power_request_release_lock_p(void); extern int ITc_power_wakeup_p(void); extern int ITc_device_ir_is_available_p(void); extern int ITc_device_ir_transmit_p(void); +extern int ITc_device_thermal_get_temperature_p(void); testcase tc_array[] = { {"ITc_device_add_remove_callback_p",ITc_device_add_remove_callback_p,ITs_device_startup,ITs_device_cleanup}, @@ -80,6 +83,7 @@ testcase tc_array[] = { {"ITc_power_wakeup_p",ITc_power_wakeup_p,ITs_device_power_startup,ITs_device_power_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_thermal_get_temperature_p",ITc_device_thermal_get_temperature_p,ITs_device_thermal_startup,ITs_device_thermal_cleanup}, {NULL, NULL} }; diff --git a/src/itc/device/tct-device-native_tizeniot.h b/src/itc/device/tct-device-native_tizeniot.h index d5e063a85..b4d0d9e0f 100755 --- a/src/itc/device/tct-device-native_tizeniot.h +++ b/src/itc/device/tct-device-native_tizeniot.h @@ -33,6 +33,8 @@ extern void ITs_device_power_startup(void); extern void ITs_device_power_cleanup(void); extern void ITs_device_ir_startup(void); extern void ITs_device_ir_cleanup(void); +extern void ITs_device_thermal_startup(void); +extern void ITs_device_thermal_cleanup(void); extern int ITc_device_add_remove_callback_p(void); extern int ITc_device_haptic_vibrate_stop_p(void); @@ -56,6 +58,7 @@ extern int ITc_device_power_request_release_lock_p(void); extern int ITc_power_wakeup_p(void); extern int ITc_device_ir_is_available_p(void); extern int ITc_device_ir_transmit_p(void); +extern int ITc_device_thermal_get_temperature_p(void); testcase tc_array[] = { {"ITc_device_add_remove_callback_p",ITc_device_add_remove_callback_p,ITs_device_startup,ITs_device_cleanup}, @@ -80,6 +83,7 @@ testcase tc_array[] = { {"ITc_power_wakeup_p",ITc_power_wakeup_p,ITs_device_power_startup,ITs_device_power_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_thermal_get_temperature_p",ITc_device_thermal_get_temperature_p,ITs_device_thermal_startup,ITs_device_thermal_cleanup}, {NULL, NULL} }; diff --git a/src/itc/device/tct-device-native_wearable.h b/src/itc/device/tct-device-native_wearable.h index d5e063a85..b4d0d9e0f 100755 --- a/src/itc/device/tct-device-native_wearable.h +++ b/src/itc/device/tct-device-native_wearable.h @@ -33,6 +33,8 @@ extern void ITs_device_power_startup(void); extern void ITs_device_power_cleanup(void); extern void ITs_device_ir_startup(void); extern void ITs_device_ir_cleanup(void); +extern void ITs_device_thermal_startup(void); +extern void ITs_device_thermal_cleanup(void); extern int ITc_device_add_remove_callback_p(void); extern int ITc_device_haptic_vibrate_stop_p(void); @@ -56,6 +58,7 @@ extern int ITc_device_power_request_release_lock_p(void); extern int ITc_power_wakeup_p(void); extern int ITc_device_ir_is_available_p(void); extern int ITc_device_ir_transmit_p(void); +extern int ITc_device_thermal_get_temperature_p(void); testcase tc_array[] = { {"ITc_device_add_remove_callback_p",ITc_device_add_remove_callback_p,ITs_device_startup,ITs_device_cleanup}, @@ -80,6 +83,7 @@ testcase tc_array[] = { {"ITc_power_wakeup_p",ITc_power_wakeup_p,ITs_device_power_startup,ITs_device_power_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_thermal_get_temperature_p",ITc_device_thermal_get_temperature_p,ITs_device_thermal_startup,ITs_device_thermal_cleanup}, {NULL, NULL} };