4 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include <sensor_internal.h>
25 #include "test_bench.h"
26 #include "sensor_adapter.h"
28 static void basic_cb(sensor_t sensor, unsigned int event_type, sensor_data_t *data, void *user_data)
30 EXPECT_GT(data->timestamp, 0);
34 TESTCASE(interval_test, 20ms_p)
36 int err, count, handle;
41 err = sensord_get_sensors(ACCELEROMETER_SENSOR, &sensors, &count);
44 for (int i = 0; i < count; ++i) {
45 sensord_get_type(sensors[i], &type);
46 sensor_info info(type, 0, 20, 1000, SENSOR_OPTION_ALWAYS_ON, basic_cb, NULL);
48 ret = sensor_adapter::start(info, handle);
53 ret = sensor_adapter::stop(info, handle);
62 TESTCASE(interval_test, 100ms_p)
64 int err, count, handle;
69 err = sensord_get_sensors(ACCELEROMETER_SENSOR, &sensors, &count);
72 for (int i = 0; i < count; ++i) {
73 sensord_get_type(sensors[i], &type);
74 sensor_info info(type, 0, 100, 1000, SENSOR_OPTION_ALWAYS_ON, basic_cb, NULL);
76 ret = sensor_adapter::start(info, handle);
81 ret = sensor_adapter::stop(info, handle);
90 TESTCASE(interval_test, 200ms_p)
92 int err, count, handle;
97 err = sensord_get_sensors(ACCELEROMETER_SENSOR, &sensors, &count);
100 for (int i = 0; i < count; ++i) {
101 sensord_get_type(sensors[i], &type);
102 sensor_info info(type, 0, 200, 1000, SENSOR_OPTION_ALWAYS_ON, basic_cb, NULL);
104 ret = sensor_adapter::start(info, handle);
109 ret = sensor_adapter::stop(info, handle);