[UTC][device][ACR-1343][Add device_thermal_get_temperature] 60/200260/5
authorlokilee73 <changjoo.lee@samsung.com>
Thu, 21 Feb 2019 02:20:26 +0000 (11:20 +0900)
committerAmritanshu Pandia <a.pandia1@samsung.com>
Thu, 21 Feb 2019 07:10:57 +0000 (07:10 +0000)
Change-Id: Id3cf2074d27496388c3d1e817cbb90cf6fe3f05c
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
src/utc/device/CMakeLists.txt [changed mode: 0644->0755]
src/utc/device/public.list [changed mode: 0755->0644]
src/utc/device/tct-device-core_mobile.h
src/utc/device/tct-device-core_tizeniot.h
src/utc/device/tct-device-core_wearable.h
src/utc/device/utc-system-device-thermal.c [new file with mode: 0644]

old mode 100644 (file)
new mode 100755 (executable)
index 2b09999..d9610a2
@@ -11,6 +11,7 @@ SET(TC_SOURCES
     utc-system-device-callback.c
     utc-system-device-display.c
     utc-system-device-power.c
+    utc-system-device-thermal.c
 )
 ENDIF()
 
@@ -20,6 +21,7 @@ SET(TC_SOURCES ${TC_SOURCES}
     utc-system-device-haptic.c
     utc-system-device-led.c
     utc-system-device-ir.c
+    utc-system-device-thermal.c
 )
 ENDIF()
 
@@ -29,7 +31,6 @@ PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
        capi-system-info
        glib-2.0
        dlog
