4 * Copyright (c) 2015 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.
22 #include <sensor_internal.h>
24 #include <sensor_common.h>
28 #include "check-sensor.h"
32 printf("Usage : ./multi-sensor <TIMEOUT> <interval>(optional)\n\n");
34 printf("time for which the parallel sensor test cases should run\n");
36 printf("interval:\n");
37 printf("The time interval should be entered based on the sampling frequency supported by accelerometer driver on the device in ms.\n");
38 printf("If no value for sensor is entered default value by the driver will be used.\n");
39 printf("arg[i].sensor_type: ");
40 printf("[accelerometer] ");
41 printf("[auto_rotation]\n");
42 printf("[gyroscope] ");
43 printf("[pressure] ");
44 printf("[temperature] ");
45 printf("[geomagnetic] ");
46 printf("[orientation] ");
49 printf("[linear_accel] ");
50 printf("[rotation_vector] ");
51 printf("[geomagnetic_rv] ");
52 printf("[gaming_rv] ");
53 printf("[ultraviolet] ");
55 printf("[gyro_uncal]");
56 printf("[face_down]");
60 int main(int argc, char **argv)
64 int interval = DEFAULT_EVENT_INTERVAL;
65 int TIMEOUT = 10; //in seconds for which all the sensor tests should run
72 TIMEOUT = atoi(argv[1]);
79 TIMEOUT = atoi(argv[1]);
80 interval = atoi(argv[2]);
81 if (TIMEOUT == 0 || interval == 0) {
87 int MAX = 6, j = 0, k = 0;
88 struct pthread_arguments arg[MAX];
91 arg[0].sensor_type = ACCELEROMETER_SENSOR;
92 arg[0].event = ACCELEROMETER_RAW_DATA_EVENT;
93 arg[1].sensor_type = GYROSCOPE_SENSOR;
94 arg[1].event = GYROSCOPE_RAW_DATA_EVENT;
95 arg[2].sensor_type = GEOMAGNETIC_RV_SENSOR;
96 arg[2].event = GEOMAGNETIC_RV_RAW_DATA_EVENT;
97 arg[3].sensor_type = PRESSURE_SENSOR;
98 arg[3].event = PRESSURE_RAW_DATA_EVENT;
99 arg[4].sensor_type = PROXIMITY_SENSOR;
100 arg[4].event = PROXIMITY_CHANGE_STATE_EVENT;
101 arg[5].sensor_type = LIGHT_SENSOR;
102 arg[5].event = LIGHT_LUX_DATA_EVENT;
104 for (t = 0; t < MAX; t++)
105 arg[t].interval = interval;
107 pthread_t thread_id[MAX];
109 for (j = 0; j < MAX; j++)
110 pthread_create(&thread_id[j], NULL, check_sensor, (void*)&arg[j]);