ADD_SUBDIRECTORY(src/shared)
ADD_SUBDIRECTORY(src/hal)
ADD_SUBDIRECTORY(src/test)
-ADD_SUBDIRECTORY(src/sensorctl)
%defattr(-,root,root,-)
%{_bindir}/api-test
%{_bindir}/sensor-test
-%{_bindir}/sensorctl
%{_bindir}/multi-thread-performance-test
%{_bindir}/multi-process-performance-test
%{_bindir}/fusion-data-collection
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(sensorctl CXX)
-INCLUDE(GNUInstallDirs)
-
-SET(DEPS glib-2.0 gio-2.0)
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED ${DEPS})
-
-INCLUDE_DIRECTORIES(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_SOURCE_DIR}/src/hal/
- ${CMAKE_SOURCE_DIR}/src/client/
- ${CMAKE_SOURCE_DIR}/src/shared/
-)
-
-FOREACH(flag ${pkgs_CFLAGS})
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -fPIE")
-
-# Installing files
-FILE(GLOB_RECURSE SRCS *.cpp)
-ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} sensor)
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin/)
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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 <stdlib.h>
-#include <glib.h>
-#include <gio/gio.h>
-#include <sensorctl_log.h>
-
-static GDBusConnection *connection;
-
-bool dbus_init(void)
-{
- GError *error = NULL;
- gchar *gaddr;
-
- if (connection)
- return true;
-
-#ifndef GLIB_VERSION_2_36
- g_type_init();
-#endif
-
- gaddr = g_dbus_address_get_for_bus_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
-
- if (!gaddr) {
- PRINT("ERROR: Failed to get dbus address : %s", error->message);
- g_error_free(error);
- error = NULL;
- return false;
- }
-
- connection = g_dbus_connection_new_for_address_sync(gaddr,
- (GDBusConnectionFlags)(G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT
- | G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION),
- NULL, NULL, &error);
- g_free(gaddr);
-
- if (!connection) {
- PRINT("ERROR: Failed to get dbus connection : %s", error->message);
- g_error_free(error);
- error = NULL;
- return false;
- }
-
- PRINT("G-DBUS connected[%s]\n",
- g_dbus_connection_get_unique_name(connection));
- return true;
-}
-
-bool dbus_fini(void)
-{
- if (!connection)
- return true;
-
- g_dbus_connection_close_sync(connection, NULL, NULL);
- g_object_unref(connection);
- connection = NULL;
-
- return true;
-}
-
-bool dbus_emit_signal(gchar *dest_bus_name, gchar *object_path,
- gchar *interface_name, gchar *signal_name,
- GVariant *variant, GError **error)
-{
- g_dbus_connection_emit_signal(connection,
- dest_bus_name,
- object_path,
- interface_name,
- signal_name,
- variant,
- error);
- return true;
-}
-
-GVariant *make_variant_int(int count, char *options[])
-{
- switch (count) {
- case 1:
- return g_variant_new("(i)", atoi(options[0]));
- case 2:
- return g_variant_new("(ii)", atoi(options[0]), atoi(options[1]));
- case 3:
- return g_variant_new("(iii)", atoi(options[0]), atoi(options[1]), atoi(options[2]));
- default:
- break;
- }
-
- return NULL;
-}
-
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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.
- *
- */
-
-#pragma once // _DBUS_UTIL_H_
-
-#include <glib.h>
-#include <gio/gio.h>
-
-bool dbus_init(void);
-bool dbus_fini(void);
-bool dbus_emit_signal(gchar *dest_bus_name, gchar *object_path,
- gchar *interface_name, gchar *signal_name,
- GVariant *variant, GError **error);
-GVariant *make_variant_int(int count, char *options[]);
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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 <stdio.h>
-#include <glib.h>
-#include <sensor_internal.h>
-#include <sensorctl_log.h>
-#include "info_manager.h"
-
-bool info_manager::process(int argc, char *argv[])
-{
- sensor_type_t type;
-
- if (argc == 2) {
- usage();
- return false;
- }
-
- type = get_sensor_type(argv[2]);
- if (type == UNKNOWN_SENSOR)
- return false;
-
- sensor_t *sensors;
- int count;
-
- sensord_get_sensor_list(type, &sensors, &count);
- sensor_info(sensors, count);
-
- delete sensors;
- return true;
-}
-
-void info_manager::sensor_info(sensor_t *sensors, int count)
-{
- sensor_t sensor;
- char *vendor;
- char *name;
- float min_range;
- float max_range;
- float resolution;
- int min_interval;
- int fifo_count;
- int max_batch_count;
-
- for (int i = 0; i < count; ++i) {
- sensor = sensors[i];
-
- name = const_cast<char *>(sensord_get_name(sensor));
- vendor = const_cast<char *>(sensord_get_vendor(sensor));
- sensord_get_max_range(sensor, &max_range);
- sensord_get_min_range(sensor, &min_range);
- sensord_get_resolution(sensor, &resolution);
- sensord_get_min_interval(sensor, &min_interval);
- sensord_get_fifo_count(sensor, &fifo_count);
- sensord_get_max_batch_count(sensor, &max_batch_count);
-
- PRINT("-------sensor[%d] information-------\n", i);
- PRINT("vendor : %s\n", vendor);
- PRINT("name : %s\n", name);
- PRINT("min_range : %f\n", min_range);
- PRINT("max_range : %f\n", max_range);
- PRINT("resolution : %f\n", resolution);
- PRINT("min_interval : %d\n", min_interval);
- PRINT("fifo_count : %d\n", fifo_count);
- PRINT("max_batch_count : %d\n", max_batch_count);
- PRINT("--------------------------------\n");
- }
-}
-
-void info_manager::usage(void)
-{
- PRINT("usage: sensorctl info <sensor_type>\n");
- PRINT("\n");
-
- usage_sensors();
-}
-
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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.
- *
- */
-
-#pragma once // _INFO_MANAGER_H_
-
-#include <sensor_internal.h>
-#include "sensor_manager.h"
-
-class info_manager : public sensor_manager {
-public:
- info_manager() {}
- virtual ~info_manager() {}
-
- bool process(int argc, char *argv[]);
-private:
- void sensor_info(sensor_t *sensors, int count);
- void usage(void);
-};
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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.
- *
- */
-
-#pragma once // _INJECTOR_H_
-
-#include <sensor_internal.h>
-
-#define SENSORD_BUS_NAME "org.tizen.system.sensord"
-#define SENSORD_OBJ_PATH "/Org/Tizen/System/SensorD"
-#define SENSORD_INTERFACE_NAME "org.tizen.system.sensord"
-
-class injector_interface {
-public:
- virtual bool init(void) { return true; }
- virtual bool inject(int option_count, char *options[]) = 0;
-};
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2016 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 <stdio.h>
-#include <glib.h>
-#include <gio/gio.h>
-#include <sensorctl_log.h>
-#include "dbus_util.h"
-#include "injector_manager.h"
-#include "injector_context_orientation.h"
-
-#define CONTEXT_ORIENTATION_SIGNAL "orientation"
-
-bool injector_context_orientation::inject(int option_count, char *options[])
-{
- GVariant *variant;
-
- if (option_count == 0) {
- _E("ERROR: invalid argument\n");
- return false;
- }
-
- variant = make_variant_int(option_count, options);
-
- if (variant == NULL)
- return false;
-
- dbus_emit_signal(NULL,
- (gchar *)SENSORD_OBJ_PATH,
- (gchar *)SENSORD_INTERFACE_NAME,
- (gchar *)CONTEXT_ORIENTATION_SIGNAL,
- variant,
- NULL);
-
- PRINT("set options to context: \n");
- for(int i=0; i<option_count; ++i)
- PRINT("option %d: %s\n", i, options[i]);
-
- return true;
-}
-
-REGISTER_INJECTOR(CONTEXT_SENSOR, CONTEXT_ORIENTATION_SIGNAL, injector_context_orientation)
-
-
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2016 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.
- *
- */
-
-#pragma once // _CONTEXT_INJECTOR_H_
-
-#include <glib.h>
-#include <gio/gio.h>
-#include "injector.h"
-
-class injector_context_orientation: public injector_interface {
-public:
- injector_context_orientation() {}
- virtual ~injector_context_orientation() {}
-
- bool inject(int option_count, char *options[]);
-};
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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 <stdio.h>
-#include <string.h>
-#include <sensor_internal.h>
-#include <sensorctl_log.h>
-#include "dbus_util.h"
-#include "injector.h"
-#include "injector_manager.h"
-
-#define NAME_MAX_TEST 32
-#define ARGC_BASE 4 /* e.g. {sensorctl, inject, wristup, conf} */
-
-static std::vector<injector_info> injector_infos;
-
-injector_manager::injector_manager()
-{
- if (!dbus_init()) {
- _E("Failed to init dbus");
- throw;
- }
-}
-
-injector_manager::~injector_manager()
-{
- dbus_fini();
-}
-
-bool injector_manager::register_injector(injector_info info)
-{
- injector_infos.push_back(info);
- return true;
-}
-
-injector_interface *injector_manager::get_injector(sensor_type_t type, const char *name)
-{
- int injector_count;
- injector_count = injector_infos.size();
-
- for (int i = 0; i < injector_count; ++i) {
- if (type == injector_infos[i].type &&
- !strcmp(injector_infos[i].name, name))
- return injector_infos[i].injector;
- }
- return NULL;
-}
-
-bool injector_manager::process(int argc, char *argv[])
-{
- int option_count;
- char *options[8];
- bool result;
- sensor_type_t type;
- char *event_name;
- int i;
-
- if (argc < 4) {
- usage();
- return false;
- }
-
- /* 1. get sensor type */
- type = get_sensor_type(argv[2]);
- if (type == UNKNOWN_SENSOR) {
- _E("ERROR : failed to process injector\n");
- return false;
- }
-
- /* 2. set up injector */
- event_name = argv[3];
-
- injector_interface *injector = get_injector(type, event_name);
- if (injector == NULL) {
- _E("ERROR: cannot find matched injector\n");
- return false;
- }
-
- /* 3. init injector */
- result = injector->init();
- if (!result) {
- _E("ERROR: failed to init injector\n");
- return false;
- }
-
- /* 4. inject event with options */
- option_count = argc - ARGC_BASE;
- for (i = 0; i < option_count; ++i) {
- options[i] = new char[NAME_MAX_TEST];
- strcpy(options[i], argv[ARGC_BASE+i]);
- }
-
- result = injector->inject(option_count, options);
- if (!result) {
- _E("ERROR : failed to process injector\n");
- for (i = 0; i < option_count; ++i)
- delete options[i];
-
- return false;
- }
-
- for (i = 0; i < option_count; ++i)
- delete options[i];
-
- return true;
-}
-
-void injector_manager::usage(void)
-{
- PRINT("usage: sensorctl inject <sensor_type> [<event_type>] [<options>]\n\n");
-
- usage_sensors();
-}
-
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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.
- *
- */
-
-#pragma once // _INJECT_MANAGER_H_
-
-#include <sensor_internal.h>
-#include <vector>
-#include "injector.h"
-#include "sensor_manager.h"
-
-#define REGISTER_INJECTOR(sensor_type, sensor_name, injector_type) \
-static void __attribute__((constructor)) reg_injector(void) \
-{ \
- struct injector_info info; \
- info.type = (sensor_type); \
- info.name = (sensor_name); \
- info.injector = new(std::nothrow) (injector_type)(); \
- if (!info.injector) { \
- _E("ERROR: Failed to allocate memory(%s)", #injector_type); \
- return; \
- } \
- injector_manager::register_injector(info); \
-}
-
-struct injector_info {
- sensor_type_t type;
- const char *name;
- injector_interface *injector;
-};
-
-class injector_manager : public sensor_manager {
-public:
- injector_manager();
- virtual ~injector_manager();
-
- bool process(int argc, char *argv[]);
-
- static bool register_injector(injector_info info);
-private:
- injector_interface *get_injector(sensor_type_t type, const char *name);
- void usage(void);
-};
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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 <stdio.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <gio/gio.h>
-#include <map>
-#include <string>
-#include <sensorctl_log.h>
-#include "dbus_util.h"
-#include "injector_manager.h"
-#include "injector_wristup_algo.h"
-
-#define WRISTUP_ALGO_SIGNAL "algo"
-#define OPTION_INDEX 0
-
-typedef std::map<std::string, int> option_map_t;
-static option_map_t option_map;
-
-bool injector_wristup_algo::init(void)
-{
- option_map.insert(option_map_t::value_type("auto", 0));
- option_map.insert(option_map_t::value_type("green", 1));
- option_map.insert(option_map_t::value_type("purple", 2));
- option_map.insert(option_map_t::value_type("red", 3));
-
- return true;
-}
-
-bool injector_wristup_algo::inject(int option_count, char *options[])
-{
- int option;
-
- if (option_count == 0) {
- _E("ERROR: invalid argument\n");
- return false;
- }
-
- option_map_t::iterator it;
- it = option_map.find(options[OPTION_INDEX]);
-
- if (it == option_map.end()) {
- _E("ERROR: no matched-option: %s\n", options[OPTION_INDEX]);
- return false;
- }
-
- option = it->second;
-
- dbus_emit_signal(NULL,
- (gchar *)SENSORD_OBJ_PATH,
- (gchar *)SENSORD_INTERFACE_NAME,
- (gchar *)WRISTUP_ALGO_SIGNAL,
- g_variant_new("(i)", option),
- NULL);
-
- _I("set [%s] mode to wristup (%d)", options[OPTION_INDEX], option);
- return true;
-}
-
-REGISTER_INJECTOR(MOTION_SENSOR, "algo", injector_wristup_algo)
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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.
- *
- */
-
-#pragma once // _WRISTUP_INJECTOR_H_
-
-#include <glib.h>
-#include <gio/gio.h>
-#include "injector.h"
-
-class injector_wristup_algo: public injector_interface {
-public:
- injector_wristup_algo() {}
- virtual ~injector_wristup_algo() {}
-
- bool init(void);
- bool inject(int option_count, char *options[]);
-};
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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 <stdio.h>
-#include <glib.h>
-#include <gio/gio.h>
-#include <sensorctl_log.h>
-#include "dbus_util.h"
-#include "injector_manager.h"
-#include "injector_wristup_conf.h"
-
-#define WRISTUP_CONF_SIGNAL "conf"
-
-bool injector_wristup_conf::inject(int option_count, char *options[])
-{
- GVariant *variant;
-
- if (option_count == 0) {
- _E("ERROR: invalid argument\n");
- return false;
- }
-
- variant = make_variant_int(option_count, options);
-
- if (variant == NULL)
- return false;
-
- dbus_emit_signal(NULL,
- (gchar *)SENSORD_OBJ_PATH,
- (gchar *)SENSORD_INTERFACE_NAME,
- (gchar *)WRISTUP_CONF_SIGNAL,
- variant,
- NULL);
-
- PRINT("set options to wristup: \n");
- for(int i=0; i<option_count; ++i)
- PRINT("option %d: %s\n", i, options[i]);
-
- return true;
-}
-
-REGISTER_INJECTOR(MOTION_SENSOR, "conf", injector_wristup_conf)
-
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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.
- *
- */
-
-#pragma once // _WRISTUP_INJECTOR_H_
-
-#include <glib.h>
-#include <gio/gio.h>
-#include "injector.h"
-
-#define NAME_MAX_TEST 32
-
-class injector_wristup_conf: public injector_interface {
-public:
- injector_wristup_conf() {}
- virtual ~injector_wristup_conf() {}
-
- bool inject(int option_count, char *options[]);
-};
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2016 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.
- *
- */
-
-#pragma once // _COMMON_H_
-
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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 <string.h>
-#include <stdlib.h>
-#include <macro.h>
-#include <sensorctl_log.h>
-#include "sensor_manager.h"
-
-#define NAME_MAX_TEST 32
-
-struct sensor_info {
- sensor_type_t type;
- char name[NAME_MAX_TEST];
- /* if manual is true, the way of injecting fake event will be created */
- bool manual;
-};
-
-static struct sensor_info sensor_infos[] = {
- {ALL_SENSOR, "all", false},
-
- // General Sensors
- {ACCELEROMETER_SENSOR, "accelerometer", false},
- {GRAVITY_SENSOR, "gravity", false},
- {LINEAR_ACCEL_SENSOR, "linear_accel", false},
- {GEOMAGNETIC_SENSOR, "magnetic", false},
- {ROTATION_VECTOR_SENSOR, "rotation_vector", false},
- {ORIENTATION_SENSOR, "orientation", false},
- {GYROSCOPE_SENSOR, "gyroscope", false},
- {LIGHT_SENSOR, "light", false},
- {PROXIMITY_SENSOR, "proximity", true},
- {PRESSURE_SENSOR, "pressure", false},
- {ULTRAVIOLET_SENSOR, "ultraviolet", false},
- {TEMPERATURE_SENSOR, "temperature", false},
- {HUMIDITY_SENSOR, "humidity", false},
- {HRM_RAW_SENSOR, "hrm_raw", false},
- {HRM_SENSOR, "hrm", false},
- {HRM_LED_GREEN_SENSOR, "hrm_led_green", false},
- {HRM_LED_IR_SENSOR, "hrm_led_ir", false},
- {HRM_LED_RED_SENSOR, "hrm_led_red", false},
- {GYROSCOPE_UNCAL_SENSOR, "gyro_uncal", false},
- {GEOMAGNETIC_UNCAL_SENSOR, "mag_uncal", false},
- {GYROSCOPE_RV_SENSOR, "gyro_rv", false},
- {GEOMAGNETIC_RV_SENSOR, "mag_rv", false},
-
- {HUMAN_PEDOMETER_SENSOR, "pedo", true},
- {HUMAN_SLEEP_MONITOR_SENSOR,"sleep_monitor", true},
-
- /*
- {AUTO_ROTATION_SENSOR, "auto_rotation", true},
- {AUTO_BRIGHTNESS_SENSOR, "auto_brightness", true},
- {MOTION_SENSOR, "motion", true},
- {PIR_SENSOR, "pir", true},
- {PIR_LONG_SENSOR, "pir_long", true},
- {DUST_SENSOR, "dust", false},
- {THERMOMETER_SENSOR, "thermometer", false},
- {FLAT_SENSOR, "flat", true},
- {TILT_SENSOR, "tilt", false},
- {RV_RAW_SENSOR, "rv_raw", false},
- {EXERCISE_SENSOR, "exercise", false},
- {GSR_SENSOR, "gsr", false},
- {SIMSENSE_SENSOR, "simsense", false},
- {PPG_SENSOR, "ppg", false},
-
- {GESTURE_MOVEMENT_SENSOR, "movement", true},
- {GESTURE_WRIST_UP_SENSOR, "wristup", true},
- {GESTURE_WRIST_DOWN_SENSOR, "wristdown", true},
- {GESTURE_MOVEMENT_STATE_SENSOR, "movement_state",true},
-
- {WEAR_STATUS_SENSOR, "wear_status", true},
- {WEAR_ON_MONITOR_SENSOR, "wear_on", true},
- {GPS_BATCH_SENSOR, "gps_batch", true},
- {ACTIVITY_TRACKER_SENSOR, "activity_tracker", true},
- {SLEEP_DETECTOR_SENSOR, "sleep_detector", true},
- {NO_MOVE_DETECTOR_SENSOR, "no_move", true},
- {HRM_CTRL_SENSOR, "hrm_ctrl", true},
- {EXERCISE_COACH_SENSOR, "ex_coach", true},
- {EXERCISE_HR_SENSOR, "ex_hr", true},
- {RESTING_HR_SENSOR, "resting_hr", true},
- {STEP_LEVEL_MONITOR_SENSOR, "step_level", true},
- {ACTIVITY_LEVEL_MONITOR_SENSOR, "activity", true},
- {CYCLE_MONITOR_SENSOR, "cycle", true},
- {STRESS_MONITOR_SENSOR, "stress", true},
- {AUTOSESSION_EXERCISE_SENSOR,"autosesstion", true},
- {STAIR_TRACKER_SENSOR, "stair_tracker", true}
- */
-
-};
-
-bool sensor_manager::process(int argc, char *argv[])
-{
- return false;
-}
-
-void sensor_manager::usage_sensors(void)
-{
- PRINT("The sensor types are:\n");
- int sensor_count = ARRAY_SIZE(sensor_infos);
-
- for (int i = 0; i < sensor_count; ++i)
- PRINT(" %d: %s(%d)\n", i, sensor_infos[i].name, sensor_infos[i].type);
- PRINT("\n");
-}
-
-sensor_type_t sensor_manager::get_sensor_type(char *name)
-{
- int index;
- int sensor_count = ARRAY_SIZE(sensor_infos);
-
- if (is_number(name))
- return (sensor_type_t) (atoi(name));
-
- for (index = 0; index < sensor_count; ++index) {
- if (!strcmp(sensor_infos[index].name, name))
- break;
- }
-
- if (index == sensor_count) {
- _E("ERROR: sensor name is wrong\n");
- usage_sensors();
- return UNKNOWN_SENSOR;
- }
- return sensor_infos[index].type;
-}
-
-const char *sensor_manager::get_sensor_name(sensor_type_t type)
-{
- int index;
- int sensor_count = ARRAY_SIZE(sensor_infos);
-
- for (index = 0; index < sensor_count; ++index) {
- if (sensor_infos[index].type == type)
- break;
- }
-
- if (index == sensor_count) {
- _E("ERROR: sensor name is wrong\n");
- usage_sensors();
- return "UNKNOWN SENSOR";
- }
- return sensor_infos[index].name;
-}
-
-bool sensor_manager::is_number(char *value)
-{
- if (value == NULL || *value == 0)
- return false;
-
- while (*value) {
- if (*value < '0' || *value > '9')
- return false;
- value++;
- }
-
- return true;
-}
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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.
- *
- */
-
-#pragma once // _SENSOR_MANAGER_H_
-
-#include <sensor_internal.h>
-
-class sensor_manager {
-public:
- virtual bool process(int argc, char *argv[]);
-protected:
- void usage_sensors(void);
-
- sensor_type_t get_sensor_type(char *name);
- const char * get_sensor_name(sensor_type_t type);
-private:
- bool is_number(char *value);
-};
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sensorctl_log.h>
-#include "sensor_manager.h"
-#include "tester_manager.h"
-#include "injector_manager.h"
-#include "info_manager.h"
-
-static void good_bye(void)
-{
-}
-
-static void signal_handler(int signo)
-{
- _E("\nReceived SIGNAL(%d)\n", signo);
- exit(EXIT_SUCCESS);
-
- return;
-}
-
-void usage(void)
-{
- PRINT("usage: sensorctl <command> <sensor_type> [<args>]\n");
-
- PRINT("The sensorctl commands are:\n");
- PRINT(" test: test sensor(s)\n");
- PRINT(" inject: inject the event to sensor\n");
- PRINT(" info: show sensor infos\n");
-}
-
-sensor_manager *create_manager(int argc, char *argv[2])
-{
- sensor_manager *manager = NULL;
-
- if (!strcmp(argv[1], "test"))
- manager = new(std::nothrow) tester_manager;
- if (!strcmp(argv[1], "inject"))
- manager = new(std::nothrow) injector_manager;
- if (!strcmp(argv[1], "info"))
- manager = new(std::nothrow) info_manager;
-
- if (!manager) {
- _E("failed to allocate memory for manager");
- return NULL;
- }
-
- return manager;
-}
-
-int main(int argc, char *argv[])
-{
- atexit(good_bye);
-
- signal(SIGINT, signal_handler);
- signal(SIGHUP, signal_handler);
- signal(SIGTERM, signal_handler);
- signal(SIGQUIT, signal_handler);
- signal(SIGABRT, signal_handler);
-
- if (argc < 2) {
- usage();
- return 0;
- }
-
- sensor_manager *manager = create_manager(argc, argv);
- if (!manager) {
- usage();
- return 0;
- }
-
- manager->process(argc, argv);
-
- return 0;
-}
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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.
- *
- */
-
-#pragma once // _SENSORCTL_LOG_H_
-
-#include <glib.h>
-#include <stdio.h>
-
-#define KNRM "\x1B[0m"
-#define KRED "\x1B[31m"
-#define KGRN "\x1B[32m"
-#define KYEL "\x1B[33m"
-#define KBLU "\x1B[34m"
-#define KMAG "\x1B[35m"
-#define KCYN "\x1B[36m"
-#define KWHT "\x1B[37m"
-#define RESET "\033[0m"
-
-#define RED(str) KRED str RESET;
-#define GRN(str) KGRN str RESET;
-
-#define PRINT(fmt, args...) \
- do { \
- g_print(fmt, ##args); \
- } while (0)
-
-#define _E(fmt, args...) \
- do { \
- g_print("\x1B[31m" fmt "\033[0m", ##args); \
- } while (0)
-
-#define _I(fmt, args...) \
- do { \
- g_print("\x1B[32m" fmt "\033[0m", ##args); \
- } while (0)
-
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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.
- *
- */
-
-#pragma once // _TESTER_H_
-
-#include <sensor_internal.h>
-
-class tester_interface {
-public:
- virtual bool init(void) = 0;
- virtual bool test(sensor_type_t type, int option_count, char *options[]) = 0;
-};
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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 <stdio.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <gio/gio.h>
-#include <sensor_internal.h>
-#include <sensorctl_log.h>
-#include <functional>
-#include <tester_auto.h>
-
-static void test_cb(sensor_t sensor, unsigned int event_type, sensor_data_t *data, void *user_data)
-{
-
-}
-
-static void test_func(const char *name, std::function<bool()> func)
-{
- bool ret = func();
-
- /*
- if (ret) PRINT(GRN "[PASS] %s", name);
- else PRINT(RED "[FAIL] %s", name);
- */
-}
-
-static bool operate_sensor(sensor_type_t type)
-{
- sensor_t sensor = sensord_get_sensor(type);
- return false;
-}
-
-static bool start_sensor(sensor_t sensor)
-{
- return false;
-}
-
-static bool read_sensor(sensor_t sensor)
-{
- return false;
-}
-
-static bool is_supported(sensor_type_t type, sensor_t sensor)
-{
- return false;
-}
-
-bool tester_auto::init(void)
-{
- return true;
-}
-
-bool tester_auto::test(sensor_type_t type, int option_count, char *options[])
-{
- /*
- sensor_t *list = sensord_get_sensors(ALL_SENSOR);
- for (int i = 0; i< ARRAY_SIZE(list); ++i) {
- sensor_type_t type = sensord_get_type(list[i]);
- */
- sensor_t sensor = sensord_get_sensor(ACCELEROMETER_SENSOR);
- test_func("SENSOR_NAME", std::bind(operate_sensor, ACCELEROMETER_SENSOR));
- test_func("SENSOR_NAME", std::bind(start_sensor, sensor));
- test_func("SENSOR_NAME", std::bind(read_sensor, sensor));
- test_func("SENSOR_NAME", std::bind(is_supported, ACCELEROMETER_SENSOR, sensor));
- //}
-}
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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.
- *
- */
-
-#pragma once // _TESTER_AUTO_H_
-
-#include <glib.h>
-#include <gio/gio.h>
-#include <sensor_internal.h>
-#include <functional>
-
-#include "tester.h"
-
-class tester_auto : public tester_interface {
-public:
- tester_auto() {}
- virtual ~tester_auto() {}
-
- virtual bool init(void);
- virtual bool test(sensor_type_t type, int option_count, char *options[]);
-};
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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 <stdio.h>
-#include <string.h>
-#include <sensor_internal.h>
-#include <sensorctl_log.h>
-#include "tester.h"
-#include "tester_manager.h"
-#include "tester_sensor.h"
-
-#define NAME_MAX_TEST 32
-#define ARGC_BASE 3 /* e.g. {sensorctl, test, accelerometer} */
-
-bool tester_manager::process(int argc, char *argv[])
-{
- int option_count;
- char *options[8];
- sensor_type_t type;
- int i;
-
- if (argc == 2) {
- usage();
- return false;
- }
-
- /* 1. get sensor type */
- type = get_sensor_type(argv[2]);
- if (type == UNKNOWN_SENSOR) {
- _E("ERROR : failed to process injector\n");
- return false;
- }
-
- /* 2. set up injector */
- tester_interface *tester = new tester_sensor();
- tester->init();
-
- /* 3. test sensor with options */
- option_count = argc - ARGC_BASE;
- for (i = 0; i < option_count; ++i) {
- options[i] = new char[NAME_MAX_TEST];
- strcpy(options[i], argv[ARGC_BASE+i]);
- }
-
- tester->test(type, option_count, options);
-
- return true;
-}
-
-void tester_manager::usage(void)
-{
- PRINT("usage: sensorctl test <sensor_type> [interval] [event_count] [test_count]\n\n");
-
- usage_sensors();
-
- PRINT("interval_ms:\n");
- PRINT(" interval. default value is 100ms.\n");
- PRINT("event count(n):\n");
- PRINT(" test sensor until it gets n event. default is 999999(infinitly).\n");
- PRINT("test count(n):\n");
- PRINT(" test sensor in n times repetitively, default is 1.\n\n");
-}
-
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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.
- *
- */
-
-#pragma once // _TEST_MANAGER_H_
-
-#include "sensor_manager.h"
-
-class tester_manager : public sensor_manager {
-public:
- tester_manager() {}
- virtual ~tester_manager() {}
-
- bool process(int argc, char *argv[]);
-private:
- void usage(void);
-};
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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 <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <gio/gio.h>
-#include <sensor_internal.h>
-#include <sensorctl_log.h>
-#include "tester_sensor.h"
-
-#define DEFAULT_INTERVAL 100
-#define DEFAULT_LATENCY 0
-#define DEFAULT_TEST_COUNT 1
-#define DEFAULT_EVENT_COUNT 9999
-
-#define SENSOR_SHIFT_TYPE 16
-
-static GMainLoop *mainloop;
-static int check_loop;
-
-static const char *result_str(bool result) {
- if (result) return KGRN"[PASS]"RESET;
- else return KRED"[FAIL]"RESET;
-}
-
-bool tester_sensor::init(void)
-{
- return true;
-}
-
-void tester_sensor::test_cb(sensor_t sensor, unsigned int event_type, sensor_data_t *data, void *user_data)
-{
- sensor_type_t type;
- int *cnt_event;
-
- sensord_get_type(sensor, &type);
-
- cnt_event = (int *)user_data;
-
- if (check_loop++ >= *cnt_event) {
- if (!mainloop)
- return;
-
- g_main_loop_quit(mainloop);
- g_main_loop_unref(mainloop);
- mainloop = NULL;
- return;
- }
-
- PRINT("[%llu] %s:", data->timestamp, sensord_get_name(sensor));
-
- if (type == GESTURE_WRIST_UP_SENSOR) {
- PRINT("[%d]\n", ((sensorhub_data_t *)data)->hub_data[0]);
- return;
- }
-
- for (int i = 0; i < data->value_count; ++i)
- PRINT(" [%f]", data->values[i]);
- PRINT("\n");
-}
-
-void tester_sensor::test_sensor(sensor_type_t type, int interval, int latency, int cnt_test, int cnt_event)
-{
- bool result;
- sensor_t sensor;
- unsigned int event_id;
- sensor_data_t data;
- int handle;
- int count = 0;
-
- event_id = type << SENSOR_SHIFT_TYPE | 0x1;
-
- while (count++ < cnt_test) {
- mainloop = g_main_loop_new(NULL, FALSE);
- check_loop = 0;
-
- PRINT("=======================================\n");
- PRINT("TEST(%d/%d)\n", count, cnt_test);
- PRINT("=======================================\n");
-
- sensor = sensord_get_sensor(type);
- PRINT("%s sensord_get_sensor: sensor(%p)\n", result_str(sensor==NULL?0:1), sensor);
-
- handle = sensord_connect(sensor);
- PRINT("%s sensord_connect: handle(%d)\n", result_str((handle >= 0)), handle);
-
- result = sensord_register_event(handle, event_id, interval, latency, test_cb, (void *)&cnt_event);
- PRINT("%s sensord_register_event\n", result_str(result));
-
- result = sensord_start(handle, 3);
- PRINT("%s sensord_start\n", result_str(result));
-
- result = sensord_get_data(handle, event_id, &data);
- PRINT("%s sensord_get_data\n", result_str(result));
-
- result = sensord_flush(handle);
- PRINT("%s sensord_flush\n", result_str(result));
-
- if (result) {
- for (int i = 0; i < data.value_count; ++i)
- PRINT("[%f] ", data.values[i]);
- PRINT("\n");
- }
-
- g_main_loop_run(mainloop);
-
- result = sensord_unregister_event(handle, event_id);
- PRINT("%s sensord_unregister_event: handle(%d)\n", result_str(result), handle);
- result = sensord_stop(handle);
- PRINT("%s sensord_stop: handle(%d)\n", result_str(result), handle);
- result = sensord_disconnect(handle);
- PRINT("%s sensord_disconnect: handle(%d)\n", result_str(result), handle);
- }
-}
-
-bool tester_sensor::test(sensor_type_t type, int option_count, char *options[])
-{
- int interval = DEFAULT_INTERVAL;
- int latency = DEFAULT_LATENCY;
- int cnt_test = DEFAULT_TEST_COUNT;
- int cnt_event = DEFAULT_EVENT_COUNT;
-
- sensor_type_t sensor_type = type;
-
- if (option_count >= 1)
- interval = atoi(options[0]);
- if (option_count >= 2)
- cnt_event = atoi(options[1]);
- if (option_count >= 3)
- cnt_test = atoi(options[2]);
-
- test_sensor(sensor_type, interval, latency, cnt_test, cnt_event);
- return true;
-}
+++ /dev/null
-/*
- * sensorctl
- *
- * Copyright (c) 2015 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.
- *
- */
-
-#pragma once // _SENSOR_TESTER_H_
-
-#include "tester.h"
-
-class tester_sensor : public tester_interface {
-public:
- tester_sensor() {}
- virtual ~tester_sensor() {}
-
- virtual bool init(void);
- virtual bool test(sensor_type_t type, int option_count, char *options[]);
-private:
- void test_sensor(sensor_type_t type, int interval, int latency, int cnt_test, int cnt_event);
- static void test_cb(sensor_t sensor, unsigned int event_type, sensor_data_t *data, void *user_data);
-};