-       
 )
 
 INCLUDE_DIRECTORIES(
old mode 100755 (executable)
new mode 100644 (file)
index 7f50031..ad4904b
@@ -1,4 +1,4 @@
-device_add_callback 
+device_add_callback
 device_battery_get_level_status
 device_battery_get_percent
 device_battery_is_charging
@@ -7,23 +7,24 @@ device_battery_get_power_source
 device_battery_get_status
 device_battery_get_property
 device_display_change_state
-device_display_get_brightness 
-device_display_get_max_brightness 
-device_display_get_numbers 
+device_display_get_brightness
+device_display_get_max_brightness
+device_display_get_numbers
 device_display_get_state
-device_display_set_brightness 
-device_flash_get_brightness 
-device_flash_get_max_brightness 
-device_flash_set_brightness 
-device_haptic_close 
-device_haptic_get_count 
-device_haptic_open 
-device_haptic_stop 
-device_haptic_vibrate 
-device_led_play_custom 
-device_led_stop_custom 
-device_power_release_lock 
-device_power_request_lock 
-device_power_wakeup 
-device_remove_callback 
+device_display_set_brightness
+device_flash_get_brightness
+device_flash_get_max_brightness
+device_flash_set_brightness
+device_haptic_close
+device_haptic_get_count
+device_haptic_open
+device_haptic_stop
+device_haptic_vibrate
+device_led_play_custom
+device_led_stop_custom
+device_power_release_lock
+device_power_request_lock
+device_power_wakeup
+device_remove_callback
+device_thermal_get_temperature
 
index 257d1bce30b4985c2b254a008387e637438f6129..d7c3bb950b6ac28d3db71abec6ff74c2bcd5a441 100755 (executable)
@@ -26,6 +26,8 @@ extern void utc_system_haptic_cleanup(void);
 extern void utc_system_device_ir_startup(void);
 extern void utc_system_device_battery_startup(void);
 extern void utc_system_device_battery_cleanup(void);
+extern void utc_system_device_thermal_startup(void);
+extern void utc_system_device_thermal_cleanup(void);
 
 extern int utc_system_device_add_callback_p(void);
 extern int utc_system_device_add_callback_n_1(void);
@@ -99,6 +101,8 @@ extern int utc_system_device_ir_is_available_n(void);
 extern int utc_system_device_ir_transmit_p(void);
 extern int utc_system_device_ir_transmit_n_1(void);
 extern int utc_system_device_ir_transmit_n_2(void);
+extern int utc_system_device_thermal_get_temperature_p(void);
+extern int utc_system_device_thermal_get_temperature_n(void);
 
 testcase tc_array[] = {
        {"utc_system_device_add_callback_p",utc_system_device_add_callback_p,NULL,NULL},
@@ -173,6 +177,8 @@ testcase tc_array[] = {
        {"utc_system_device_ir_transmit_p",utc_system_device_ir_transmit_p,utc_system_device_ir_startup,NULL},
        {"utc_system_device_ir_transmit_n_1",utc_system_device_ir_transmit_n_1,utc_system_device_ir_startup,NULL},
        {"utc_system_device_ir_transmit_n_2",utc_system_device_ir_transmit_n_2,utc_system_device_ir_startup,NULL},
+       {"utc_system_device_thermal_get_temperature_p",utc_system_device_thermal_get_temperature_p,utc_system_device_thermal_startup,utc_system_device_thermal_cleanup},
+       {"utc_system_device_thermal_get_temperature_n",utc_system_device_thermal_get_temperature_n,utc_system_device_thermal_startup,utc_system_device_thermal_cleanup},
        {NULL, NULL}
 };
 
index 257d1bce30b4985c2b254a008387e637438f6129..d7c3bb950b6ac28d3db71abec6ff74c2bcd5a441 100755 (executable)
@@ -26,6 +26,8 @@ extern void utc_system_haptic_cleanup(void);
 extern void utc_system_device_ir_startup(void);
 extern void utc_system_device_battery_startup(void);
 extern void utc_system_device_battery_cleanup(void);
+extern void utc_system_device_thermal_startup(void);
+extern void utc_system_device_thermal_cleanup(void);
 
 extern int utc_system_device_add_callback_p(void);
 extern int utc_system_device_add_callback_n_1(void);
@@ -99,6 +101,8 @@ extern int utc_system_device_ir_is_available_n(void);
 extern int utc_system_device_ir_transmit_p(void);
 extern int utc_system_device_ir_transmit_n_1(void);
 extern int utc_system_device_ir_transmit_n_2(void);
+extern int utc_system_device_thermal_get_temperature_p(void);
+extern int utc_system_device_thermal_get_temperature_n(void);
 
 testcase tc_array[] = {
        {"utc_system_device_add_callback_p",utc_system_device_add_callback_p,NULL,NULL},
@@ -173,6 +177,8 @@ testcase tc_array[] = {
        {"utc_system_device_ir_transmit_p",utc_system_device_ir_transmit_p,utc_system_device_ir_startup,NULL},
        {"utc_system_device_ir_transmit_n_1",utc_system_device_ir_transmit_n_1,utc_system_device_ir_startup,NULL},
        {"utc_system_device_ir_transmit_n_2",utc_system_device_ir_transmit_n_2,utc_system_device_ir_startup,NULL},
+       {"utc_system_device_thermal_get_temperature_p",utc_system_device_thermal_get_temperature_p,utc_system_device_thermal_startup,utc_system_device_thermal_cleanup},
+       {"utc_system_device_thermal_get_temperature_n",utc_system_device_thermal_get_temperature_n,utc_system_device_thermal_startup,utc_system_device_thermal_cleanup},
        {NULL, NULL}
 };
 
index 257d1bce30b4985c2b254a008387e637438f6129..d7c3bb950b6ac28d3db71abec6ff74c2bcd5a441 100755 (executable)
@@ -26,6 +26,8 @@ extern void utc_system_haptic_cleanup(void);
 extern void utc_system_device_ir_startup(void);
 extern void utc_system_device_battery_startup(void);
 extern void utc_system_device_battery_cleanup(void);
+extern void utc_system_device_thermal_startup(void);
+extern void utc_system_device_thermal_cleanup(void);
 
 extern int utc_system_device_add_callback_p(void);
 extern int utc_system_device_add_callback_n_1(void);
@@ -99,6 +101,8 @@ extern int utc_system_device_ir_is_available_n(void);
 extern int utc_system_device_ir_transmit_p(void);
 extern int utc_system_device_ir_transmit_n_1(void);
 extern int utc_system_device_ir_transmit_n_2(void);
+extern int utc_system_device_thermal_get_temperature_p(void);
+extern int utc_system_device_thermal_get_temperature_n(void);
 
 testcase tc_array[] = {
        {"utc_system_device_add_callback_p",utc_system_device_add_callback_p,NULL,NULL},
@@ -173,6 +177,8 @@ testcase tc_array[] = {
        {"utc_system_device_ir_transmit_p",utc_system_device_ir_transmit_p,utc_system_device_ir_startup,NULL},
        {"utc_system_device_ir_transmit_n_1",utc_system_device_ir_transmit_n_1,utc_system_device_ir_startup,NULL},
        {"utc_system_device_ir_transmit_n_2",utc_system_device_ir_transmit_n_2,utc_system_device_ir_startup,NULL},
+       {"utc_system_device_thermal_get_temperature_p",utc_system_device_thermal_get_temperature_p,utc_system_device_thermal_startup,utc_system_device_thermal_cleanup},
+       {"utc_system_device_thermal_get_temperature_n",utc_system_device_thermal_get_temperature_n,utc_system_device_thermal_startup,utc_system_device_thermal_cleanup},
        {NULL, NULL}
 };
 
diff --git a/src/utc/device/utc-system-device-thermal.c b/src/utc/device/utc-system-device-thermal.c
new file mode 100644 (file)
index 0000000..7f208a8
--- /dev/null
@@ -0,0 +1,104 @@
+//
+// 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 "assert.h"
+#include <device/temperature.h>
+
+//& set: DeviceTemperature
+#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"
+
+static bool ap_supported;
+static bool cp_supported;
+static bool battery_supported;
+
+
+/**
+ * @testcase           utc_system_device_temperature_startup
+ * @since_tizen                5.5
+ * @description                Called before each test
+ */
+void utc_system_device_thermal_startup(void)
+{
+       int ret;
+
+       ret = system_info_get_platform_bool(THERMAL_AP_FEATURE, &ap_supported);
+       ret = system_info_get_platform_bool(THERMAL_CP_FEATURE, &cp_supported);
+       ret = system_info_get_platform_bool(THERMAL_BATTERY_FEATURE, &battery_supported);
+
+       return;
+}
+
+/**
+ * @testcase           utc_system_device_temperature_cleanup
+ * @since_tizen                5.5
+ * @description                Called before each test
+ */
+void utc_system_device_thermal_cleanup(void)
+{
+
+       return;
+}
+
+/**
+ * @testcase           utc_system_device_thermal_get_temperature_p
+ * @since_tizen                5.5
+ * @description                Positive test case of utc_system_device_thermal_get_temperature.
+ */
+int utc_system_device_thermal_get_temperature_p(void)
+{
+       int value;
+       int error;
+
+       if(!ap_supported && !cp_supported && !battery_supported)
+               return 0;
+
+       if (ap_supported) {
+               error = device_thermal_get_temperature(DEVICE_THERMAL_AP, &value);
+               assert_eq(error, DEVICE_ERROR_NONE);
+       }
+
+       if (cp_supported) {
+               error = device_thermal_get_temperature(DEVICE_THERMAL_CP, &value);
+               assert_eq(error, DEVICE_ERROR_NONE);
+       }
+
+       if (battery_supported) {
+               error = device_thermal_get_temperature(DEVICE_THERMAL_BATTERY, &value);
+               assert_eq(error, DEVICE_ERROR_NONE);
+       }
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_system_device_thermal_get_temperature_n
+ * @since_tizen                5.5
+ * @description                Negative test case of utc_system_device_thermal_get_temperature.
+ */
+int utc_system_device_thermal_get_temperature_n(void)
+{
+       int value;
+       int error;
+
+       if(!ap_supported && !cp_supported && !battery_supported)
+               return 0;
+
+       error = device_thermal_get_temperature(1000, &value);
+       assert_eq(error, DEVICE_ERROR_INVALID_PARAMETER);
+
+       return 0;
+}