sensorctl test
[platform/core/system/sensord.git] / src / sensorctl / tester_auto.cpp
1 /*
2  * sensorctl
3  *
4  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <glib.h>
23 #include <gio/gio.h>
24 #include <sensor_internal.h>
25 #include <sensorctl_log.h>
26 #include <functional>
27 #include <tester_auto.h>
28
29 static void test_cb(sensor_t sensor, unsigned int event_type, sensor_data_t *data, void *user_data)
30 {
31
32 }
33
34 static void test_func(const char *name, std::function<bool()> func)
35 {
36         bool ret = func();
37
38         /*
39         if (ret) PRINT(GRN "[PASS] %s", name);
40         else PRINT(RED "[FAIL] %s", name);
41         */
42 }
43
44 static bool operate_sensor(sensor_type_t type)
45 {
46         sensor_t sensor = sensord_get_sensor(type);
47         return false;
48 }
49
50 static bool start_sensor(sensor_t sensor)
51 {
52         return false;
53 }
54
55 static bool read_sensor(sensor_t sensor)
56 {
57         return false;
58 }
59
60 static bool is_supported(sensor_type_t type, sensor_t sensor)
61 {
62         return false;
63 }
64
65 bool tester_auto::init(void)
66 {
67         return true;
68 }
69
70 bool tester_auto::test(sensor_type_t type, int option_count, char *options[])
71 {
72         /*
73         sensor_t *list = sensord_get_sensors(ALL_SENSOR);
74         for (int i = 0; i< ARRAY_SIZE(list); ++i) {
75                 sensor_type_t type = sensord_get_type(list[i]);
76                 */
77         sensor_t sensor = sensord_get_sensor(ACCELEROMETER_SENSOR);
78         test_func("SENSOR_NAME", std::bind(operate_sensor, ACCELEROMETER_SENSOR));
79         test_func("SENSOR_NAME", std::bind(start_sensor, sensor));
80         test_func("SENSOR_NAME", std::bind(read_sensor, sensor));
81         test_func("SENSOR_NAME", std::bind(is_supported, ACCELEROMETER_SENSOR, sensor));
82         //}
83 }