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>
23 #include <sensorctl_log.h>
25 #include "tester_manager.h"
26 #include "tester_sensor.h"
28 #define NAME_MAX_TEST 32
29 #define ARGC_BASE 3 /* e.g. {sensorctl, test, accelerometer} */
31 bool tester_manager::process(int argc, char *argv[])
43 /* 1. get sensor type */
44 type = get_sensor_type(argv[2]);
45 if (type == UNKNOWN_SENSOR) {
46 _E("ERROR : failed to process injector\n");
50 /* 2. set up injector */
51 tester_interface *tester = new tester_sensor();
54 /* 3. test sensor with options */
55 option_count = argc - ARGC_BASE;
56 for (i = 0; i < option_count; ++i) {
57 options[i] = new char[NAME_MAX_TEST];
58 strcpy(options[i], argv[ARGC_BASE+i]);
61 tester->test(type, option_count, options);
66 void tester_manager::usage(void)
68 PRINT("usage: sensorctl test <sensor_type> [interval] [event_count] [test_count]\n\n");
72 PRINT("interval_ms:\n");
73 PRINT(" interval. default value is 100ms.\n");
74 PRINT("event count(n):\n");
75 PRINT(" test sensor until it gets n event. default is 999999(infinitly).\n");
76 PRINT("test count(n):\n");
77 PRINT(" test sensor in n times repetitively, default is 1.\n\n");