[ITC][device][ACR-1343][Added device thermal API to get temperature with thermal... 64/200364/7
authorPriya Kohli <priya.kohli@samsung.com>
Fri, 22 Feb 2019 07:09:03 +0000 (12:39 +0530)
committerNibha Sharma <nibha.sharma@samsung.com>
Thu, 28 Feb 2019 10:54:13 +0000 (10:54 +0000)
Change-Id: I400ad4314a09734ccc8fc9a46f614019f650e4b7
Signed-off-by: Priya Kohli <priya.kohli@samsung.com>
src/itc/device/CMakeLists.txt
src/itc/device/ITs-device-common.h
src/itc/device/ITs-device_thermal.c [new file with mode: 0755]
src/itc/device/tct-device-native_mobile.h
src/itc/device/tct-device-native_tizeniot.h
src/itc/device/tct-device-native_wearable.h

index 5009f31c402d8ba528b85162737ee21fe81eb034..e5886fff3c9f74876340d6a1e699988656a5f719 100755 (executable)
@@ -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()
 
index b9f72d790e9606c7c98d5ea24d000a7bd24ce1ee..03390935412e935eed695a00b9a39aeb6d79aab4 100755 (executable)
@@ -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 (executable)
index 0000000..febe8ba
--- /dev/null
@@ -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 <device/temperature.h>
+#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;
+}
+
+/** @} */
+/** @} */
index d5e063a85b6fa2fe3fec21b9eee36f27704362e4..b4d0d9e0f0998a99e032dc4add35623bee96ba03 100755 (executable)
@@ -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}
 };
 
index d5e063a85b6fa2fe3fec21b9eee36f27704362e4..b4d0d9e0f0998a99e032dc4add35623bee96ba03 100755 (executable)
@@ -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}
 };
 
index d5e063a85b6fa2fe3fec21b9eee36f27704362e4..b4d0d9e0f0998a99e032dc4add35623bee96ba03 100755 (executable)
@@ -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}
 };