From d48da508dad3b330aa3ceaf02cabcc01ba8ba7d0 Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Sat, 13 Feb 2016 17:43:32 +0900 Subject: [PATCH 01/16] sensord: add the sensord plugin logic for flexibility - if sensord has specific-type sensor plugin, then sensor_loader creates specific-type sensor object and set the handle info to it. - but sensord doesn't have specific-type sensor plugin based on physical_sensor, sensor_loader creates physical_sensor object basically and use it. Change-Id: Iceb5047d6db660c36a63d9deda1c45518eb24570 Signed-off-by: kibak.yoon --- src/server/main.cpp | 2 +- src/server/physical_sensor.cpp | 59 +++---- src/server/physical_sensor.h | 4 +- src/server/plugins/CMakeLists.txt | 3 + src/server/plugins/accel/accel_sensor.cpp | 37 +++++ src/server/plugins/accel/accel_sensor.h | 34 ++++ .../plugins/auto_rotation/auto_rotation_sensor.cpp | 2 +- src/server/sensor_loader.cpp | 185 +++++++++++---------- src/server/sensor_loader.h | 15 +- src/shared/sensor_logs.h | 2 +- 10 files changed, 210 insertions(+), 133 deletions(-) create mode 100644 src/server/plugins/accel/accel_sensor.cpp create mode 100644 src/server/plugins/accel/accel_sensor.h diff --git a/src/server/main.cpp b/src/server/main.cpp index bcf0bb2..6bda15a 100644 --- a/src/server/main.cpp +++ b/src/server/main.cpp @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) signal_init(); - sensor_loader::get_instance().load_sensors(); + sensor_loader::get_instance().load(); server::get_instance().run(); diff --git a/src/server/physical_sensor.cpp b/src/server/physical_sensor.cpp index 7d17901..b230e1c 100644 --- a/src/server/physical_sensor.cpp +++ b/src/server/physical_sensor.cpp @@ -33,20 +33,9 @@ physical_sensor::~physical_sensor() { } -void physical_sensor::set_sensor_handle(sensor_handle_t handle) -{ - m_handle.id = handle.id; - m_handle.name = handle.name; - m_handle.type = handle.type; - m_handle.event_type = handle.event_type; - m_handle.model_name = handle.model_name; - m_handle.vendor = handle.vendor; - m_handle.min_range = handle.min_range; - m_handle.max_range = handle.max_range; - m_handle.resolution = handle.resolution; - m_handle.min_interval = handle.min_interval; - m_handle.max_batch_count = handle.max_batch_count; - m_handle.wakeup_supported = handle.wakeup_supported; +void physical_sensor::set_sensor_handle(const sensor_handle_t *handle) +{ + m_handle = handle; } void physical_sensor::set_sensor_device(sensor_device *device) @@ -56,25 +45,25 @@ void physical_sensor::set_sensor_device(sensor_device *device) sensor_type_t physical_sensor::get_type(void) { - return static_cast(m_handle.type); + return static_cast(m_handle->type); } unsigned int physical_sensor::get_event_type(void) { - return m_handle.event_type; + return m_handle->event_type; } const char* physical_sensor::get_name(void) { - if (!m_handle.name) + if (!m_handle->name) return UNKNOWN_NAME; - return m_handle.name; + return m_handle->name; } uint32_t physical_sensor::get_hal_id(void) { - return m_handle.id; + return m_handle->id; } int physical_sensor::get_poll_fd() @@ -112,7 +101,7 @@ int physical_sensor::get_data(sensor_data_t **data, int *length) return -1; int remains = 0; - remains = m_sensor_device->get_data(m_handle.id, data, length); + remains = m_sensor_device->get_data(m_handle->id, data, length); if (*length < 0) { _E("Failed to get sensor event"); @@ -129,7 +118,7 @@ bool physical_sensor::flush(void) if (!m_sensor_device) return false; - return m_sensor_device->flush(m_handle.id); + return m_sensor_device->flush(m_handle->id); } bool physical_sensor::set_interval(unsigned long interval) @@ -141,7 +130,7 @@ bool physical_sensor::set_interval(unsigned long interval) _I("Polling interval is set to %dms", interval); - return m_sensor_device->set_interval(m_handle.id, interval); + return m_sensor_device->set_interval(m_handle->id, interval); } bool physical_sensor::set_batch_latency(unsigned long latency) @@ -153,7 +142,7 @@ bool physical_sensor::set_batch_latency(unsigned long latency) _I("Polling interval is set to %dms", latency); - return m_sensor_device->set_batch_latency(m_handle.id, latency); + return m_sensor_device->set_batch_latency(m_handle->id, latency); } int physical_sensor::set_attribute(int32_t attribute, int32_t value) @@ -163,7 +152,7 @@ int physical_sensor::set_attribute(int32_t attribute, int32_t value) if (!m_sensor_device) return false; - return m_sensor_device->set_attribute_int(m_handle.id, attribute, value); + return m_sensor_device->set_attribute_int(m_handle->id, attribute, value); } int physical_sensor::set_attribute(int32_t attribute, char *value, int value_len) @@ -173,7 +162,7 @@ int physical_sensor::set_attribute(int32_t attribute, char *value, int value_len if (!m_sensor_device) return false; - return m_sensor_device->set_attribute_str(m_handle.id, attribute, value, value_len); + return m_sensor_device->set_attribute_str(m_handle->id, attribute, value, value_len); } bool physical_sensor::set_wakeup(int wakeup) @@ -188,7 +177,7 @@ bool physical_sensor::on_start() if (!m_sensor_device) return false; - return m_sensor_device->enable(m_handle.id); + return m_sensor_device->enable(m_handle->id); } bool physical_sensor::on_stop() @@ -198,7 +187,7 @@ bool physical_sensor::on_stop() if (!m_sensor_device) return false; - return m_sensor_device->disable(m_handle.id); + return m_sensor_device->disable(m_handle->id); } bool physical_sensor::get_sensor_info(sensor_info &info) @@ -206,16 +195,16 @@ bool physical_sensor::get_sensor_info(sensor_info &info) info.set_type(get_type()); info.set_id(get_id()); info.set_privilege(SENSOR_PRIVILEGE_PUBLIC); // FIXME - info.set_name(m_handle.model_name); - info.set_vendor(m_handle.vendor); - info.set_min_range(m_handle.min_range); - info.set_max_range(m_handle.max_range); - info.set_resolution(m_handle.resolution); - info.set_min_interval(m_handle.min_interval); + info.set_name(m_handle->model_name); + info.set_vendor(m_handle->vendor); + info.set_min_range(m_handle->min_range); + info.set_max_range(m_handle->max_range); + info.set_resolution(m_handle->resolution); + info.set_min_interval(m_handle->min_interval); info.set_fifo_count(0); // FIXME - info.set_max_batch_count(m_handle.max_batch_count); + info.set_max_batch_count(m_handle->max_batch_count); info.set_supported_event(get_event_type()); - info.set_wakeup_supported(m_handle.wakeup_supported); + info.set_wakeup_supported(m_handle->wakeup_supported); return true; } diff --git a/src/server/physical_sensor.h b/src/server/physical_sensor.h index 32cfa38..7722929 100644 --- a/src/server/physical_sensor.h +++ b/src/server/physical_sensor.h @@ -29,7 +29,7 @@ public: virtual ~physical_sensor(); /* setting module */ - void set_sensor_handle(sensor_handle_t handle); + void set_sensor_handle(const sensor_handle_t *handle); void set_sensor_device(sensor_device *device); /* module info */ @@ -46,7 +46,7 @@ public: private: static cmutex m_mutex; - sensor_handle_t m_handle; + const sensor_handle_t *m_handle; sensor_device *m_sensor_device; uint32_t hal_id; diff --git a/src/server/plugins/CMakeLists.txt b/src/server/plugins/CMakeLists.txt index db69cf0..432e427 100644 --- a/src/server/plugins/CMakeLists.txt +++ b/src/server/plugins/CMakeLists.txt @@ -16,6 +16,9 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +SET(DIR_INCLUDE "${DIR_INCLUDE} ${CMAKE_CURRENT_SOURCE_DIR}/accel") +list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/accel/accel_sensor.cpp") + IF("${AUTO_ROTATION}" STREQUAL "ON") list (APPEND DIR_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/auto_rotation") list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/auto_rotation/auto_rotation_alg.cpp") diff --git a/src/server/plugins/accel/accel_sensor.cpp b/src/server/plugins/accel/accel_sensor.cpp new file mode 100644 index 0000000..0c71bc8 --- /dev/null +++ b/src/server/plugins/accel/accel_sensor.cpp @@ -0,0 +1,37 @@ +/* + * sensord + * + * 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 +#include +#include + +accel_sensor::accel_sensor() +{ + _E("accel_sensor is created : 0x%x", this); +} + +accel_sensor::~accel_sensor() +{ + +} + +sensor_type_t accel_sensor::get_type(void) +{ + return ACCELEROMETER_SENSOR; +} diff --git a/src/server/plugins/accel/accel_sensor.h b/src/server/plugins/accel/accel_sensor.h new file mode 100644 index 0000000..309f91b --- /dev/null +++ b/src/server/plugins/accel/accel_sensor.h @@ -0,0 +1,34 @@ +/* + * sensord + * + * 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. + * + */ + +#ifndef _ACCEL_SENSOR_H_ +#define _ACCEL_SENSOR_H_ + +#include + +class accel_sensor : public physical_sensor { +public: + accel_sensor(); + ~accel_sensor(); + + sensor_type_t get_type(void); +}; + +#endif /* _ACCEL_SENSOR_H_ */ + diff --git a/src/server/plugins/auto_rotation/auto_rotation_sensor.cpp b/src/server/plugins/auto_rotation/auto_rotation_sensor.cpp index e819c2b..68e4b80 100644 --- a/src/server/plugins/auto_rotation/auto_rotation_sensor.cpp +++ b/src/server/plugins/auto_rotation/auto_rotation_sensor.cpp @@ -186,7 +186,7 @@ void auto_rotation_sensor::synthesize(const sensor_event_t& event) push(rotation_event); - _D("Rotation: %d, ACC[0]: %f, ACC[1]: %f, ACC[2]: %f", rotation, event.data.values[0], event.data.values[1], event.data.values[2]); + _D("Rotation: %d, ACC[0]: %f, ACC[1]: %f, ACC[2]: %f", rotation, event.data->values[0], event.data->values[1], event.data->values[2]); return; } diff --git a/src/server/sensor_loader.cpp b/src/server/sensor_loader.cpp index 7a90ffb..a2bee31 100644 --- a/src/server/sensor_loader.cpp +++ b/src/server/sensor_loader.cpp @@ -29,6 +29,7 @@ #include #include +#include #ifdef ENABLE_AUTO_ROTATION #include #endif @@ -50,15 +51,47 @@ sensor_loader& sensor_loader::get_instance() return inst; } -bool sensor_loader::load_devices(const string &path, vector &devices, void* &handle) +bool sensor_loader::load(void) +{ + std::vector device_plugin_paths; + std::vector unique_device_plugin_paths; + + get_paths_from_dir(string(DEVICE_PLUGINS_DIR_PATH), device_plugin_paths); + + std::unordered_set s; + auto unique = [&s](vector &paths, const string &path) { + if (s.insert(path).second) + paths.push_back(path); + }; + + for_each(device_plugin_paths.begin(), device_plugin_paths.end(), + [&](const string &path) { + unique(unique_device_plugin_paths, path); + } + ); + + for_each(unique_device_plugin_paths.begin(), unique_device_plugin_paths.end(), + [&](const string &path) { + void *handle; + load_sensor_devices(path, handle); + } + ); + + create_sensors(); + show_sensor_info(); + + return true; +} + +bool sensor_loader::load_sensor_devices(const string &path, void* &handle) { - int size; sensor_device_t *_devices = NULL; + sensor_device *device; + const sensor_handle_t *handles; _I("load device: [%s]", path.c_str()); void *_handle = dlopen(path.c_str(), RTLD_NOW); - if (!_handle) { _E("Failed to dlopen(%s), dlerror : %s", path.c_str(), dlerror()); return false; @@ -67,129 +100,95 @@ bool sensor_loader::load_devices(const string &path, vector &de dlerror(); create_t create_devices = (create_t) dlsym(_handle, "create"); - if (!create_devices) { _E("Failed to find symbols in %s", path.c_str()); dlclose(_handle); return false; } - size = create_devices(&_devices); - + int device_size = create_devices(&_devices); if (!_devices) { _E("Failed to create devices, path is %s\n", path.c_str()); dlclose(_handle); return false; } - devices.clear(); + for (int i = 0; i < device_size; ++i) { + device = static_cast(_devices[i]); - for (int i = 0; i < size; ++i) - devices.push_back(_devices[i]); + int handle_size = device->get_sensors(&handles); + for (int j = 0; j < handle_size; ++j) + m_devices[&handles[j]] = device; + } handle = _handle; delete _devices; - return true; } -physical_sensor* sensor_loader::create_sensor(sensor_handle_t handle, sensor_device *device) +void sensor_loader::create_sensors(void) { - int32_t index; - physical_sensor *sensor; - - index = (int32_t) (m_sensors.count((sensor_type_t)handle.type)); - - sensor = new(std::nothrow) physical_sensor(); - if (!sensor) { - _E("Memory allocation failed[%s]", handle.name); - return NULL; - } - - sensor->set_id((int64_t)handle.type << SENSOR_TYPE_SHIFT | index); - sensor->set_sensor_handle(handle); - sensor->set_sensor_device(device); + create_physical_sensors(ACCELEROMETER_SENSOR); + create_physical_sensors(UNKNOWN_SENSOR); - return sensor; + create_virtual_sensors("Auto Rotation"); } -bool sensor_loader::load_physical_sensors(std::vector &devices) +template +void sensor_loader::create_physical_sensors(sensor_type_t type) { - int size; - sensor_device *device; - const sensor_handle_t *handles; + int32_t index; + const sensor_handle_t *handle; physical_sensor *sensor; + sensor_device *device; - for (void *device_ptr : devices) { - device = static_cast(device_ptr); + sensor_device_map_t::iterator it = m_devices.begin(); - size = device->get_sensors(&handles); + for (sensor_device_map_t::iterator it = m_devices.begin(); it != m_devices.end(); ++it) { + handle = it->first; + device = it->second; + if (m_devices[handle] == NULL) + continue; - for (int i = 0; i < size; ++i) { - sensor = create_sensor(handles[i], device); - if (!sensor) + if (type != UNKNOWN_SENSOR) { + if (type != (sensor_type_t)(handle->type)) continue; - - std::shared_ptr sensor_ptr(sensor); - m_sensors.insert(std::make_pair((sensor_type_t)(handles[i].type), sensor_ptr)); - - _I("inserted [%s] sensor", sensor->get_name()); } - } - - return true; -} - -bool sensor_loader::load_sensors(void) -{ - vector device_plugin_paths; - vector unique_device_plugin_paths; - get_paths_from_dir(string(DEVICE_PLUGINS_DIR_PATH), device_plugin_paths); + sensor = reinterpret_cast(create_sensor<_sensor>()); - std::unordered_set s; - auto unique = [&s](vector &paths, const string &path) { - if (s.insert(path).second) - paths.push_back(path); - }; - - for_each(device_plugin_paths.begin(), device_plugin_paths.end(), - [&](const string &path) { - unique(unique_device_plugin_paths, path); + if (!sensor) { + _E("Memory allocation failed[%s]", handle->name); + return; } - ); - for_each(unique_device_plugin_paths.begin(), unique_device_plugin_paths.end(), - [&](const string &path) { - void *handle; - std::vector devices; + index = (int32_t) (m_sensors.count(type)); - load_devices(path, devices, handle); - load_physical_sensors(devices); - } - ); + sensor->set_id(((int64_t)handle->type << SENSOR_TYPE_SHIFT) | index); + sensor->set_sensor_handle(handle); + sensor->set_sensor_device(device); - load_virtual_sensors(); + std::shared_ptr sensor_ptr(sensor); + m_sensors.insert(std::make_pair(type, sensor_ptr)); - show_sensor_info(); - return true; + _I("created [%s] sensor", sensor->get_name()); + + m_devices[handle] = NULL; + } + return; } template -void sensor_loader::load_virtual_sensor(const char *name) +void sensor_loader::create_virtual_sensors(const char *name) { + int32_t index; sensor_type_t type; - int16_t index; - virtual_sensor *instance = NULL; + virtual_sensor *instance; - try { - instance = new _sensor; - } catch (std::exception &e) { - _E("Failed to create %s sensor, exception: %s", name, e.what()); - return; - } catch (int err) { - _E("Failed to create %s sensor err: %d, cause: %s", name, err, strerror(err)); + instance = reinterpret_cast(create_sensor<_sensor>()); + if (!instance) { + _E("Memory allocation failed[%s]", name); return; } @@ -200,18 +199,32 @@ void sensor_loader::load_virtual_sensor(const char *name) } std::shared_ptr sensor(instance); - type = sensor->get_type(); - index = (int16_t)(m_sensors.count(type)); + index = (int32_t)(m_sensors.count(type)); sensor->set_id((int64_t)type << SENSOR_TYPE_SHIFT | index); m_sensors.insert(std::make_pair(type, sensor)); + + _I("created [%s] sensor", sensor->get_name()); } -void sensor_loader::load_virtual_sensors(void) +template +sensor_base* sensor_loader::create_sensor(void) { - load_virtual_sensor("Auto Rotation"); + sensor_base *instance = NULL; + + try { + instance = new _sensor; + } catch (std::exception &e) { + _E("Failed to create sensor, exception: %s", e.what()); + return NULL; + } catch (int err) { + _E("Failed to create sensor err: %d, cause: %s", err, strerror(err)); + return NULL; + } + + return instance; } void sensor_loader::show_sensor_info(void) diff --git a/src/server/sensor_loader.h b/src/server/sensor_loader.h index 9a6a18d..d10d216 100644 --- a/src/server/sensor_loader.h +++ b/src/server/sensor_loader.h @@ -38,26 +38,27 @@ class sensor_base; typedef std::multimap> sensor_map_t; +typedef std::map sensor_device_map_t; class sensor_loader { private: sensor_loader(); - bool load_devices(const std::string &path, std::vector &devices, void* &handle); + bool load_sensor_devices(const std::string &path, void* &handle); - physical_sensor* create_sensor(sensor_handle_t handle, sensor_device *device); - bool load_physical_sensors(std::vector &devices); - - template void load_virtual_sensor(const char *name); - void load_virtual_sensors(void); + void create_sensors(void); + template void create_physical_sensors(sensor_type_t type); + template void create_virtual_sensors(const char *name); + template sensor_base* create_sensor(void); void show_sensor_info(void); bool get_paths_from_dir(const std::string &dir_path, std::vector &plugin_paths); sensor_map_t m_sensors; + sensor_device_map_t m_devices; public: static sensor_loader& get_instance(); - bool load_sensors(void); + bool load(void); sensor_base* get_sensor(sensor_type_t type); sensor_base* get_sensor(sensor_id_t id); diff --git a/src/shared/sensor_logs.h b/src/shared/sensor_logs.h index 2b78532..c414264 100644 --- a/src/shared/sensor_logs.h +++ b/src/shared/sensor_logs.h @@ -36,7 +36,7 @@ #ifdef _DEBUG #define DBG SLOGD #else -#define _D(...) do{} while(0) +#define DBG(...) do{} while(0) #endif #define ERR SLOGE -- 2.7.4 From 214db6477b8c4beb4365d3f1908bcad774565346 Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Mon, 15 Feb 2016 18:25:23 +0900 Subject: [PATCH 02/16] sensord: fix the bug that uses wrong type if sensor is UNKNOWN_SENSOR Change-Id: I598273ed1aa34c8c6417b2bc3469d175f1d62722 Signed-off-by: kibak.yoon --- src/server/sensor_loader.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/server/sensor_loader.cpp b/src/server/sensor_loader.cpp index a2bee31..4117970 100644 --- a/src/server/sensor_loader.cpp +++ b/src/server/sensor_loader.cpp @@ -163,14 +163,15 @@ void sensor_loader::create_physical_sensors(sensor_type_t type) return; } - index = (int32_t) (m_sensors.count(type)); + sensor_type_t _type = (sensor_type_t)handle->type; + index = (int32_t)m_sensors.count(_type); - sensor->set_id(((int64_t)handle->type << SENSOR_TYPE_SHIFT) | index); + sensor->set_id(((int64_t)_type << SENSOR_TYPE_SHIFT) | index); sensor->set_sensor_handle(handle); sensor->set_sensor_device(device); std::shared_ptr sensor_ptr(sensor); - m_sensors.insert(std::make_pair(type, sensor_ptr)); + m_sensors.insert(std::make_pair(_type, sensor_ptr)); _I("created [%s] sensor", sensor->get_name()); @@ -264,6 +265,10 @@ bool sensor_loader::get_paths_from_dir(const string &dir_path, vector &p while ((dir_entry = readdir(dir))) { name = string(dir_entry->d_name); + + if (name == "." || name == "..") + continue; + plugin_paths.push_back(dir_path + "/" + name); } -- 2.7.4 From 7efc559fea9bbdbc2355e720e01d8587f708061b Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Mon, 15 Feb 2016 18:50:42 +0900 Subject: [PATCH 03/16] sensord: rename sensor_handle_t to sensor_info_t Signed-off-by: kibak.yoon Change-Id: I276dcdee7cbe8011e572194c573d036dfaea8433 --- src/hal/sensor_hal.h | 6 +++--- src/server/physical_sensor.cpp | 46 +++++++++++++++++++++--------------------- src/server/physical_sensor.h | 4 ++-- src/server/sensor_loader.cpp | 24 +++++++++++----------- src/server/sensor_loader.h | 2 +- 5 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/hal/sensor_hal.h b/src/hal/sensor_hal.h index ded1a90..9ae5c62 100644 --- a/src/hal/sensor_hal.h +++ b/src/hal/sensor_hal.h @@ -102,7 +102,7 @@ typedef enum { * A platform sensor handler is generated based on this handle * ID can be assigned from HAL developer. so it has to be unique in HAL. */ -typedef struct sensor_handle_t { +typedef struct sensor_info_t { uint32_t id; const char *name; sensor_device_type type; @@ -115,7 +115,7 @@ typedef struct sensor_handle_t { int min_interval; int max_batch_count; bool wakeup_supported; -} sensor_handle_t; +} sensor_info_t; enum sensor_accuracy_t { SENSOR_ACCURACY_UNDEFINED = -1, @@ -170,7 +170,7 @@ public: } virtual int get_poll_fd(void) = 0; - virtual int get_sensors(const sensor_handle_t **sensors) = 0; + virtual int get_sensors(const sensor_info_t **sensors) = 0; virtual bool enable(uint32_t id) = 0; virtual bool disable(uint32_t id) = 0; diff --git a/src/server/physical_sensor.cpp b/src/server/physical_sensor.cpp index b230e1c..e7c3516 100644 --- a/src/server/physical_sensor.cpp +++ b/src/server/physical_sensor.cpp @@ -33,9 +33,9 @@ physical_sensor::~physical_sensor() { } -void physical_sensor::set_sensor_handle(const sensor_handle_t *handle) +void physical_sensor::set_sensor_info(const sensor_info_t *info) { - m_handle = handle; + m_info = info; } void physical_sensor::set_sensor_device(sensor_device *device) @@ -45,25 +45,25 @@ void physical_sensor::set_sensor_device(sensor_device *device) sensor_type_t physical_sensor::get_type(void) { - return static_cast(m_handle->type); + return static_cast(m_info->type); } unsigned int physical_sensor::get_event_type(void) { - return m_handle->event_type; + return m_info->event_type; } const char* physical_sensor::get_name(void) { - if (!m_handle->name) + if (!m_info->name) return UNKNOWN_NAME; - return m_handle->name; + return m_info->name; } uint32_t physical_sensor::get_hal_id(void) { - return m_handle->id; + return m_info->id; } int physical_sensor::get_poll_fd() @@ -101,7 +101,7 @@ int physical_sensor::get_data(sensor_data_t **data, int *length) return -1; int remains = 0; - remains = m_sensor_device->get_data(m_handle->id, data, length); + remains = m_sensor_device->get_data(m_info->id, data, length); if (*length < 0) { _E("Failed to get sensor event"); @@ -118,7 +118,7 @@ bool physical_sensor::flush(void) if (!m_sensor_device) return false; - return m_sensor_device->flush(m_handle->id); + return m_sensor_device->flush(m_info->id); } bool physical_sensor::set_interval(unsigned long interval) @@ -130,7 +130,7 @@ bool physical_sensor::set_interval(unsigned long interval) _I("Polling interval is set to %dms", interval); - return m_sensor_device->set_interval(m_handle->id, interval); + return m_sensor_device->set_interval(m_info->id, interval); } bool physical_sensor::set_batch_latency(unsigned long latency) @@ -142,7 +142,7 @@ bool physical_sensor::set_batch_latency(unsigned long latency) _I("Polling interval is set to %dms", latency); - return m_sensor_device->set_batch_latency(m_handle->id, latency); + return m_sensor_device->set_batch_latency(m_info->id, latency); } int physical_sensor::set_attribute(int32_t attribute, int32_t value) @@ -152,7 +152,7 @@ int physical_sensor::set_attribute(int32_t attribute, int32_t value) if (!m_sensor_device) return false; - return m_sensor_device->set_attribute_int(m_handle->id, attribute, value); + return m_sensor_device->set_attribute_int(m_info->id, attribute, value); } int physical_sensor::set_attribute(int32_t attribute, char *value, int value_len) @@ -162,7 +162,7 @@ int physical_sensor::set_attribute(int32_t attribute, char *value, int value_len if (!m_sensor_device) return false; - return m_sensor_device->set_attribute_str(m_handle->id, attribute, value, value_len); + return m_sensor_device->set_attribute_str(m_info->id, attribute, value, value_len); } bool physical_sensor::set_wakeup(int wakeup) @@ -177,7 +177,7 @@ bool physical_sensor::on_start() if (!m_sensor_device) return false; - return m_sensor_device->enable(m_handle->id); + return m_sensor_device->enable(m_info->id); } bool physical_sensor::on_stop() @@ -187,7 +187,7 @@ bool physical_sensor::on_stop() if (!m_sensor_device) return false; - return m_sensor_device->disable(m_handle->id); + return m_sensor_device->disable(m_info->id); } bool physical_sensor::get_sensor_info(sensor_info &info) @@ -195,16 +195,16 @@ bool physical_sensor::get_sensor_info(sensor_info &info) info.set_type(get_type()); info.set_id(get_id()); info.set_privilege(SENSOR_PRIVILEGE_PUBLIC); // FIXME - info.set_name(m_handle->model_name); - info.set_vendor(m_handle->vendor); - info.set_min_range(m_handle->min_range); - info.set_max_range(m_handle->max_range); - info.set_resolution(m_handle->resolution); - info.set_min_interval(m_handle->min_interval); + info.set_name(m_info->model_name); + info.set_vendor(m_info->vendor); + info.set_min_range(m_info->min_range); + info.set_max_range(m_info->max_range); + info.set_resolution(m_info->resolution); + info.set_min_interval(m_info->min_interval); info.set_fifo_count(0); // FIXME - info.set_max_batch_count(m_handle->max_batch_count); + info.set_max_batch_count(m_info->max_batch_count); info.set_supported_event(get_event_type()); - info.set_wakeup_supported(m_handle->wakeup_supported); + info.set_wakeup_supported(m_info->wakeup_supported); return true; } diff --git a/src/server/physical_sensor.h b/src/server/physical_sensor.h index 7722929..33378f6 100644 --- a/src/server/physical_sensor.h +++ b/src/server/physical_sensor.h @@ -29,7 +29,7 @@ public: virtual ~physical_sensor(); /* setting module */ - void set_sensor_handle(const sensor_handle_t *handle); + void set_sensor_info(const sensor_info_t *info); void set_sensor_device(sensor_device *device); /* module info */ @@ -46,7 +46,7 @@ public: private: static cmutex m_mutex; - const sensor_handle_t *m_handle; + const sensor_info_t *m_info; sensor_device *m_sensor_device; uint32_t hal_id; diff --git a/src/server/sensor_loader.cpp b/src/server/sensor_loader.cpp index 4117970..cc7b533 100644 --- a/src/server/sensor_loader.cpp +++ b/src/server/sensor_loader.cpp @@ -87,7 +87,7 @@ bool sensor_loader::load_sensor_devices(const string &path, void* &handle) { sensor_device_t *_devices = NULL; sensor_device *device; - const sensor_handle_t *handles; + const sensor_info_t *infos; _I("load device: [%s]", path.c_str()); @@ -116,9 +116,9 @@ bool sensor_loader::load_sensor_devices(const string &path, void* &handle) for (int i = 0; i < device_size; ++i) { device = static_cast(_devices[i]); - int handle_size = device->get_sensors(&handles); - for (int j = 0; j < handle_size; ++j) - m_devices[&handles[j]] = device; + int info_size = device->get_sensors(&infos); + for (int j = 0; j < info_size; ++j) + m_devices[&infos[j]] = device; } handle = _handle; @@ -139,35 +139,35 @@ template void sensor_loader::create_physical_sensors(sensor_type_t type) { int32_t index; - const sensor_handle_t *handle; + const sensor_info_t *info; physical_sensor *sensor; sensor_device *device; sensor_device_map_t::iterator it = m_devices.begin(); for (sensor_device_map_t::iterator it = m_devices.begin(); it != m_devices.end(); ++it) { - handle = it->first; + info = it->first; device = it->second; - if (m_devices[handle] == NULL) + if (m_devices[info] == NULL) continue; if (type != UNKNOWN_SENSOR) { - if (type != (sensor_type_t)(handle->type)) + if (type != (sensor_type_t)(info->type)) continue; } sensor = reinterpret_cast(create_sensor<_sensor>()); if (!sensor) { - _E("Memory allocation failed[%s]", handle->name); + _E("Memory allocation failed[%s]", info->name); return; } - sensor_type_t _type = (sensor_type_t)handle->type; + sensor_type_t _type = (sensor_type_t)info->type; index = (int32_t)m_sensors.count(_type); sensor->set_id(((int64_t)_type << SENSOR_TYPE_SHIFT) | index); - sensor->set_sensor_handle(handle); + sensor->set_sensor_info(info); sensor->set_sensor_device(device); std::shared_ptr sensor_ptr(sensor); @@ -175,7 +175,7 @@ void sensor_loader::create_physical_sensors(sensor_type_t type) _I("created [%s] sensor", sensor->get_name()); - m_devices[handle] = NULL; + m_devices[info] = NULL; } return; } diff --git a/src/server/sensor_loader.h b/src/server/sensor_loader.h index d10d216..9585105 100644 --- a/src/server/sensor_loader.h +++ b/src/server/sensor_loader.h @@ -38,7 +38,7 @@ class sensor_base; typedef std::multimap> sensor_map_t; -typedef std::map sensor_device_map_t; +typedef std::map sensor_device_map_t; class sensor_loader { private: -- 2.7.4 From 51888e9de655dab35f214a2a05d3bff60baf34cb Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Mon, 15 Feb 2016 19:07:14 +0900 Subject: [PATCH 04/16] sensord: version 2.0.2 Signed-off-by: kibak.yoon Change-Id: I569796bc25b5d1bc7d4b54df1a6004593cc012aa --- packaging/sensord.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/sensord.spec b/packaging/sensord.spec index 063d808..490e909 100644 --- a/packaging/sensord.spec +++ b/packaging/sensord.spec @@ -1,6 +1,6 @@ Name: sensord Summary: Sensor daemon -Version: 2.0.1 +Version: 2.0.2 Release: 0 Group: System/Sensor Framework License: Apache-2.0 -- 2.7.4 From 135fd6c9a17160095d30aea472706a5afea20665 Mon Sep 17 00:00:00 2001 From: Mu-Woong Lee Date: Tue, 16 Feb 2016 11:07:30 +0900 Subject: [PATCH 05/16] client: fix initialization issue Change-Id: I33428ba68b0937dc9c9c294e84640d04e625b9b3 Signed-off-by: Mu-Woong Lee --- packaging/sensord.spec | 8 +- src/client/client.cpp | 242 +++++++++++++++++++++---------------------- src/client/client_common.cpp | 15 ++- 3 files changed, 133 insertions(+), 132 deletions(-) diff --git a/packaging/sensord.spec b/packaging/sensord.spec index 490e909..a8cff0b 100644 --- a/packaging/sensord.spec +++ b/packaging/sensord.spec @@ -98,9 +98,13 @@ systemctl daemon-reload %postun systemctl daemon-reload -%post -n libsensord -p /sbin/ldconfig +%post -n libsensord +ln -sf %{_libdir}/libsensor.so.%{version} %{_libdir}/libsensor.so.1 +/sbin/ldconfig -%postun -n libsensord -p /sbin/ldconfig +%postun -n libsensord +rm %{_libdir}/libsensor.so.1 +/sbin/ldconfig %files %attr(0644,root,root)/usr/etc/virtual_sensors.xml diff --git a/src/client/client.cpp b/src/client/client.cpp index abd7d9f..cf0091b 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -40,8 +40,6 @@ using std::vector; static const int OP_SUCCESS = 0; static const int OP_ERROR = -1; -static sensor_event_listener &event_listener = sensor_event_listener::get_instance(); -static sensor_client_info &client_info = sensor_client_info::get_instance(); static cmutex lock; static int g_power_save_state = 0; @@ -49,22 +47,25 @@ static int g_power_save_state = 0; static int get_power_save_state(void); static void power_save_state_cb(keynode_t *node, void *data); static void clean_up(void); -static void good_bye(void); static bool change_sensor_rep(sensor_id_t sensor_id, sensor_rep &prev_rep, sensor_rep &cur_rep); static void restore_session(void); static bool register_event(int handle, unsigned int event_type, unsigned int interval, int max_batch_latency, int cb_type, void* cb, void *user_data); -void init_client(void) -{ - event_listener.set_hup_observer(restore_session); - atexit(good_bye); -} +class initiator { +public: + initiator() + { + sensor_event_listener::get_instance().set_hup_observer(restore_session); + } -static void good_bye(void) -{ - _D("Good bye! %s\n", get_client_name()); - clean_up(); -} + ~initiator() + { + _D("Good bye! %s\n", get_client_name()); + clean_up(); + } +}; + +static initiator g_initiator; static int g_power_save_state_cb_cnt = 0; @@ -96,11 +97,11 @@ static void unset_power_save_state_cb(void) } } -static void clean_up(void) +void clean_up(void) { handle_vector handles; - client_info.get_all_handles(handles); + sensor_client_info::get_instance().get_all_handles(handles); auto it_handle = handles.begin(); @@ -110,7 +111,6 @@ static void clean_up(void) } } - static int get_power_save_state (void) { int state = 0; @@ -142,14 +142,14 @@ static void power_save_state_cb(keynode_t *node, void *data) g_power_save_state = cur_power_save_state; _D("power_save_state: %d noti to %s", g_power_save_state, get_client_name()); - client_info.get_listening_sensors(sensors); + sensor_client_info::get_instance().get_listening_sensors(sensors); auto it_sensor = sensors.begin(); while (it_sensor != sensors.end()) { - client_info.get_sensor_rep(*it_sensor, prev_rep); - event_listener.operate_sensor(*it_sensor, cur_power_save_state); - client_info.get_sensor_rep(*it_sensor, cur_rep); + sensor_client_info::get_instance().get_sensor_rep(*it_sensor, prev_rep); + sensor_event_listener::get_instance().operate_sensor(*it_sensor, cur_power_save_state); + sensor_client_info::get_instance().get_sensor_rep(*it_sensor, cur_rep); change_sensor_rep(*it_sensor, prev_rep, cur_rep); ++it_sensor; @@ -157,7 +157,7 @@ static void power_save_state_cb(keynode_t *node, void *data) } -static void restore_session(void) +void restore_session(void) { AUTOLOCK(lock); @@ -166,12 +166,12 @@ static void restore_session(void) command_channel *cmd_channel; int client_id; - client_info.close_command_channel(); - client_info.set_client_id(CLIENT_ID_INVALID); + sensor_client_info::get_instance().close_command_channel(); + sensor_client_info::get_instance().set_client_id(CLIENT_ID_INVALID); sensor_id_vector sensors; - client_info.get_listening_sensors(sensors); + sensor_client_info::get_instance().get_listening_sensors(sensors); bool first_connection = true; @@ -187,7 +187,7 @@ static void restore_session(void) goto FAILED; } - client_info.add_command_channel(*it_sensor, cmd_channel); + sensor_client_info::get_instance().add_command_channel(*it_sensor, cmd_channel); if (first_connection) { first_connection = false; @@ -196,8 +196,8 @@ static void restore_session(void) goto FAILED; } - client_info.set_client_id(client_id); - event_listener.start_event_listener(); + sensor_client_info::get_instance().set_client_id(client_id); + sensor_event_listener::get_instance().start_event_listener(); } cmd_channel->set_client_id(client_id); @@ -212,7 +212,7 @@ static void restore_session(void) prev_rep.option = SENSOR_OPTION_DEFAULT; prev_rep.interval = 0; - client_info.get_sensor_rep(*it_sensor, cur_rep); + sensor_client_info::get_instance().get_sensor_rep(*it_sensor, cur_rep); if (!change_sensor_rep(*it_sensor, prev_rep, cur_rep)) { _E("Failed to change rep(%s) for %s", get_sensor_name(*it_sensor), get_client_name()); goto FAILED; @@ -226,7 +226,7 @@ static void restore_session(void) return; FAILED: - event_listener.clear(); + sensor_event_listener::get_instance().clear(); _E("Failed to restore session for %s", get_client_name()); } @@ -248,12 +248,12 @@ static bool change_sensor_rep(sensor_id_t sensor_id, sensor_rep &prev_rep, senso command_channel *cmd_channel; event_type_vector add_event_types, del_event_types; - if (!client_info.get_command_channel(sensor_id, &cmd_channel)) { + if (!sensor_client_info::get_instance().get_command_channel(sensor_id, &cmd_channel)) { _E("client %s failed to get command channel for %s", get_client_name(), get_sensor_name(sensor_id)); return false; } - client_id = client_info.get_client_id(); + client_id = sensor_client_info::get_instance().get_client_id(); retvm_if ((client_id < 0), false, "Invalid client id : %d, %s, %s", client_id, get_sensor_name(sensor_id), get_client_name()); get_events_diff(prev_rep.event_types, cur_rep.event_types, add_event_types, del_event_types); @@ -538,9 +538,9 @@ API int sensord_connect(sensor_t sensor) AUTOLOCK(lock); - sensor_registered = client_info.is_sensor_registered(sensor_id); + sensor_registered = sensor_client_info::get_instance().is_sensor_registered(sensor_id); - handle = client_info.create_handle(sensor_id); + handle = sensor_client_info::get_instance().create_handle(sensor_id); if (handle == MAX_HANDLE_REACHED) { _E("Maximum number of handles reached, sensor: %s in client %s", get_sensor_name(sensor_id), get_client_name()); return OP_ERROR; @@ -552,50 +552,50 @@ API int sensord_connect(sensor_t sensor) if (!cmd_channel->create_channel()) { _E("%s failed to create command channel for %s", get_client_name(), get_sensor_name(sensor_id)); - client_info.delete_handle(handle); + sensor_client_info::get_instance().delete_handle(handle); delete cmd_channel; return OP_ERROR; } - client_info.add_command_channel(sensor_id, cmd_channel); + sensor_client_info::get_instance().add_command_channel(sensor_id, cmd_channel); } - if (!client_info.get_command_channel(sensor_id, &cmd_channel)) { + if (!sensor_client_info::get_instance().get_command_channel(sensor_id, &cmd_channel)) { _E("%s failed to get command channel for %s", get_client_name(), get_sensor_name(sensor_id)); - client_info.delete_handle(handle); + sensor_client_info::get_instance().delete_handle(handle); return OP_ERROR; } - if (!client_info.has_client_id()) { + if (!sensor_client_info::get_instance().has_client_id()) { first_connection = true; if(!cmd_channel->cmd_get_id(client_id)) { _E("Sending cmd_get_id() failed for %s", get_sensor_name(sensor_id)); - client_info.close_command_channel(sensor_id); - client_info.delete_handle(handle); + sensor_client_info::get_instance().close_command_channel(sensor_id); + sensor_client_info::get_instance().delete_handle(handle); return OP_ERROR; } - client_info.set_client_id(client_id); + sensor_client_info::get_instance().set_client_id(client_id); _I("%s gets client_id [%d]", get_client_name(), client_id); - event_listener.start_event_listener(); + sensor_event_listener::get_instance().start_event_listener(); _I("%s starts listening events with client_id [%d]", get_client_name(), client_id); } - client_id = client_info.get_client_id(); + client_id = sensor_client_info::get_instance().get_client_id(); cmd_channel->set_client_id(client_id); _I("%s[%d] connects with %s[%d]", get_client_name(), client_id, get_sensor_name(sensor_id), handle); - client_info.set_sensor_params(handle, SENSOR_STATE_STOPPED, SENSOR_OPTION_DEFAULT); + sensor_client_info::get_instance().set_sensor_params(handle, SENSOR_STATE_STOPPED, SENSOR_OPTION_DEFAULT); if (!sensor_registered) { if(!cmd_channel->cmd_hello(sensor_id)) { _E("Sending cmd_hello(%s, %d) failed for %s", get_sensor_name(sensor_id), client_id, get_client_name()); - client_info.close_command_channel(sensor_id); - client_info.delete_handle(handle); + sensor_client_info::get_instance().close_command_channel(sensor_id); + sensor_client_info::get_instance().delete_handle(handle); if (first_connection) { - client_info.set_client_id(CLIENT_ID_INVALID); - event_listener.stop_event_listener(); + sensor_client_info::get_instance().set_client_id(CLIENT_ID_INVALID); + sensor_event_listener::get_instance().stop_event_listener(); } return OP_ERROR; } @@ -614,18 +614,18 @@ API bool sensord_disconnect(int handle) AUTOLOCK(lock); - if (!client_info.get_sensor_state(handle, sensor_state)|| - !client_info.get_sensor_id(handle, sensor_id)) { + if (!sensor_client_info::get_instance().get_sensor_state(handle, sensor_state)|| + !sensor_client_info::get_instance().get_sensor_id(handle, sensor_id)) { _E("client %s failed to get handle information", get_client_name()); return false; } - if (!client_info.get_command_channel(sensor_id, &cmd_channel)) { + if (!sensor_client_info::get_instance().get_command_channel(sensor_id, &cmd_channel)) { _E("client %s failed to get command channel for %s", get_client_name(), get_sensor_name(sensor_id)); return false; } - client_id = client_info.get_client_id(); + client_id = sensor_client_info::get_instance().get_client_id(); retvm_if ((client_id < 0), false, "Invalid client id : %d, handle: %d, %s, %s", client_id, handle, get_sensor_name(sensor_id), get_client_name()); _I("%s disconnects with %s[%d]", get_client_name(), get_sensor_name(sensor_id), handle); @@ -636,23 +636,23 @@ API bool sensord_disconnect(int handle) sensord_stop(handle); } - if (!client_info.delete_handle(handle)) + if (!sensor_client_info::get_instance().delete_handle(handle)) return false; - if (!client_info.is_active()) - client_info.set_client_id(CLIENT_ID_INVALID); + if (!sensor_client_info::get_instance().is_active()) + sensor_client_info::get_instance().set_client_id(CLIENT_ID_INVALID); - if (!client_info.is_sensor_registered(sensor_id)) { + if (!sensor_client_info::get_instance().is_sensor_registered(sensor_id)) { if(!cmd_channel->cmd_byebye()) { _E("Sending cmd_byebye(%d, %s) failed for %s", client_id, get_sensor_name(sensor_id), get_client_name()); return false; } - client_info.close_command_channel(sensor_id); + sensor_client_info::get_instance().close_command_channel(sensor_id); } - if (!client_info.is_active()) { - _I("Stop listening events for client %s with client id [%d]", get_client_name(), client_info.get_client_id()); - event_listener.stop_event_listener(); + if (!sensor_client_info::get_instance().is_active()) { + _I("Stop listening events for client %s with client id [%d]", get_client_name(), sensor_client_info::get_instance().get_client_id()); + sensor_event_listener::get_instance().stop_event_listener(); } unset_power_save_state_cb(); @@ -671,7 +671,7 @@ static bool register_event(int handle, unsigned int event_type, unsigned int int AUTOLOCK(lock); - if (!client_info.get_sensor_id(handle, sensor_id)) { + if (!sensor_client_info::get_instance().get_sensor_id(handle, sensor_id)) { _E("client %s failed to get handle information", get_client_name()); return false; } @@ -683,13 +683,13 @@ static bool register_event(int handle, unsigned int event_type, unsigned int int get_client_name(), get_event_name(event_type), event_type, get_sensor_name(sensor_id), handle, interval, max_batch_latency, cb, user_data); - client_info.get_sensor_rep(sensor_id, prev_rep); - client_info.register_event(handle, event_type, interval, max_batch_latency, cb_type, cb, user_data); - client_info.get_sensor_rep(sensor_id, cur_rep); + sensor_client_info::get_instance().get_sensor_rep(sensor_id, prev_rep); + sensor_client_info::get_instance().register_event(handle, event_type, interval, max_batch_latency, cb_type, cb, user_data); + sensor_client_info::get_instance().get_sensor_rep(sensor_id, cur_rep); ret = change_sensor_rep(sensor_id, prev_rep, cur_rep); if (!ret) - client_info.unregister_event(handle, event_type); + sensor_client_info::get_instance().unregister_event(handle, event_type); return ret; } @@ -717,7 +717,7 @@ API bool sensord_unregister_event(int handle, unsigned int event_type) AUTOLOCK(lock); - if (!client_info.get_sensor_id(handle, sensor_id)) { + if (!sensor_client_info::get_instance().get_sensor_id(handle, sensor_id)) { _E("client %s failed to get handle information", get_client_name()); return false; } @@ -725,20 +725,20 @@ API bool sensord_unregister_event(int handle, unsigned int event_type) _I("%s unregisters event %s[0x%x] for sensor %s[%d]", get_client_name(), get_event_name(event_type), event_type, get_sensor_name(sensor_id), handle); - client_info.get_sensor_rep(sensor_id, prev_rep); - client_info.get_event_info(handle, event_type, prev_interval, prev_latency, prev_cb_type, prev_cb, prev_user_data); + sensor_client_info::get_instance().get_sensor_rep(sensor_id, prev_rep); + sensor_client_info::get_instance().get_event_info(handle, event_type, prev_interval, prev_latency, prev_cb_type, prev_cb, prev_user_data); - if (!client_info.unregister_event(handle, event_type)) { + if (!sensor_client_info::get_instance().unregister_event(handle, event_type)) { _E("%s try to unregister non registered event %s[0x%x] for sensor %s[%d]", get_client_name(),get_event_name(event_type), event_type, get_sensor_name(sensor_id), handle); return false; } - client_info.get_sensor_rep(sensor_id, cur_rep); + sensor_client_info::get_instance().get_sensor_rep(sensor_id, cur_rep); ret = change_sensor_rep(sensor_id, prev_rep, cur_rep); if (!ret) - client_info.register_event(handle, event_type, prev_interval, prev_latency, prev_cb_type, prev_cb, prev_user_data); + sensor_client_info::get_instance().register_event(handle, event_type, prev_interval, prev_latency, prev_cb_type, prev_cb, prev_user_data); return ret; @@ -753,7 +753,7 @@ API bool sensord_register_accuracy_cb(int handle, sensor_accuracy_changed_cb_t c AUTOLOCK(lock); - if (!client_info.get_sensor_id(handle, sensor_id)) { + if (!sensor_client_info::get_instance().get_sensor_id(handle, sensor_id)) { _E("client %s failed to get handle information", get_client_name()); return false; } @@ -762,7 +762,7 @@ API bool sensord_register_accuracy_cb(int handle, sensor_accuracy_changed_cb_t c _I("%s registers accuracy_changed_cb for sensor %s[%d] with cb: 0x%x, user_data: 0x%x", get_client_name(), get_sensor_name(sensor_id), handle, cb, user_data); - client_info.register_accuracy_cb(handle, cb , user_data); + sensor_client_info::get_instance().register_accuracy_cb(handle, cb , user_data); return true; @@ -774,7 +774,7 @@ API bool sensord_unregister_accuracy_cb(int handle) AUTOLOCK(lock); - if (!client_info.get_sensor_id(handle, sensor_id)) { + if (!sensor_client_info::get_instance().get_sensor_id(handle, sensor_id)) { _E("client %s failed to get handle information", get_client_name()); return false; } @@ -783,7 +783,7 @@ API bool sensord_unregister_accuracy_cb(int handle) _I("%s unregisters accuracy_changed_cb for sensor %s[%d]", get_client_name(), get_sensor_name(sensor_id), handle); - client_info.unregister_accuracy_cb(handle); + sensor_client_info::get_instance().unregister_accuracy_cb(handle); return true; } @@ -798,7 +798,7 @@ API bool sensord_start(int handle, int option) AUTOLOCK(lock); - if (!client_info.get_sensor_id(handle, sensor_id)) { + if (!sensor_client_info::get_instance().get_sensor_id(handle, sensor_id)) { _E("client %s failed to get handle information", get_client_name()); return false; } @@ -810,19 +810,19 @@ API bool sensord_start(int handle, int option) handle, option, g_power_save_state); if (g_power_save_state && !(g_power_save_state & option)) { - client_info.set_sensor_params(handle, SENSOR_STATE_PAUSED, option); + sensor_client_info::get_instance().set_sensor_params(handle, SENSOR_STATE_PAUSED, option); return true; } - client_info.get_sensor_rep(sensor_id, prev_rep); - client_info.get_sensor_params(handle, prev_state, prev_option); - client_info.set_sensor_params(handle, SENSOR_STATE_STARTED, option); - client_info.get_sensor_rep(sensor_id, cur_rep); + sensor_client_info::get_instance().get_sensor_rep(sensor_id, prev_rep); + sensor_client_info::get_instance().get_sensor_params(handle, prev_state, prev_option); + sensor_client_info::get_instance().set_sensor_params(handle, SENSOR_STATE_STARTED, option); + sensor_client_info::get_instance().get_sensor_rep(sensor_id, cur_rep); ret = change_sensor_rep(sensor_id, prev_rep, cur_rep); if (!ret) - client_info.set_sensor_params(handle, prev_state, prev_option); + sensor_client_info::get_instance().set_sensor_params(handle, prev_state, prev_option); return ret; } @@ -838,8 +838,8 @@ API bool sensord_stop(int handle) AUTOLOCK(lock); - if (!client_info.get_sensor_state(handle, sensor_state)|| - !client_info.get_sensor_id(handle, sensor_id)) { + if (!sensor_client_info::get_instance().get_sensor_state(handle, sensor_state)|| + !sensor_client_info::get_instance().get_sensor_id(handle, sensor_id)) { _E("client %s failed to get handle information", get_client_name()); return false; } @@ -850,15 +850,15 @@ API bool sensord_stop(int handle) _I("%s stops sensor %s[%d]", get_client_name(), get_sensor_name(sensor_id), handle); - client_info.get_sensor_rep(sensor_id, prev_rep); - client_info.get_sensor_params(handle, prev_state, prev_option); - client_info.set_sensor_state(handle, SENSOR_STATE_STOPPED); - client_info.get_sensor_rep(sensor_id, cur_rep); + sensor_client_info::get_instance().get_sensor_rep(sensor_id, prev_rep); + sensor_client_info::get_instance().get_sensor_params(handle, prev_state, prev_option); + sensor_client_info::get_instance().set_sensor_state(handle, SENSOR_STATE_STOPPED); + sensor_client_info::get_instance().get_sensor_rep(sensor_id, cur_rep); ret = change_sensor_rep(sensor_id, prev_rep, cur_rep); if (!ret) - client_info.set_sensor_params(handle, prev_state, prev_option); + sensor_client_info::get_instance().set_sensor_params(handle, prev_state, prev_option); return ret; } @@ -876,7 +876,7 @@ static bool change_event_batch(int handle, unsigned int event_type, unsigned int AUTOLOCK(lock); - if (!client_info.get_sensor_id(handle, sensor_id)) { + if (!sensor_client_info::get_instance().get_sensor_id(handle, sensor_id)) { _E("client %s failed to get handle information", get_client_name()); return false; } @@ -884,22 +884,22 @@ static bool change_event_batch(int handle, unsigned int event_type, unsigned int _I("%s changes batch of event %s[0x%x] for %s[%d] to (%d, %d)", get_client_name(), get_event_name(event_type), event_type, get_sensor_name(sensor_id), handle, interval, latency); - client_info.get_sensor_rep(sensor_id, prev_rep); + sensor_client_info::get_instance().get_sensor_rep(sensor_id, prev_rep); - client_info.get_event_info(handle, event_type, prev_interval, prev_latency, prev_cb_type, prev_cb, prev_user_data); + sensor_client_info::get_instance().get_event_info(handle, event_type, prev_interval, prev_latency, prev_cb_type, prev_cb, prev_user_data); if (interval == 0) interval = DEFAULT_INTERVAL; - if (!client_info.set_event_batch(handle, event_type, interval, latency)) + if (!sensor_client_info::get_instance().set_event_batch(handle, event_type, interval, latency)) return false; - client_info.get_sensor_rep(sensor_id, cur_rep); + sensor_client_info::get_instance().get_sensor_rep(sensor_id, cur_rep); ret = change_sensor_rep(sensor_id, prev_rep, cur_rep); if (!ret) - client_info.set_event_batch(handle, event_type, prev_interval, prev_latency); + sensor_client_info::get_instance().set_event_batch(handle, event_type, prev_interval, prev_latency); return ret; } @@ -913,7 +913,7 @@ API bool sensord_change_event_interval(int handle, unsigned int event_type, unsi AUTOLOCK(lock); - if (!client_info.get_event_info(handle, event_type, prev_interval, prev_latency, prev_cb_type, prev_cb, prev_user_data)) { + if (!sensor_client_info::get_instance().get_event_info(handle, event_type, prev_interval, prev_latency, prev_cb_type, prev_cb, prev_user_data)) { _E("Failed to get event info with handle = %d, event_type = 0x%x", handle, event_type); return false; } @@ -931,7 +931,7 @@ API bool sensord_change_event_max_batch_latency(int handle, unsigned int event_t AUTOLOCK(lock); - if (!client_info.get_event_info(handle, event_type, prev_interval, prev_latency, prev_cb_type, prev_cb, prev_user_data)) { + if (!sensor_client_info::get_instance().get_event_info(handle, event_type, prev_interval, prev_latency, prev_cb_type, prev_cb, prev_user_data)) { _E("Failed to get event info with handle = %d, event_type = 0x%x", handle, event_type); return false; } @@ -943,7 +943,7 @@ API bool sensord_change_event_maincontext(int handle, unsigned int event_type, G { AUTOLOCK(lock); - if (!client_info.set_event_maincontext(handle, event_type, maincontext)) { + if (!sensor_client_info::get_instance().set_event_maincontext(handle, event_type, maincontext)) { _E("Failed to get event info with handle = %d, event_type = 0x%x, maincontext = 0x%x", handle, event_type, maincontext); return false; } @@ -962,8 +962,8 @@ API bool sensord_set_option(int handle, int option) AUTOLOCK(lock); - if (!client_info.get_sensor_state(handle, sensor_state)|| - !client_info.get_sensor_id(handle, sensor_id)) { + if (!sensor_client_info::get_instance().get_sensor_state(handle, sensor_state)|| + !sensor_client_info::get_instance().get_sensor_id(handle, sensor_id)) { _E("client %s failed to get handle information", get_client_name()); return false; } @@ -972,22 +972,22 @@ API bool sensord_set_option(int handle, int option) option, handle, get_sensor_name(sensor_id), get_client_name()); - client_info.get_sensor_rep(sensor_id, prev_rep); - client_info.get_sensor_params(handle, prev_state, prev_option); + sensor_client_info::get_instance().get_sensor_rep(sensor_id, prev_rep); + sensor_client_info::get_instance().get_sensor_params(handle, prev_state, prev_option); if (g_power_save_state) { if ((option & g_power_save_state) && (sensor_state == SENSOR_STATE_PAUSED)) - client_info.set_sensor_state(handle, SENSOR_STATE_STARTED); + sensor_client_info::get_instance().set_sensor_state(handle, SENSOR_STATE_STARTED); else if (!(option & g_power_save_state) && (sensor_state == SENSOR_STATE_STARTED)) - client_info.set_sensor_state(handle, SENSOR_STATE_PAUSED); + sensor_client_info::get_instance().set_sensor_state(handle, SENSOR_STATE_PAUSED); } - client_info.set_sensor_option(handle, option); + sensor_client_info::get_instance().set_sensor_option(handle, option); - client_info.get_sensor_rep(sensor_id, cur_rep); + sensor_client_info::get_instance().get_sensor_rep(sensor_id, cur_rep); ret = change_sensor_rep(sensor_id, prev_rep, cur_rep); if (!ret) - client_info.set_sensor_option(handle, prev_option); + sensor_client_info::get_instance().set_sensor_option(handle, prev_option); return ret; @@ -1001,7 +1001,7 @@ API bool sensord_set_wakeup(int handle, int wakeup) AUTOLOCK(lock); - if (!client_info.get_sensor_id(handle, sensor_id)) { + if (!sensor_client_info::get_instance().get_sensor_id(handle, sensor_id)) { _E("client %s failed to get handle information", get_client_name()); return false; } @@ -1009,14 +1009,14 @@ API bool sensord_set_wakeup(int handle, int wakeup) retvm_if ((wakeup != SENSOR_WAKEUP_ON) && (wakeup != SENSOR_WAKEUP_OFF), false, "Invalid wakeup value : %d, handle: %d, %s, %s", wakeup, handle, get_sensor_name(sensor_id), get_client_name()); - client_info.set_sensor_wakeup(handle, wakeup); + sensor_client_info::get_instance().set_sensor_wakeup(handle, wakeup); - if (!client_info.get_command_channel(sensor_id, &cmd_channel)) { + if (!sensor_client_info::get_instance().get_command_channel(sensor_id, &cmd_channel)) { _E("client %s failed to get command channel for %s", get_client_name(), get_sensor_name(sensor_id)); return false; } - client_id = client_info.get_client_id(); + client_id = sensor_client_info::get_instance().get_client_id(); retvm_if ((client_id < 0), false, "Invalid client id : %d, handle: %d, %s, %s", client_id, handle, get_sensor_name(sensor_id), get_client_name()); if (!cmd_channel->cmd_set_wakeup(wakeup)) { @@ -1035,17 +1035,17 @@ API bool sensord_set_attribute_int(int handle, int attribute, int value) AUTOLOCK(lock); - if (!client_info.get_sensor_id(handle, sensor_id)) { + if (!sensor_client_info::get_instance().get_sensor_id(handle, sensor_id)) { _E("client %s failed to get handle information", get_client_name()); return false; } - if (!client_info.get_command_channel(sensor_id, &cmd_channel)) { + if (!sensor_client_info::get_instance().get_command_channel(sensor_id, &cmd_channel)) { _E("client %s failed to get command channel for %s", get_client_name(), get_sensor_name(sensor_id)); return false; } - client_id = client_info.get_client_id(); + client_id = sensor_client_info::get_instance().get_client_id(); retvm_if ((client_id < 0), false, "Invalid client id : %d, handle: %d, %s, %s", client_id, handle, get_sensor_name(sensor_id), get_client_name()); @@ -1067,12 +1067,12 @@ API bool sensord_set_attribute_str(int handle, int attribute, const char *value, AUTOLOCK(lock); - if (!client_info.get_sensor_id(handle, sensor_id)) { + if (!sensor_client_info::get_instance().get_sensor_id(handle, sensor_id)) { _E("client %s failed to get handle information", get_client_name()); return false; } - if (!client_info.get_command_channel(sensor_id, &cmd_channel)) { + if (!sensor_client_info::get_instance().get_command_channel(sensor_id, &cmd_channel)) { _E("client %s failed to get command channel for %s", get_client_name(), get_sensor_name(sensor_id)); return false; @@ -1082,7 +1082,7 @@ API bool sensord_set_attribute_str(int handle, int attribute, const char *value, "Invalid value_len: %d, value: 0x%x, handle: %d, %s, %s", value_len, value, handle, get_sensor_name(sensor_id), get_client_name()); - client_id = client_info.get_client_id(); + client_id = sensor_client_info::get_instance().get_client_id(); retvm_if ((client_id < 0), false, "Invalid client id : %d, handle: %d, %s, %s", client_id, handle, get_sensor_name(sensor_id), get_client_name()); @@ -1112,18 +1112,18 @@ API bool sensord_get_data(int handle, unsigned int data_id, sensor_data_t* senso AUTOLOCK(lock); - if (!client_info.get_sensor_state(handle, sensor_state)|| - !client_info.get_sensor_id(handle, sensor_id)) { + if (!sensor_client_info::get_instance().get_sensor_state(handle, sensor_state)|| + !sensor_client_info::get_instance().get_sensor_id(handle, sensor_id)) { _E("client %s failed to get handle information", get_client_name()); return false; } - if (!client_info.get_command_channel(sensor_id, &cmd_channel)) { + if (!sensor_client_info::get_instance().get_command_channel(sensor_id, &cmd_channel)) { _E("client %s failed to get command channel for %s", get_client_name(), get_sensor_name(sensor_id)); return false; } - client_id = client_info.get_client_id(); + client_id = sensor_client_info::get_instance().get_client_id(); retvm_if ((client_id < 0), false, "Invalid client id : %d, handle: %d, %s, %s", client_id, handle, get_sensor_name(sensor_id), get_client_name()); if (sensor_state != SENSOR_STATE_STARTED) { diff --git a/src/client/client_common.cpp b/src/client/client_common.cpp index 3fc8ff5..344af09 100644 --- a/src/client/client_common.cpp +++ b/src/client/client_common.cpp @@ -77,23 +77,21 @@ log_element g_log_elements[] = { }; typedef unordered_map log_map; -log_map g_log_maps[LOG_ID_END]; +static log_map g_log_maps[LOG_ID_END]; -extern void init_client(void); static void init_log_maps(void); - -class initiator -{ +class initiator { public: initiator() { init_log_maps(); - init_client(); } -} g_initiatior; +}; -static void init_log_maps(void) +static initiator g_initiator; + +void init_log_maps(void) { int cnt; @@ -105,7 +103,6 @@ static void init_log_maps(void) } - const char* get_log_element_name(log_id id, unsigned int type) { const char* p_unknown = "UNKNOWN"; -- 2.7.4 From 11245eed4a075166af33c661b6670bf1760b4435 Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Tue, 16 Feb 2016 13:37:47 +0900 Subject: [PATCH 06/16] sensord: delete the removing symlink code Change-Id: Ifc1746ecceb21def7c253d05d28a8b50dcf55c23 Signed-off-by: kibak.yoon --- packaging/sensord.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/packaging/sensord.spec b/packaging/sensord.spec index a8cff0b..92c5c11 100644 --- a/packaging/sensord.spec +++ b/packaging/sensord.spec @@ -103,7 +103,6 @@ ln -sf %{_libdir}/libsensor.so.%{version} %{_libdir}/libsensor.so.1 /sbin/ldconfig %postun -n libsensord -rm %{_libdir}/libsensor.so.1 /sbin/ldconfig %files -- 2.7.4 From d3fa89ec8d9eeb43d77ed5d0709fb2514645fa8a Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Tue, 16 Feb 2016 19:26:12 +0900 Subject: [PATCH 07/16] sensord: rename sensor_logs.h to sensor_log.h Change-Id: I33e5d86bc0abc60ab83195902dffd6953dd9ed26 Signed-off-by: kibak.yoon --- src/client/client.cpp | 2 +- src/client/client_common.h | 2 +- src/client/sensor_handle_info.h | 2 +- src/server/client_info_manager.cpp | 2 +- src/server/client_info_manager.h | 2 +- src/server/client_sensor_record.cpp | 2 +- src/server/device_config.h | 2 +- src/server/main.cpp | 2 +- src/server/permission_checker.cpp | 2 +- src/server/plugins/accel/accel_sensor.cpp | 2 +- src/server/plugins/auto_rotation/auto_rotation_alg.cpp | 2 +- src/server/plugins/auto_rotation/auto_rotation_alg_emul.cpp | 2 +- src/server/plugins/auto_rotation/auto_rotation_sensor.cpp | 2 +- src/server/plugins/fusion/fusion_sensor.cpp | 2 +- src/server/plugins/gravity/gravity_sensor.cpp | 2 +- src/server/plugins/linear_accel/linear_accel_sensor.cpp | 2 +- src/server/plugins/orientation/orientation_sensor.cpp | 2 +- src/server/plugins/rotation_vector/gaming_rv/gaming_rv_sensor.cpp | 2 +- .../plugins/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.cpp | 2 +- src/server/plugins/rotation_vector/rv/rv_sensor.cpp | 2 +- src/server/plugins/tilt/tilt_sensor.cpp | 2 +- src/server/sensor_base.h | 2 +- src/server/sensor_event_dispatcher.cpp | 2 +- src/server/sensor_event_queue.cpp | 2 +- src/server/sensor_loader.cpp | 2 +- src/server/sensor_usage.cpp | 2 +- src/server/virtual_sensor_config.cpp | 2 +- src/server/worker_thread.cpp | 2 +- src/shared/cbase_lock.cpp | 2 +- src/shared/cmutex.cpp | 2 +- src/shared/cpacket.cpp | 2 +- src/shared/csocket.h | 2 +- src/shared/poller.cpp | 2 +- src/shared/sensor_info.cpp | 2 +- src/shared/{sensor_logs.cpp => sensor_log.cpp} | 2 +- src/shared/{sensor_logs.h => sensor_log.h} | 0 36 files changed, 35 insertions(+), 35 deletions(-) rename src/shared/{sensor_logs.cpp => sensor_log.cpp} (98%) rename src/shared/{sensor_logs.h => sensor_log.h} (100%) diff --git a/src/client/client.cpp b/src/client/client.cpp index cf0091b..81d00d0 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/client/client_common.h b/src/client/client_common.h index ef3b645..1d5938d 100644 --- a/src/client/client_common.h +++ b/src/client/client_common.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #define BASE_GATHERING_INTERVAL 100 diff --git a/src/client/sensor_handle_info.h b/src/client/sensor_handle_info.h index e70c386..d9b2ec9 100644 --- a/src/client/sensor_handle_info.h +++ b/src/client/sensor_handle_info.h @@ -21,7 +21,7 @@ #define _SENSOR_HANDLE_INFO_H_ #include -#include +#include #include #include #include diff --git a/src/server/client_info_manager.cpp b/src/server/client_info_manager.cpp index c7f1c25..6c84889 100644 --- a/src/server/client_info_manager.cpp +++ b/src/server/client_info_manager.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include using std::pair; diff --git a/src/server/client_info_manager.h b/src/server/client_info_manager.h index 3eec26e..bee9995 100644 --- a/src/server/client_info_manager.h +++ b/src/server/client_info_manager.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include diff --git a/src/server/client_sensor_record.cpp b/src/server/client_sensor_record.cpp index cdca1e1..fbc4ed8 100644 --- a/src/server/client_sensor_record.cpp +++ b/src/server/client_sensor_record.cpp @@ -18,7 +18,7 @@ */ #include -#include +#include using std::pair; using std::string; diff --git a/src/server/device_config.h b/src/server/device_config.h index c7f58a2..a5f2339 100644 --- a/src/server/device_config.h +++ b/src/server/device_config.h @@ -22,7 +22,7 @@ #include #include -#include +#include class device_config { protected: diff --git a/src/server/main.cpp b/src/server/main.cpp index 6bda15a..6e46c25 100644 --- a/src/server/main.cpp +++ b/src/server/main.cpp @@ -18,7 +18,7 @@ */ #include -#include +#include #include #include #include diff --git a/src/server/permission_checker.cpp b/src/server/permission_checker.cpp index 9eb9e63..e2ed12e 100644 --- a/src/server/permission_checker.cpp +++ b/src/server/permission_checker.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/server/plugins/accel/accel_sensor.cpp b/src/server/plugins/accel/accel_sensor.cpp index 0c71bc8..4fe9f5b 100644 --- a/src/server/plugins/accel/accel_sensor.cpp +++ b/src/server/plugins/accel/accel_sensor.cpp @@ -18,7 +18,7 @@ */ #include -#include +#include #include accel_sensor::accel_sensor() diff --git a/src/server/plugins/auto_rotation/auto_rotation_alg.cpp b/src/server/plugins/auto_rotation/auto_rotation_alg.cpp index 2f3ee2a..14f61ae 100644 --- a/src/server/plugins/auto_rotation/auto_rotation_alg.cpp +++ b/src/server/plugins/auto_rotation/auto_rotation_alg.cpp @@ -17,7 +17,7 @@ * */ -#include +#include #include auto_rotation_alg::auto_rotation_alg() diff --git a/src/server/plugins/auto_rotation/auto_rotation_alg_emul.cpp b/src/server/plugins/auto_rotation/auto_rotation_alg_emul.cpp index 353a20a..e3200dd 100644 --- a/src/server/plugins/auto_rotation/auto_rotation_alg_emul.cpp +++ b/src/server/plugins/auto_rotation/auto_rotation_alg_emul.cpp @@ -18,7 +18,7 @@ */ #include -#include +#include #include #include #include diff --git a/src/server/plugins/auto_rotation/auto_rotation_sensor.cpp b/src/server/plugins/auto_rotation/auto_rotation_sensor.cpp index 68e4b80..b1f7dba 100644 --- a/src/server/plugins/auto_rotation/auto_rotation_sensor.cpp +++ b/src/server/plugins/auto_rotation/auto_rotation_sensor.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include diff --git a/src/server/plugins/fusion/fusion_sensor.cpp b/src/server/plugins/fusion/fusion_sensor.cpp index 412f8b0..5766a04 100644 --- a/src/server/plugins/fusion/fusion_sensor.cpp +++ b/src/server/plugins/fusion/fusion_sensor.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/server/plugins/gravity/gravity_sensor.cpp b/src/server/plugins/gravity/gravity_sensor.cpp index 4cfc528..d81242a 100644 --- a/src/server/plugins/gravity/gravity_sensor.cpp +++ b/src/server/plugins/gravity/gravity_sensor.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/server/plugins/linear_accel/linear_accel_sensor.cpp b/src/server/plugins/linear_accel/linear_accel_sensor.cpp index 6a43e75..67095f8 100644 --- a/src/server/plugins/linear_accel/linear_accel_sensor.cpp +++ b/src/server/plugins/linear_accel/linear_accel_sensor.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/server/plugins/orientation/orientation_sensor.cpp b/src/server/plugins/orientation/orientation_sensor.cpp index 3bd6047..7ace6ee 100644 --- a/src/server/plugins/orientation/orientation_sensor.cpp +++ b/src/server/plugins/orientation/orientation_sensor.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/server/plugins/rotation_vector/gaming_rv/gaming_rv_sensor.cpp b/src/server/plugins/rotation_vector/gaming_rv/gaming_rv_sensor.cpp index 0296707..5a7adc2 100644 --- a/src/server/plugins/rotation_vector/gaming_rv/gaming_rv_sensor.cpp +++ b/src/server/plugins/rotation_vector/gaming_rv/gaming_rv_sensor.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/server/plugins/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.cpp b/src/server/plugins/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.cpp index 6ca994c..e7cbfb3 100644 --- a/src/server/plugins/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.cpp +++ b/src/server/plugins/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/server/plugins/rotation_vector/rv/rv_sensor.cpp b/src/server/plugins/rotation_vector/rv/rv_sensor.cpp index 1fc7db0..79b5cc5 100644 --- a/src/server/plugins/rotation_vector/rv/rv_sensor.cpp +++ b/src/server/plugins/rotation_vector/rv/rv_sensor.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/server/plugins/tilt/tilt_sensor.cpp b/src/server/plugins/tilt/tilt_sensor.cpp index 8b1af3c..e37a448 100644 --- a/src/server/plugins/tilt/tilt_sensor.cpp +++ b/src/server/plugins/tilt/tilt_sensor.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/server/sensor_base.h b/src/server/sensor_base.h index fcf5751..144de20 100644 --- a/src/server/sensor_base.h +++ b/src/server/sensor_base.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/server/sensor_event_dispatcher.cpp b/src/server/sensor_event_dispatcher.cpp index 598f172..6333fb1 100644 --- a/src/server/sensor_event_dispatcher.cpp +++ b/src/server/sensor_event_dispatcher.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include using std::thread; diff --git a/src/server/sensor_event_queue.cpp b/src/server/sensor_event_queue.cpp index c26e83e..27865ea 100644 --- a/src/server/sensor_event_queue.cpp +++ b/src/server/sensor_event_queue.cpp @@ -18,7 +18,7 @@ */ #include -#include "sensor_logs.h" +#include "sensor_log.h" sensor_event_queue& sensor_event_queue::get_instance() { diff --git a/src/server/sensor_loader.cpp b/src/server/sensor_loader.cpp index cc7b533..95dfd6c 100644 --- a/src/server/sensor_loader.cpp +++ b/src/server/sensor_loader.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/server/sensor_usage.cpp b/src/server/sensor_usage.cpp index 6f604fa..08963ce 100644 --- a/src/server/sensor_usage.cpp +++ b/src/server/sensor_usage.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include sensor_usage::sensor_usage() : m_interval(POLL_MAX_HZ_MS) diff --git a/src/server/virtual_sensor_config.cpp b/src/server/virtual_sensor_config.cpp index ae23c1c..4e30ba8 100644 --- a/src/server/virtual_sensor_config.cpp +++ b/src/server/virtual_sensor_config.cpp @@ -18,7 +18,7 @@ */ #include -#include "sensor_logs.h" +#include "sensor_log.h" #include #include #include diff --git a/src/server/worker_thread.cpp b/src/server/worker_thread.cpp index 2590588..152cc19 100644 --- a/src/server/worker_thread.cpp +++ b/src/server/worker_thread.cpp @@ -17,7 +17,7 @@ * */ -#include +#include #include #include diff --git a/src/shared/cbase_lock.cpp b/src/shared/cbase_lock.cpp index bc85c19..2aec244 100644 --- a/src/shared/cbase_lock.cpp +++ b/src/shared/cbase_lock.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include cbase_lock::cbase_lock() { diff --git a/src/shared/cmutex.cpp b/src/shared/cmutex.cpp index fb09f7c..d8ef7fe 100644 --- a/src/shared/cmutex.cpp +++ b/src/shared/cmutex.cpp @@ -18,7 +18,7 @@ */ #include -#include "sensor_logs.h" +#include "sensor_log.h" cmutex::cmutex() { diff --git a/src/shared/cpacket.cpp b/src/shared/cpacket.cpp index 6cb6e8c..a400b4e 100644 --- a/src/shared/cpacket.cpp +++ b/src/shared/cpacket.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/shared/csocket.h b/src/shared/csocket.h index 42b7733..81abac4 100644 --- a/src/shared/csocket.h +++ b/src/shared/csocket.h @@ -26,7 +26,7 @@ #include #include #include -#include "sensor_logs.h" +#include "sensor_log.h" class csocket { public: diff --git a/src/shared/poller.cpp b/src/shared/poller.cpp index fa5500e..50c1f18 100644 --- a/src/shared/poller.cpp +++ b/src/shared/poller.cpp @@ -18,7 +18,7 @@ */ #include #include -#include +#include #include #define EPOLL_MAX 32 diff --git a/src/shared/sensor_info.cpp b/src/shared/sensor_info.cpp index 0f6a188..030b99e 100644 --- a/src/shared/sensor_info.cpp +++ b/src/shared/sensor_info.cpp @@ -18,7 +18,7 @@ */ #include -#include +#include #include #include #include diff --git a/src/shared/sensor_logs.cpp b/src/shared/sensor_log.cpp similarity index 98% rename from src/shared/sensor_logs.cpp rename to src/shared/sensor_log.cpp index e98e41b..98ccf20 100644 --- a/src/shared/sensor_logs.cpp +++ b/src/shared/sensor_log.cpp @@ -25,7 +25,7 @@ #include #include #include -#include "sensor_logs.h" +#include "sensor_log.h" #define PATH_MAX 256 diff --git a/src/shared/sensor_logs.h b/src/shared/sensor_log.h similarity index 100% rename from src/shared/sensor_logs.h rename to src/shared/sensor_log.h -- 2.7.4 From 72d07c17de8e8dc90e68fbdb93a803ad0d3f600b Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Sat, 20 Feb 2016 17:29:39 +0900 Subject: [PATCH 08/16] sensord: fix the bug about calling read_sensor_data * separate remain_count from state Change-Id: Ie36edd11e33f6b30230c05671d865f84716ed5e9 Signed-off-by: kibak.yoon --- src/server/command_worker.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/server/command_worker.cpp b/src/server/command_worker.cpp index 1df1fda..8e6931d 100644 --- a/src/server/command_worker.cpp +++ b/src/server/command_worker.cpp @@ -733,6 +733,7 @@ bool command_worker::cmd_get_data(void *payload) { const unsigned int GET_DATA_MIN_INTERVAL = 10; int state = OP_ERROR; + int remain_count; bool adjusted = false; int length; @@ -747,7 +748,7 @@ bool command_worker::cmd_get_data(void *payload) goto out; } - state = m_module->get_data(&data, &length); + remain_count = m_module->get_data(&data, &length); // In case of not getting sensor data, wait short time and retry again // 1. changing interval to be less than 10ms @@ -756,7 +757,7 @@ bool command_worker::cmd_get_data(void *payload) // 4. retrying to get data // 5. repeat 2 ~ 4 operations RETRY_CNT times // 6. reverting back to original interval - if ((state >= 0) && !data->timestamp) { + if ((remain_count >= 0) && !data->timestamp) { const int RETRY_CNT = 5; const unsigned long long INIT_WAIT_TIME = 20000; //20ms const unsigned long WAIT_TIME = 100000; //100ms @@ -769,20 +770,20 @@ bool command_worker::cmd_get_data(void *payload) adjusted = true; } - while ((state >= 0) && !data->timestamp && (retry++ < RETRY_CNT)) { + while ((remain_count >= 0) && !data->timestamp && (retry++ < RETRY_CNT)) { _I("Wait sensor[0x%llx] data updated for client [%d] #%d", m_sensor_id, m_client_id, retry); usleep((retry == 1) ? INIT_WAIT_TIME : WAIT_TIME); - state = m_module->get_data(&data, &length); + remain_count = m_module->get_data(&data, &length); } if (adjusted) m_module->add_interval(m_client_id, interval, false); } - if (!data->timestamp) - state = OP_ERROR; + if (data->timestamp) + state = OP_SUCCESS; - if (state <= 0) { + if (state < 0) { _E("Failed to get data for client [%d], for sensor [0x%llx]", m_client_id, m_sensor_id); } -- 2.7.4 From ff9e0341903d99770c4ddd076a49dea59bd3031f Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Sat, 20 Feb 2016 18:54:42 +0900 Subject: [PATCH 09/16] sensord: change to systemd socket - use systemd socket for event socket Change-Id: Ib18c94092aa9cd93b097ee270a40220d17d7e0ab Signed-off-by: kibak.yoon --- packaging/sensord.spec | 9 +- src/server/sensor_event_dispatcher.cpp | 43 +----- src/server/sensor_event_dispatcher.h | 4 +- src/server/server.cpp | 161 +++++++++++++++------ src/server/server.h | 10 +- src/shared/csocket.cpp | 16 -- systemd/CMakeLists.txt | 3 +- systemd/sensord.service | 4 +- systemd/{sensord.socket => sensord_command.socket} | 2 +- systemd/sensord_event.socket | 11 ++ 10 files changed, 158 insertions(+), 105 deletions(-) rename systemd/{sensord.socket => sensord_command.socket} (80%) create mode 100644 systemd/sensord_event.socket diff --git a/packaging/sensord.spec b/packaging/sensord.spec index 92c5c11..7b93195 100644 --- a/packaging/sensord.spec +++ b/packaging/sensord.spec @@ -90,7 +90,8 @@ rm -rf %{buildroot} %make_install %install_service multi-user.target.wants sensord.service -%install_service sockets.target.wants sensord.socket +%install_service sockets.target.wants sensord_event.socket +%install_service sockets.target.wants sensord_command.socket %post systemctl daemon-reload @@ -110,9 +111,11 @@ ln -sf %{_libdir}/libsensor.so.%{version} %{_libdir}/libsensor.so.1 %manifest sensord.manifest %{_bindir}/sensord %{_unitdir}/sensord.service -%{_unitdir}/sensord.socket +%{_unitdir}/sensord_command.socket +%{_unitdir}/sensord_event.socket %{_unitdir}/multi-user.target.wants/sensord.service -%{_unitdir}/sockets.target.wants/sensord.socket +%{_unitdir}/sockets.target.wants/sensord_command.socket +%{_unitdir}/sockets.target.wants/sensord_event.socket %license LICENSE.APLv2 %files -n libsensord diff --git a/src/server/sensor_event_dispatcher.cpp b/src/server/sensor_event_dispatcher.cpp index 6333fb1..d2deaa2 100644 --- a/src/server/sensor_event_dispatcher.cpp +++ b/src/server/sensor_event_dispatcher.cpp @@ -42,30 +42,8 @@ sensor_event_dispatcher& sensor_event_dispatcher::get_instance() return inst; } - bool sensor_event_dispatcher::run(void) { - _I("Starting Event Dispatcher\n"); - - if (!m_accept_socket.create(SOCK_SEQPACKET)) { - _E("Listener Socket Creation failed in Server \n"); - return false; - } - - if(!m_accept_socket.bind(EVENT_CHANNEL_PATH)) { - _E("Listener Socket Binding failed in Server \n"); - m_accept_socket.close(); - return false; - } - - if(!m_accept_socket.listen(MAX_PENDING_CONNECTION)) { - _E("Socket Listen failed in Server \n"); - return false; - } - - thread accepter(&sensor_event_dispatcher::accept_connections, this); - accepter.detach(); - thread dispatcher(&sensor_event_dispatcher::dispatch_event, this); dispatcher.detach(); @@ -87,8 +65,6 @@ void sensor_event_dispatcher::accept_event_channel(csocket client_socket) client_socket.set_transfer_mode(); - AUTOLOCK(m_mutex); - if(!get_client_info_manager().set_event_socket(client_id, client_socket)) { _E("Failed to store event socket[%d] for %s", client_socket.get_socket_fd(), client_info_manager.get_client_info(client_id)); @@ -108,23 +84,10 @@ void sensor_event_dispatcher::accept_event_channel(csocket client_socket) } } -void sensor_event_dispatcher::accept_connections(void) +void sensor_event_dispatcher::accept_event_connections(csocket client_socket) { - _I("Event channel acceptor is started.\n"); - - while (true) { - csocket client_socket; - - if (!m_accept_socket.accept(client_socket)) { - _E("Accepting socket failed in Server \n"); - continue; - } - - _I("New client connected (socket_fd : %d)\n", client_socket.get_socket_fd()); - - thread event_channel_creator(&sensor_event_dispatcher::accept_event_channel, this, client_socket); - event_channel_creator.detach(); - } + thread event_channel_creator(&sensor_event_dispatcher::accept_event_channel, this, client_socket); + event_channel_creator.detach(); } void sensor_event_dispatcher::dispatch_event(void) diff --git a/src/server/sensor_event_dispatcher.h b/src/server/sensor_event_dispatcher.h index befa90e..bc23f5c 100644 --- a/src/server/sensor_event_dispatcher.h +++ b/src/server/sensor_event_dispatcher.h @@ -47,7 +47,6 @@ private: sensor_event_dispatcher(sensor_event_dispatcher const&) {}; sensor_event_dispatcher& operator=(sensor_event_dispatcher const&); - void accept_connections(void); void accept_event_channel(csocket client_socket); void dispatch_event(void); @@ -65,7 +64,10 @@ private: void sort_sensor_events(std::vector &events); public: static sensor_event_dispatcher& get_instance(); + bool run(void); + void accept_event_connections(csocket client_socket); + void request_last_event(int client_id, sensor_id_t sensor_id); bool add_active_virtual_sensor(virtual_sensor *sensor); diff --git a/src/server/server.cpp b/src/server/server.cpp index 39900bc..52671ce 100644 --- a/src/server/server.cpp +++ b/src/server/server.cpp @@ -26,6 +26,8 @@ #include #include +#define SYSTEMD_SOCKET_MAX 2 + using std::thread; server::server() @@ -42,32 +44,43 @@ server::~server() int server::get_systemd_socket(const char *name) { int type = SOCK_STREAM; - const int listening = 1; + int listening = 1; size_t length = 0; int fd = -1; + int fd_env = 1; + int fd_index; + + if (!strcmp(name, EVENT_CHANNEL_PATH)) { + type = SOCK_SEQPACKET; + listening = -1; + fd_env = 0; + } - if (sd_listen_fds(1) != 1) + if (sd_listen_fds(fd_env) < 0) { + ERR("Failed to listen fds from systemd"); return -1; + } - fd = SD_LISTEN_FDS_START + 0; + for (fd_index = 0; fd_index < SYSTEMD_SOCKET_MAX; ++fd_index) { + fd = SD_LISTEN_FDS_START + fd_index; - if (sd_is_socket_unix(fd, type, listening, name, length) > 0) - return fd; + if (sd_is_socket_unix(fd, type, listening, name, length) > 0) + return fd; + } return -1; } -void server::accept_client(void) +void server::accept_command_channel(void) { command_worker *cmd_worker; - - _I("Client acceptor is started"); + _I("Command channel acceptor is started"); while (true) { csocket client_command_socket; - if (!m_client_accep_socket.accept(client_command_socket)) { - _E("Failed to accept connection request from a client"); + if (!m_command_channel_accept_socket.accept(client_command_socket)) { + _E("Failed to accept command channel from a client"); continue; } @@ -80,11 +93,29 @@ void server::accept_client(void) continue; } - if(!cmd_worker->start()) + if (!cmd_worker->start()) delete cmd_worker; } } +void server::accept_event_channel(void) +{ + _I("Event channel acceptor is started"); + + while (true) { + csocket client_event_socket; + + if (!m_event_channel_accept_socket.accept(client_event_socket)) { + _E("Failed to accept event channel from a client"); + continue; + } + + _D("New client(socket_fd : %d) connected", client_event_socket.get_socket_fd()); + + sensor_event_dispatcher::get_instance().accept_event_connections(client_event_socket); + } +} + void server::poll_event(void) { _I("Event poller is started"); @@ -99,39 +130,18 @@ void server::poll_event(void) void server::run(void) { - int sock_fd = -1; - const int MAX_PENDING_CONNECTION = 5; - m_mainloop = g_main_loop_new(NULL, false); - sock_fd = get_systemd_socket(COMMAND_CHANNEL_PATH); - - if (sock_fd >= 0) { - _I("Succeeded to get systemd socket(%d)", sock_fd); - m_client_accep_socket = csocket(sock_fd); - } else { - _E("Failed to get systemd socket, create it by myself!"); - if (!m_client_accep_socket.create(SOCK_STREAM)) { - _E("Failed to create command channel"); - return; - } - - if(!m_client_accep_socket.bind(COMMAND_CHANNEL_PATH)) { - _E("Failed to bind command channel"); - m_client_accep_socket.close(); - return; - } + sensor_event_dispatcher::get_instance().run(); - if(!m_client_accep_socket.listen(MAX_PENDING_CONNECTION)) { - _E("Failed to listen command channel"); - return; - } - } + listen_command_channel(); + listen_event_channel(); - sensor_event_dispatcher::get_instance().run(); + thread event_channel_accepter(&server::accept_event_channel, this); + event_channel_accepter.detach(); - thread client_accepter(&server::accept_client, this); - client_accepter.detach(); + thread command_channel_accepter(&server::accept_command_channel, this); + command_channel_accepter.detach(); thread event_poller(&server::poll_event, this); event_poller.detach(); @@ -144,12 +154,81 @@ void server::run(void) return; } +bool server::listen_command_channel(void) +{ + int sock_fd = -1; + const int MAX_PENDING_CONNECTION = 10; + + sock_fd = get_systemd_socket(COMMAND_CHANNEL_PATH); + + if (sock_fd >= 0) { + INFO("Succeeded to get systemd socket(%d)", sock_fd); + m_command_channel_accept_socket = csocket(sock_fd); + return true; + } + + INFO("Failed to get systemd socket, create it by myself!"); + if (!m_command_channel_accept_socket.create(SOCK_STREAM)) { + ERR("Failed to create command channel"); + return false; + } + + if (!m_command_channel_accept_socket.bind(COMMAND_CHANNEL_PATH)) { + ERR("Failed to bind command channel"); + m_command_channel_accept_socket.close(); + return false; + } + + if (!m_command_channel_accept_socket.listen(MAX_PENDING_CONNECTION)) { + ERR("Failed to listen command channel"); + return false; + } + + return true; +} + +bool server::listen_event_channel(void) +{ + int sock_fd = -1; + const int MAX_PENDING_CONNECTION = 32; + + sock_fd = get_systemd_socket(EVENT_CHANNEL_PATH); + + if (sock_fd >= 0) { + INFO("Succeeded to get systemd socket(%d)", sock_fd); + m_event_channel_accept_socket = csocket(sock_fd); + return true; + } + + INFO("Failed to get systemd socket, create it by myself!"); + + if (!m_event_channel_accept_socket.create(SOCK_SEQPACKET)) { + ERR("Failed to create event channel"); + return false; + } + + if (!m_event_channel_accept_socket.bind(EVENT_CHANNEL_PATH)) { + ERR("Failed to bind event channel"); + m_event_channel_accept_socket.close(); + return false; + } + + if (!m_event_channel_accept_socket.listen(MAX_PENDING_CONNECTION)) { + ERR("Failed to listen event channel"); + m_event_channel_accept_socket.close(); + return false; + } + + return true; +} + void server::stop(void) { - if(m_mainloop) + if (m_mainloop) g_main_loop_quit(m_mainloop); - m_client_accep_socket.close(); + m_command_channel_accept_socket.close(); + m_event_channel_accept_socket.close(); } server& server::get_instance() diff --git a/src/server/server.h b/src/server/server.h index 53549f6..8c69a7a 100644 --- a/src/server/server.h +++ b/src/server/server.h @@ -26,13 +26,21 @@ class server { private: GMainLoop *m_mainloop; - csocket m_client_accep_socket; + csocket m_command_channel_accept_socket; + csocket m_event_channel_accept_socket; server(); ~server(); void poll_event(void); void accept_client(void); + + bool listen_command_channel(void); + bool listen_event_channel(void); + + void accept_command_channel(void); + void accept_event_channel(void); + int get_systemd_socket(const char *name); public: void run(void); diff --git a/src/shared/csocket.cpp b/src/shared/csocket.cpp index a58b22a..b31cb0e 100644 --- a/src/shared/csocket.cpp +++ b/src/shared/csocket.cpp @@ -88,22 +88,6 @@ bool csocket::bind (const char *sock_path) return false; } - if((fsetxattr(m_sock_fd, "security.SMACK64IPOUT", "@", 2, 0)) < 0) { - if(errno != EOPNOTSUPP) { - close(); - _E("security.SMACK64IPOUT error = [%d][%s]\n", errno, strerror(errno) ); - return false; - } - } - - if((fsetxattr(m_sock_fd, "security.SMACK64IPIN", "*", 2, 0)) < 0) { - if(errno != EOPNOTSUPP) { - close(); - _E("security.SMACK64IPIN error = [%d][%s]\n", errno, strerror(errno) ); - return false; - } - } - if (!access(sock_path, F_OK)) { unlink(sock_path); } diff --git a/systemd/CMakeLists.txt b/systemd/CMakeLists.txt index 233e8ba..64fbd69 100644 --- a/systemd/CMakeLists.txt +++ b/systemd/CMakeLists.txt @@ -1,5 +1,6 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/sensord.service - ${CMAKE_CURRENT_SOURCE_DIR}/sensord.socket + ${CMAKE_CURRENT_SOURCE_DIR}/sensord_command.socket + ${CMAKE_CURRENT_SOURCE_DIR}/sensord_event.socket DESTINATION lib/systemd/system) diff --git a/systemd/sensord.service b/systemd/sensord.service index d3ab961..26821a8 100644 --- a/systemd/sensord.service +++ b/systemd/sensord.service @@ -6,7 +6,9 @@ Type=notify ExecStart=/usr/bin/sensord Restart=always RestartSec=0 -MemoryLimit=10M +MemoryLimit=20M +Sockets=sensord_command.socket +Sockets=sensord_event.socket [Install] WantedBy=multi-user.target diff --git a/systemd/sensord.socket b/systemd/sensord_command.socket similarity index 80% rename from systemd/sensord.socket rename to systemd/sensord_command.socket index b8bd460..4af2f60 100644 --- a/systemd/sensord.socket +++ b/systemd/sensord_command.socket @@ -1,5 +1,5 @@ [Unit] -Description=Sensor daemon socket +Description=Sensor command socket [Socket] ListenStream=/tmp/sensord_command_socket diff --git a/systemd/sensord_event.socket b/systemd/sensord_event.socket new file mode 100644 index 0000000..b6641a1 --- /dev/null +++ b/systemd/sensord_event.socket @@ -0,0 +1,11 @@ +[Unit] +Description=Sensor event socket + +[Socket] +ListenSequentialPacket=/tmp/sensord_event_socket +SocketMode=0777 +PassCredentials=yes +Accept=false +SmackLabelIPIn=* +SmackLabelIPOut=@ +Service=sensord.service -- 2.7.4 From 5f5f5883786083646df90db916d64c0da209d8a6 Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Sat, 20 Feb 2016 18:57:08 +0900 Subject: [PATCH 10/16] sensord: if poll() is failed, return false Change-Id: I74db7758d198f65265f982d3b72ebb5df1af705f Signed-off-by: kibak.yoon --- src/server/sensor_event_poller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/sensor_event_poller.cpp b/src/server/sensor_event_poller.cpp index 62b26b9..1d5e69b 100644 --- a/src/server/sensor_event_poller.cpp +++ b/src/server/sensor_event_poller.cpp @@ -82,7 +82,7 @@ bool sensor_event_poller::poll() struct epoll_event poll_event; if (!m_poller.poll(poll_event)) - continue; + return false; fd = poll_event.data.fd; ids.clear(); -- 2.7.4 From 38a96bf155069d5d971a1c889c08a4903eca0b0e Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Sat, 20 Feb 2016 19:10:00 +0900 Subject: [PATCH 11/16] sensord: fix the bug that set_attribute returns bool Change-Id: I63e0683bcd2fbb0f207522ec4003b05081eb5fe5 Signed-off-by: kibak.yoon --- src/server/physical_sensor.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/server/physical_sensor.cpp b/src/server/physical_sensor.cpp index e7c3516..0096e8e 100644 --- a/src/server/physical_sensor.cpp +++ b/src/server/physical_sensor.cpp @@ -22,6 +22,9 @@ #define UNKNOWN_NAME "UNKNOWN_SENSOR" +#define OP_SUCCESS 0 +#define OP_ERROR -1 + cmutex physical_sensor::m_mutex; physical_sensor::physical_sensor() @@ -152,7 +155,10 @@ int physical_sensor::set_attribute(int32_t attribute, int32_t value) if (!m_sensor_device) return false; - return m_sensor_device->set_attribute_int(m_info->id, attribute, value); + if (!m_sensor_device->set_attribute_int(m_info->id, attribute, value)) + return OP_ERROR; + + return OP_SUCCESS; } int physical_sensor::set_attribute(int32_t attribute, char *value, int value_len) @@ -162,7 +168,10 @@ int physical_sensor::set_attribute(int32_t attribute, char *value, int value_len if (!m_sensor_device) return false; - return m_sensor_device->set_attribute_str(m_info->id, attribute, value, value_len); + if (!m_sensor_device->set_attribute_str(m_info->id, attribute, value, value_len)) + return OP_ERROR; + + return OP_SUCCESS; } bool physical_sensor::set_wakeup(int wakeup) -- 2.7.4 From 7a2a3370d9f1bf3554f8dc83855856283cccc316 Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Wed, 2 Mar 2016 22:29:15 +0900 Subject: [PATCH 12/16] sensord: move .service/.socket to packaging Change-Id: Iaea00fe48fed8c44e20c24efbfc088e0c16f9cf9 Signed-off-by: kibak.yoon --- CMakeLists.txt | 1 - {systemd => packaging}/sensord.service | 0 packaging/sensord.spec | 20 +++++++++++++------- {systemd => packaging}/sensord_command.socket | 0 {systemd => packaging}/sensord_event.socket | 0 systemd/CMakeLists.txt | 6 ------ 6 files changed, 13 insertions(+), 14 deletions(-) rename {systemd => packaging}/sensord.service (100%) rename {systemd => packaging}/sensord_command.socket (100%) rename {systemd => packaging}/sensord_event.socket (100%) delete mode 100644 systemd/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 1994fe5..9b88ac8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,6 @@ INCLUDE_DIRECTORIES( ) # Sub-directory -ADD_SUBDIRECTORY(systemd) ADD_SUBDIRECTORY(src/server) ADD_SUBDIRECTORY(src/client) ADD_SUBDIRECTORY(src/shared) diff --git a/systemd/sensord.service b/packaging/sensord.service similarity index 100% rename from systemd/sensord.service rename to packaging/sensord.service diff --git a/packaging/sensord.spec b/packaging/sensord.spec index 7b93195..fdc6316 100644 --- a/packaging/sensord.spec +++ b/packaging/sensord.spec @@ -2,11 +2,13 @@ Name: sensord Summary: Sensor daemon Version: 2.0.2 Release: 0 -Group: System/Sensor Framework +Group: System/Sensor Framework License: Apache-2.0 Source0: %{name}-%{version}.tar.gz -Source1: sensord.manifest -Source2: libsensord.manifest +Source1: sensord.service +Source2: sensord_command.socket +Source3: sensord_event.socket + BuildRequires: cmake BuildRequires: libattr-devel @@ -70,8 +72,6 @@ Sensor functional testing %prep %setup -q -cp %{SOURCE1} . -cp %{SOURCE2} . MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` @@ -89,6 +89,12 @@ make %{?jobs:-j%jobs} rm -rf %{buildroot} %make_install +mkdir -p %{buildroot}%{_libdir}/systemd/system/ + +install -m 0644 %SOURCE1 %{buildroot}%{_libdir}/systemd/system/ +install -m 0644 %SOURCE2 %{buildroot}%{_libdir}/systemd/system/ +install -m 0644 %SOURCE3 %{buildroot}%{_libdir}/systemd/system/ + %install_service multi-user.target.wants sensord.service %install_service sockets.target.wants sensord_event.socket %install_service sockets.target.wants sensord_command.socket @@ -108,7 +114,7 @@ ln -sf %{_libdir}/libsensor.so.%{version} %{_libdir}/libsensor.so.1 %files %attr(0644,root,root)/usr/etc/virtual_sensors.xml -%manifest sensord.manifest +%manifest packaging/sensord.manifest %{_bindir}/sensord %{_unitdir}/sensord.service %{_unitdir}/sensord_command.socket @@ -120,7 +126,7 @@ ln -sf %{_libdir}/libsensor.so.%{version} %{_libdir}/libsensor.so.1 %files -n libsensord %defattr(-,root,root,-) -%manifest libsensord.manifest +%manifest packaging/libsensord.manifest %{_libdir}/libsensor.so.* %{_libdir}/libsensord-shared.so %license LICENSE.APLv2 diff --git a/systemd/sensord_command.socket b/packaging/sensord_command.socket similarity index 100% rename from systemd/sensord_command.socket rename to packaging/sensord_command.socket diff --git a/systemd/sensord_event.socket b/packaging/sensord_event.socket similarity index 100% rename from systemd/sensord_event.socket rename to packaging/sensord_event.socket diff --git a/systemd/CMakeLists.txt b/systemd/CMakeLists.txt deleted file mode 100644 index 64fbd69..0000000 --- a/systemd/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -INSTALL(FILES - ${CMAKE_CURRENT_SOURCE_DIR}/sensord.service - ${CMAKE_CURRENT_SOURCE_DIR}/sensord_command.socket - ${CMAKE_CURRENT_SOURCE_DIR}/sensord_event.socket - DESTINATION lib/systemd/system) - -- 2.7.4 From ecab3b1c44b4c3b7a285b66d32d9f931d234b9e6 Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Wed, 2 Mar 2016 22:41:10 +0900 Subject: [PATCH 13/16] sensord: restructuring sensord directories - src/server/plugins -> src/sensor - modify CMakeLists.txt Change-Id: I253b84e4dda7cc2cd4f62ca8e4b310be247881a6 Signed-off-by: kibak.yoon --- CMakeLists.txt | 12 +- src/client/CMakeLists.txt | 6 +- src/sensor/CMakeLists.txt | 70 +++++ .../plugins => sensor}/accel/accel_sensor.cpp | 0 .../plugins => sensor}/accel/accel_sensor.h | 0 .../auto_rotation/auto_rotation_alg.cpp | 0 .../auto_rotation/auto_rotation_alg.h | 0 .../auto_rotation/auto_rotation_alg_emul.cpp | 0 .../auto_rotation/auto_rotation_alg_emul.h | 0 .../auto_rotation/auto_rotation_sensor.cpp | 0 .../auto_rotation/auto_rotation_sensor.h | 0 .../plugins => sensor}/fusion/fusion_sensor.cpp | 0 .../plugins => sensor}/fusion/fusion_sensor.h | 0 .../fusion/hardware_fusion_sensor.html | 0 .../plugins => sensor}/gravity/gravity_sensor.cpp | 0 .../plugins => sensor}/gravity/gravity_sensor.h | 0 .../linear_accel/linear_accel_sensor.cpp | 0 .../linear_accel/linear_accel_sensor.h | 0 .../orientation/orientation_sensor.cpp | 0 .../orientation/orientation_sensor.h | 0 .../rotation_vector/gaming_rv/gaming_rv_sensor.cpp | 0 .../rotation_vector/gaming_rv/gaming_rv_sensor.h | 0 .../geomagnetic_rv/geomagnetic_rv_sensor.cpp | 0 .../geomagnetic_rv/geomagnetic_rv_sensor.h | 0 .../rotation_vector/rv/rv_sensor.cpp | 0 .../rotation_vector/rv/rv_sensor.h | 0 .../data/100ms/gravity/single_roll_throw/accel.txt | 0 .../data/100ms/gravity/single_roll_throw/gyro.txt | 0 .../100ms/gravity/single_roll_throw/magnetic.txt | 0 .../100ms/linear_acceleration/move_x_y_z/accel.txt | 0 .../100ms/linear_acceleration/move_x_y_z/gyro.txt | 0 .../linear_acceleration/move_x_y_z/magnetic.txt | 0 .../100ms/orientation/roll_pitch_yaw/accel.txt | 0 .../data/100ms/orientation/roll_pitch_yaw/gyro.txt | 0 .../100ms/orientation/roll_pitch_yaw/magnetic.txt | 0 .../data/25ms/pedo/Climb_stairs_down/In_hand/accel | 0 .../data/25ms/pedo/Climb_stairs_down/In_hand/gyro | 0 .../25ms/pedo/Climb_stairs_down/In_hand/magnetic | 0 .../25ms/pedo/Climb_stairs_down/Pant_pocket/accel | 0 .../25ms/pedo/Climb_stairs_down/Pant_pocket/gyro | 0 .../pedo/Climb_stairs_down/Pant_pocket/magnetic | 0 .../25ms/pedo/Climb_stairs_down/Shirt_pocket/accel | 0 .../25ms/pedo/Climb_stairs_down/Shirt_pocket/gyro | 0 .../pedo/Climb_stairs_down/Shirt_pocket/magnetic | 0 .../pedo/Climb_stairs_down/While_talking/accel | 0 .../25ms/pedo/Climb_stairs_down/While_talking/gyro | 0 .../pedo/Climb_stairs_down/While_talking/magnetic | 0 .../data/25ms/pedo/Climb_stairs_up/In_hand/accel | 0 .../data/25ms/pedo/Climb_stairs_up/In_hand/gyro | 0 .../25ms/pedo/Climb_stairs_up/In_hand/magnetic | 0 .../25ms/pedo/Climb_stairs_up/Pant_pocket/accel | 0 .../25ms/pedo/Climb_stairs_up/Pant_pocket/gyro | 0 .../25ms/pedo/Climb_stairs_up/Pant_pocket/magnetic | 0 .../25ms/pedo/Climb_stairs_up/Shirt_pocket/accel | 0 .../25ms/pedo/Climb_stairs_up/Shirt_pocket/gyro | 0 .../pedo/Climb_stairs_up/Shirt_pocket/magnetic | 0 .../25ms/pedo/Climb_stairs_up/While_talking/accel | 0 .../25ms/pedo/Climb_stairs_up/While_talking/gyro | 0 .../pedo/Climb_stairs_up/While_talking/magnetic | 0 .../design/data/25ms/pedo/Walk_fast/In_hand/accel | 0 .../design/data/25ms/pedo/Walk_fast/In_hand/gyro | 0 .../data/25ms/pedo/Walk_fast/In_hand/magnetic | 0 .../data/25ms/pedo/Walk_fast/Pant_pocket/accel | 0 .../data/25ms/pedo/Walk_fast/Pant_pocket/gyro | 0 .../data/25ms/pedo/Walk_fast/Pant_pocket/magnetic | 0 .../data/25ms/pedo/Walk_fast/Shirt_pocket/accel | 0 .../data/25ms/pedo/Walk_fast/Shirt_pocket/gyro | 0 .../data/25ms/pedo/Walk_fast/Shirt_pocket/magnetic | 0 .../data/25ms/pedo/Walk_fast/While_talking/accel | 0 .../data/25ms/pedo/Walk_fast/While_talking/gyro | 0 .../25ms/pedo/Walk_fast/While_talking/magnetic | 0 .../design/data/25ms/pedo/Walk_slow/In_hand/accel | 0 .../design/data/25ms/pedo/Walk_slow/In_hand/gyro | 0 .../data/25ms/pedo/Walk_slow/In_hand/magnetic | 0 .../data/25ms/pedo/Walk_slow/Pant_pocket/accel | 0 .../data/25ms/pedo/Walk_slow/Pant_pocket/gyro | 0 .../data/25ms/pedo/Walk_slow/Pant_pocket/magnetic | 0 .../data/25ms/pedo/Walk_slow/Shirt_pocket/accel | 0 .../data/25ms/pedo/Walk_slow/Shirt_pocket/gyro | 0 .../data/25ms/pedo/Walk_slow/Shirt_pocket/magnetic | 0 .../data/25ms/pedo/Walk_slow/While_talking/accel | 0 .../data/25ms/pedo/Walk_slow/While_talking/gyro | 0 .../25ms/pedo/Walk_slow/While_talking/magnetic | 0 ...ock_diagram_gravity_and_linear_acceleration.png | Bin .../block_diagram_orientation_estimation.png | Bin .../documentation/diagram/device_orientation.png | Bin .../documentation/diagram/kalman_filter_stages.png | Bin .../diagram/orientation_effect_on_gravity.png | Bin .../projection_diagram_gravity_computation.png | Bin .../design/documentation/equation/equation_1.png | Bin .../design/documentation/equation/equation_10.png | Bin .../design/documentation/equation/equation_11.png | Bin .../design/documentation/equation/equation_12.png | Bin .../design/documentation/equation/equation_13.png | Bin .../documentation/equation/equation_13_updated.png | Bin .../design/documentation/equation/equation_14.png | Bin .../design/documentation/equation/equation_15.png | Bin .../design/documentation/equation/equation_16.png | Bin .../design/documentation/equation/equation_17.png | Bin .../design/documentation/equation/equation_18.png | Bin .../design/documentation/equation/equation_19.png | Bin .../design/documentation/equation/equation_2.png | Bin .../design/documentation/equation/equation_20.png | Bin .../design/documentation/equation/equation_21.png | Bin .../design/documentation/equation/equation_22.png | Bin .../design/documentation/equation/equation_23.png | Bin .../design/documentation/equation/equation_24.png | Bin .../design/documentation/equation/equation_25.png | Bin .../design/documentation/equation/equation_26.png | Bin .../design/documentation/equation/equation_27.png | Bin .../design/documentation/equation/equation_28.png | Bin .../design/documentation/equation/equation_29.png | Bin .../design/documentation/equation/equation_3.png | Bin .../design/documentation/equation/equation_30.png | Bin .../design/documentation/equation/equation_31.png | Bin .../design/documentation/equation/equation_32.png | Bin .../design/documentation/equation/equation_33.png | Bin .../design/documentation/equation/equation_34.png | Bin .../design/documentation/equation/equation_35.png | Bin .../design/documentation/equation/equation_36.png | Bin .../design/documentation/equation/equation_37.png | Bin .../design/documentation/equation/equation_38.png | Bin .../design/documentation/equation/equation_39.png | Bin .../design/documentation/equation/equation_4.png | Bin .../design/documentation/equation/equation_40.png | Bin .../design/documentation/equation/equation_5.png | Bin .../design/documentation/equation/equation_6.png | Bin .../design/documentation/equation/equation_7.png | Bin .../design/documentation/equation/equation_8.png | Bin .../design/documentation/equation/equation_9.png | Bin .../design/documentation/sensor_fusion.htm | 0 .../sensor_fusion/design/lib/axis_rot2quat.m | 0 .../sensor_fusion/design/lib/estimate_gaming_rv.m | 0 .../design/lib/estimate_geomagnetic_rv.m | 0 .../sensor_fusion/design/lib/estimate_gravity.m | 0 .../design/lib/estimate_linear_acceleration.m | 0 .../design/lib/estimate_orientation.m | 0 .../sensor_fusion/design/lib/euler2quat.m | 0 .../sensor_fusion/design/lib/quat2euler.m | 0 .../sensor_fusion/design/lib/quat2rot_mat.m | 0 .../sensor_fusion/design/lib/quat_prod.m | 0 .../sensor_fusion/design/lib/rot_mat2quat.m | 0 .../sensor_fusion/design/lib/sf_pedometer.m | 0 .../plugins => sensor}/sensor_fusion/design/readme | 0 .../sensor_fusion/design/sf_gaming_rv.m | 0 .../sensor_fusion/design/sf_geomagnetic_rv.m | 0 .../sensor_fusion/design/sf_gravity.m | 0 .../sensor_fusion/design/sf_linear_acceleration.m | 0 .../sensor_fusion/design/sf_orientation.m | 0 .../sensor_fusion/euler_angles.cpp | 0 .../sensor_fusion/euler_angles.h | 0 .../plugins => sensor}/sensor_fusion/matrix.cpp | 0 .../plugins => sensor}/sensor_fusion/matrix.h | 0 .../sensor_fusion/orientation_filter.cpp | 0 .../sensor_fusion/orientation_filter.h | 0 .../sensor_fusion/quaternion.cpp | 0 .../plugins => sensor}/sensor_fusion/quaternion.h | 0 .../sensor_fusion/rotation_matrix.cpp | 0 .../sensor_fusion/rotation_matrix.h | 0 .../sensor_fusion/sensor_data.cpp | 0 .../plugins => sensor}/sensor_fusion/sensor_data.h | 0 .../sensor_fusion/test/gravity_sensor.cpp | 0 .../sensor_fusion/test/gravity_sensor.h | 0 .../test/linear_acceleration_sensor.cpp | 0 .../test/linear_acceleration_sensor.h | 0 .../sensor_fusion/test/orientation_sensor.cpp | 0 .../sensor_fusion/test/orientation_sensor.h | 0 .../euler_angles_test/euler_angles_main.cpp | 0 .../gravity_sensor_test/gravity_sensor_main.cpp | 0 .../linear_acceleration_sensor_main.cpp | 0 .../test/test_projects/matrix_test/matrix_main.cpp | 0 .../orientation_sensor_main.cpp | 0 .../quaternion_test/quaternion_main.cpp | 0 .../rotation_matrix_test/rotation_matrix_main.cpp | 0 .../sensor_data_test/sensor_data_main.cpp | 0 .../test/test_projects/vector_test/vector_main.cpp | 0 .../plugins => sensor}/sensor_fusion/vector.cpp | 0 .../plugins => sensor}/sensor_fusion/vector.h | 0 .../plugins => sensor}/tilt/tilt_sensor.cpp | 0 src/{server/plugins => sensor}/tilt/tilt_sensor.h | 0 src/{server/plugins => sensor}/virtual_sensors.xml | 0 src/server/CMakeLists.txt | 15 +- src/server/plugins/CMakeLists.txt | 126 --------- .../test/test_projects/euler_angles_test/.cproject | 112 -------- .../test/test_projects/euler_angles_test/.project | 89 ------- .../test_projects/gravity_sensor_test/.cproject | 117 --------- .../test_projects/gravity_sensor_test/.project | 89 ------- .../linear_acceleration_sensor_test/.cproject | 112 -------- .../linear_acceleration_sensor_test/.project | 89 ------- .../test/test_projects/matrix_test/.cproject | 112 -------- .../test/test_projects/matrix_test/.project | 89 ------- .../orientation_sensor_test/.cproject | 112 -------- .../test_projects/orientation_sensor_test/.project | 89 ------- .../test/test_projects/quaternion_test/.cproject | 112 -------- .../test/test_projects/quaternion_test/.project | 89 ------- .../test_projects/rotation_matrix_test/.cproject | 112 -------- .../test_projects/rotation_matrix_test/.project | 89 ------- .../test/test_projects/sensor_data_test/.cproject | 112 -------- .../test/test_projects/sensor_data_test/.project | 89 ------- .../test/test_projects/vector_test/.cproject | 112 -------- .../test/test_projects/vector_test/.project | 83 ------ src/server/plugins/sensor_module_create.cpp.in | 289 --------------------- src/shared/CMakeLists.txt | 6 +- {test => src/test}/CMakeLists.txt | 0 {test => src/test}/src/api-test.c | 0 {test => src/test}/src/check-sensor.c | 0 {test => src/test}/src/check-sensor.h | 0 {test => src/test}/src/fusion-data-collection.c | 0 .../test}/src/multi-process-performance-test.c | 0 .../test}/src/multi-thread-performance-test.c | 0 {test => src/test}/src/sensor-test.c | 0 211 files changed, 90 insertions(+), 2242 deletions(-) create mode 100644 src/sensor/CMakeLists.txt rename src/{server/plugins => sensor}/accel/accel_sensor.cpp (100%) rename src/{server/plugins => sensor}/accel/accel_sensor.h (100%) rename src/{server/plugins => sensor}/auto_rotation/auto_rotation_alg.cpp (100%) rename src/{server/plugins => sensor}/auto_rotation/auto_rotation_alg.h (100%) rename src/{server/plugins => sensor}/auto_rotation/auto_rotation_alg_emul.cpp (100%) rename src/{server/plugins => sensor}/auto_rotation/auto_rotation_alg_emul.h (100%) rename src/{server/plugins => sensor}/auto_rotation/auto_rotation_sensor.cpp (100%) rename src/{server/plugins => sensor}/auto_rotation/auto_rotation_sensor.h (100%) rename src/{server/plugins => sensor}/fusion/fusion_sensor.cpp (100%) rename src/{server/plugins => sensor}/fusion/fusion_sensor.h (100%) rename src/{server/plugins => sensor}/fusion/hardware_fusion_sensor.html (100%) rename src/{server/plugins => sensor}/gravity/gravity_sensor.cpp (100%) rename src/{server/plugins => sensor}/gravity/gravity_sensor.h (100%) rename src/{server/plugins => sensor}/linear_accel/linear_accel_sensor.cpp (100%) rename src/{server/plugins => sensor}/linear_accel/linear_accel_sensor.h (100%) rename src/{server/plugins => sensor}/orientation/orientation_sensor.cpp (100%) rename src/{server/plugins => sensor}/orientation/orientation_sensor.h (100%) rename src/{server/plugins => sensor}/rotation_vector/gaming_rv/gaming_rv_sensor.cpp (100%) rename src/{server/plugins => sensor}/rotation_vector/gaming_rv/gaming_rv_sensor.h (100%) rename src/{server/plugins => sensor}/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.cpp (100%) rename src/{server/plugins => sensor}/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.h (100%) rename src/{server/plugins => sensor}/rotation_vector/rv/rv_sensor.cpp (100%) rename src/{server/plugins => sensor}/rotation_vector/rv/rv_sensor.h (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/100ms/gravity/single_roll_throw/accel.txt (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/100ms/gravity/single_roll_throw/gyro.txt (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/100ms/gravity/single_roll_throw/magnetic.txt (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/100ms/linear_acceleration/move_x_y_z/accel.txt (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/100ms/linear_acceleration/move_x_y_z/gyro.txt (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/100ms/linear_acceleration/move_x_y_z/magnetic.txt (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/100ms/orientation/roll_pitch_yaw/accel.txt (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/100ms/orientation/roll_pitch_yaw/gyro.txt (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/100ms/orientation/roll_pitch_yaw/magnetic.txt (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/In_hand/accel (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/In_hand/gyro (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/In_hand/magnetic (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Pant_pocket/accel (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Pant_pocket/gyro (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Pant_pocket/magnetic (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Shirt_pocket/accel (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Shirt_pocket/gyro (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Shirt_pocket/magnetic (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/While_talking/accel (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/While_talking/gyro (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/While_talking/magnetic (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/In_hand/accel (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/In_hand/gyro (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/In_hand/magnetic (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Pant_pocket/accel (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Pant_pocket/gyro (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Pant_pocket/magnetic (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Shirt_pocket/accel (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Shirt_pocket/gyro (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Shirt_pocket/magnetic (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/While_talking/accel (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/While_talking/gyro (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/While_talking/magnetic (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_fast/In_hand/accel (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_fast/In_hand/gyro (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_fast/In_hand/magnetic (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_fast/Pant_pocket/accel (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_fast/Pant_pocket/gyro (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_fast/Pant_pocket/magnetic (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_fast/Shirt_pocket/accel (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_fast/Shirt_pocket/gyro (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_fast/Shirt_pocket/magnetic (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_fast/While_talking/accel (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_fast/While_talking/gyro (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_fast/While_talking/magnetic (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_slow/In_hand/accel (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_slow/In_hand/gyro (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_slow/In_hand/magnetic (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_slow/Pant_pocket/accel (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_slow/Pant_pocket/gyro (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_slow/Pant_pocket/magnetic (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_slow/Shirt_pocket/accel (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_slow/Shirt_pocket/gyro (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_slow/Shirt_pocket/magnetic (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_slow/While_talking/accel (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_slow/While_talking/gyro (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/data/25ms/pedo/Walk_slow/While_talking/magnetic (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/diagram/block_diagram_gravity_and_linear_acceleration.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/diagram/block_diagram_orientation_estimation.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/diagram/device_orientation.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/diagram/kalman_filter_stages.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/diagram/orientation_effect_on_gravity.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/diagram/projection_diagram_gravity_computation.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_1.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_10.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_11.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_12.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_13.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_13_updated.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_14.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_15.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_16.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_17.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_18.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_19.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_2.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_20.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_21.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_22.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_23.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_24.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_25.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_26.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_27.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_28.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_29.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_3.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_30.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_31.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_32.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_33.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_34.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_35.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_36.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_37.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_38.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_39.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_4.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_40.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_5.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_6.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_7.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_8.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/equation/equation_9.png (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/documentation/sensor_fusion.htm (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/lib/axis_rot2quat.m (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/lib/estimate_gaming_rv.m (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/lib/estimate_geomagnetic_rv.m (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/lib/estimate_gravity.m (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/lib/estimate_linear_acceleration.m (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/lib/estimate_orientation.m (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/lib/euler2quat.m (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/lib/quat2euler.m (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/lib/quat2rot_mat.m (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/lib/quat_prod.m (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/lib/rot_mat2quat.m (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/lib/sf_pedometer.m (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/readme (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/sf_gaming_rv.m (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/sf_geomagnetic_rv.m (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/sf_gravity.m (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/sf_linear_acceleration.m (100%) rename src/{server/plugins => sensor}/sensor_fusion/design/sf_orientation.m (100%) rename src/{server/plugins => sensor}/sensor_fusion/euler_angles.cpp (100%) rename src/{server/plugins => sensor}/sensor_fusion/euler_angles.h (100%) rename src/{server/plugins => sensor}/sensor_fusion/matrix.cpp (100%) rename src/{server/plugins => sensor}/sensor_fusion/matrix.h (100%) rename src/{server/plugins => sensor}/sensor_fusion/orientation_filter.cpp (100%) rename src/{server/plugins => sensor}/sensor_fusion/orientation_filter.h (100%) rename src/{server/plugins => sensor}/sensor_fusion/quaternion.cpp (100%) rename src/{server/plugins => sensor}/sensor_fusion/quaternion.h (100%) rename src/{server/plugins => sensor}/sensor_fusion/rotation_matrix.cpp (100%) rename src/{server/plugins => sensor}/sensor_fusion/rotation_matrix.h (100%) rename src/{server/plugins => sensor}/sensor_fusion/sensor_data.cpp (100%) rename src/{server/plugins => sensor}/sensor_fusion/sensor_data.h (100%) rename src/{server/plugins => sensor}/sensor_fusion/test/gravity_sensor.cpp (100%) rename src/{server/plugins => sensor}/sensor_fusion/test/gravity_sensor.h (100%) rename src/{server/plugins => sensor}/sensor_fusion/test/linear_acceleration_sensor.cpp (100%) rename src/{server/plugins => sensor}/sensor_fusion/test/linear_acceleration_sensor.h (100%) rename src/{server/plugins => sensor}/sensor_fusion/test/orientation_sensor.cpp (100%) rename src/{server/plugins => sensor}/sensor_fusion/test/orientation_sensor.h (100%) rename src/{server/plugins => sensor}/sensor_fusion/test/test_projects/euler_angles_test/euler_angles_main.cpp (100%) rename src/{server/plugins => sensor}/sensor_fusion/test/test_projects/gravity_sensor_test/gravity_sensor_main.cpp (100%) rename src/{server/plugins => sensor}/sensor_fusion/test/test_projects/linear_acceleration_sensor_test/linear_acceleration_sensor_main.cpp (100%) rename src/{server/plugins => sensor}/sensor_fusion/test/test_projects/matrix_test/matrix_main.cpp (100%) rename src/{server/plugins => sensor}/sensor_fusion/test/test_projects/orientation_sensor_test/orientation_sensor_main.cpp (100%) rename src/{server/plugins => sensor}/sensor_fusion/test/test_projects/quaternion_test/quaternion_main.cpp (100%) rename src/{server/plugins => sensor}/sensor_fusion/test/test_projects/rotation_matrix_test/rotation_matrix_main.cpp (100%) rename src/{server/plugins => sensor}/sensor_fusion/test/test_projects/sensor_data_test/sensor_data_main.cpp (100%) rename src/{server/plugins => sensor}/sensor_fusion/test/test_projects/vector_test/vector_main.cpp (100%) rename src/{server/plugins => sensor}/sensor_fusion/vector.cpp (100%) rename src/{server/plugins => sensor}/sensor_fusion/vector.h (100%) rename src/{server/plugins => sensor}/tilt/tilt_sensor.cpp (100%) rename src/{server/plugins => sensor}/tilt/tilt_sensor.h (100%) rename src/{server/plugins => sensor}/virtual_sensors.xml (100%) delete mode 100644 src/server/plugins/CMakeLists.txt delete mode 100644 src/server/plugins/sensor_fusion/test/test_projects/euler_angles_test/.cproject delete mode 100644 src/server/plugins/sensor_fusion/test/test_projects/euler_angles_test/.project delete mode 100644 src/server/plugins/sensor_fusion/test/test_projects/gravity_sensor_test/.cproject delete mode 100644 src/server/plugins/sensor_fusion/test/test_projects/gravity_sensor_test/.project delete mode 100644 src/server/plugins/sensor_fusion/test/test_projects/linear_acceleration_sensor_test/.cproject delete mode 100644 src/server/plugins/sensor_fusion/test/test_projects/linear_acceleration_sensor_test/.project delete mode 100644 src/server/plugins/sensor_fusion/test/test_projects/matrix_test/.cproject delete mode 100644 src/server/plugins/sensor_fusion/test/test_projects/matrix_test/.project delete mode 100644 src/server/plugins/sensor_fusion/test/test_projects/orientation_sensor_test/.cproject delete mode 100644 src/server/plugins/sensor_fusion/test/test_projects/orientation_sensor_test/.project delete mode 100644 src/server/plugins/sensor_fusion/test/test_projects/quaternion_test/.cproject delete mode 100644 src/server/plugins/sensor_fusion/test/test_projects/quaternion_test/.project delete mode 100644 src/server/plugins/sensor_fusion/test/test_projects/rotation_matrix_test/.cproject delete mode 100644 src/server/plugins/sensor_fusion/test/test_projects/rotation_matrix_test/.project delete mode 100644 src/server/plugins/sensor_fusion/test/test_projects/sensor_data_test/.cproject delete mode 100644 src/server/plugins/sensor_fusion/test/test_projects/sensor_data_test/.project delete mode 100644 src/server/plugins/sensor_fusion/test/test_projects/vector_test/.cproject delete mode 100644 src/server/plugins/sensor_fusion/test/test_projects/vector_test/.project delete mode 100644 src/server/plugins/sensor_module_create.cpp.in rename {test => src/test}/CMakeLists.txt (100%) rename {test => src/test}/src/api-test.c (100%) rename {test => src/test}/src/check-sensor.c (100%) rename {test => src/test}/src/check-sensor.h (100%) rename {test => src/test}/src/fusion-data-collection.c (100%) rename {test => src/test}/src/multi-process-performance-test.c (100%) rename {test => src/test}/src/multi-thread-performance-test.c (100%) rename {test => src/test}/src/sensor-test.c (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b88ac8..591edb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,19 +12,9 @@ MESSAGE("FLAGS: ${CMAKE_EXE_LINKER_FLAGS}") # Internal Debugging Options #add_definitions(-Wall -g -D_DEBUG) -INCLUDE_DIRECTORIES( - ${CMAKE_CURRENT_SOURCE_DIR}/src/ - ${CMAKE_CURRENT_SOURCE_DIR}/src/shared - ${CMAKE_CURRENT_SOURCE_DIR}/src/hal -) - # Sub-directory ADD_SUBDIRECTORY(src/server) ADD_SUBDIRECTORY(src/client) ADD_SUBDIRECTORY(src/shared) ADD_SUBDIRECTORY(src/hal) - -IF("${TEST_SUITE}" STREQUAL "ON") -ADD_SUBDIRECTORY(test) -ENDIF() - +ADD_SUBDIRECTORY(src/test) diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index f002263..0ad7db0 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -22,7 +22,11 @@ ENDFOREACH(flag) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden -g -fPIC") -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/src/hal + ${CMAKE_SOURCE_DIR}/src/shared + ${CMAKE_CURRENT_SOURCE_DIR} +) FILE(GLOB_RECURSE SRCS *.cpp) ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) diff --git a/src/sensor/CMakeLists.txt b/src/sensor/CMakeLists.txt new file mode 100644 index 0000000..b37f7bf --- /dev/null +++ b/src/sensor/CMakeLists.txt @@ -0,0 +1,70 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(sensors CXX) +INCLUDE(GNUInstallDirs) + +SET(HRM "OFF") +SET(HRM_VIRT "OFF") +SET(AUTO_ROTATION "ON") +SET(GRAVITY "OFF") +SET(LINEAR_ACCEL "OFF") +SET(ORIENTATION "OFF") +SET(FUSION "OFF") +SET(MOTION "OFF") +SET(RV "OFF") + +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/src/shared + ${CMAKE_SOURCE_DIR}/src/server + ${CMAKE_CURRENT_SOURCE_DIR} +) + +FILE(GLOB SENSOR_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) +SET(SENSOR_HEADERS ${SENSOR_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}) + +FILE(GLOB_RECURSE SENSOR_SRCS ${SENSOR_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/accel/*.cpp) +SET(SENSOR_HEADERS ${SENSOR_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/accel) +SET(SENSOR_DEFINITIONS ${SENSOR_DEFINITIONS} "-DENABLE_ACCEL") + +IF("${HRM}" STREQUAL "ON") + FILE(GLOB_RECURSE SENSOR_SRCS ${SENSOR_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/hrm/*.cpp) + SET(SENSOR_HEADERS ${SENSOR_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/hrm) + SET(SENSOR_DEFINITIONS ${SENSOR_DEFINITIONS} "-DENABLE_HRM") +ENDIF() +IF("${HRM_VIRT}" STREQUAL "ON") +add_subdirectory(hrm_virt) +ENDIF() +IF("${AUTO_ROTATION}" STREQUAL "ON") + FILE(GLOB_RECURSE SENSOR_SRCS ${SENSOR_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/auto_rotation/*.cpp) + SET(SENSOR_HEADERS ${SENSOR_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/auto_rotation) + SET(SENSOR_DEFINITIONS ${SENSOR_DEFINITIONS} "-DENABLE_AUTO_ROTATION") +ENDIF() +IF("${GRAVITY}" STREQUAL "ON") + FILE(GLOB_RECURSE SENSOR_SRCS ${SENSOR_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/gravity/*.cpp) + SET(SENSOR_HEADERS ${SENSOR_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/gravity) + SET(SENSOR_DEFINITIONS ${SENSOR_DEFINITIONS} "-DENABLE_GRAVITY") +ENDIF() +IF("${LINEAR_ACCEL}" STREQUAL "ON") + FILE(GLOB_RECURSE SENSOR_SRCS ${SENSOR_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/linear_accel/*.cpp) + SET(SENSOR_HEADERS ${SENSOR_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/linear_accel) + SET(SENSOR_DEFINITIONS ${SENSOR_DEFINITIONS} "-DENABLE_LINEAR_ACCEL") +ENDIF() +IF("${ORIENTATION}" STREQUAL "ON") +add_subdirectory(orientation) +ENDIF() +IF("${RV}" STREQUAL "ON") +add_subdirectory(rotation_vector) +ENDIF() +IF("${FUSION}" STREQUAL "ON") +add_subdirectory(fusion) +ENDIF() +IF("${MOTION}" STREQUAL "ON") +add_subdirectory(motion) +ENDIF() + +MESSAGE("${SENSOR_SRCS}") +SET(SENSOR_SRCS ${SENSOR_SRCS} PARENT_SCOPE) +SET(SENSOR_HEADERS ${SENSOR_HEADERS} PARENT_SCOPE) +SET(SENSOR_DEFINITIONS ${SENSOR_DEFINITIONS} PARENT_SCOPE) + +# Installing files +INSTALL(FILES virtual_sensors.xml virtual_sensors.xml DESTINATION etc) diff --git a/src/server/plugins/accel/accel_sensor.cpp b/src/sensor/accel/accel_sensor.cpp similarity index 100% rename from src/server/plugins/accel/accel_sensor.cpp rename to src/sensor/accel/accel_sensor.cpp diff --git a/src/server/plugins/accel/accel_sensor.h b/src/sensor/accel/accel_sensor.h similarity index 100% rename from src/server/plugins/accel/accel_sensor.h rename to src/sensor/accel/accel_sensor.h diff --git a/src/server/plugins/auto_rotation/auto_rotation_alg.cpp b/src/sensor/auto_rotation/auto_rotation_alg.cpp similarity index 100% rename from src/server/plugins/auto_rotation/auto_rotation_alg.cpp rename to src/sensor/auto_rotation/auto_rotation_alg.cpp diff --git a/src/server/plugins/auto_rotation/auto_rotation_alg.h b/src/sensor/auto_rotation/auto_rotation_alg.h similarity index 100% rename from src/server/plugins/auto_rotation/auto_rotation_alg.h rename to src/sensor/auto_rotation/auto_rotation_alg.h diff --git a/src/server/plugins/auto_rotation/auto_rotation_alg_emul.cpp b/src/sensor/auto_rotation/auto_rotation_alg_emul.cpp similarity index 100% rename from src/server/plugins/auto_rotation/auto_rotation_alg_emul.cpp rename to src/sensor/auto_rotation/auto_rotation_alg_emul.cpp diff --git a/src/server/plugins/auto_rotation/auto_rotation_alg_emul.h b/src/sensor/auto_rotation/auto_rotation_alg_emul.h similarity index 100% rename from src/server/plugins/auto_rotation/auto_rotation_alg_emul.h rename to src/sensor/auto_rotation/auto_rotation_alg_emul.h diff --git a/src/server/plugins/auto_rotation/auto_rotation_sensor.cpp b/src/sensor/auto_rotation/auto_rotation_sensor.cpp similarity index 100% rename from src/server/plugins/auto_rotation/auto_rotation_sensor.cpp rename to src/sensor/auto_rotation/auto_rotation_sensor.cpp diff --git a/src/server/plugins/auto_rotation/auto_rotation_sensor.h b/src/sensor/auto_rotation/auto_rotation_sensor.h similarity index 100% rename from src/server/plugins/auto_rotation/auto_rotation_sensor.h rename to src/sensor/auto_rotation/auto_rotation_sensor.h diff --git a/src/server/plugins/fusion/fusion_sensor.cpp b/src/sensor/fusion/fusion_sensor.cpp similarity index 100% rename from src/server/plugins/fusion/fusion_sensor.cpp rename to src/sensor/fusion/fusion_sensor.cpp diff --git a/src/server/plugins/fusion/fusion_sensor.h b/src/sensor/fusion/fusion_sensor.h similarity index 100% rename from src/server/plugins/fusion/fusion_sensor.h rename to src/sensor/fusion/fusion_sensor.h diff --git a/src/server/plugins/fusion/hardware_fusion_sensor.html b/src/sensor/fusion/hardware_fusion_sensor.html similarity index 100% rename from src/server/plugins/fusion/hardware_fusion_sensor.html rename to src/sensor/fusion/hardware_fusion_sensor.html diff --git a/src/server/plugins/gravity/gravity_sensor.cpp b/src/sensor/gravity/gravity_sensor.cpp similarity index 100% rename from src/server/plugins/gravity/gravity_sensor.cpp rename to src/sensor/gravity/gravity_sensor.cpp diff --git a/src/server/plugins/gravity/gravity_sensor.h b/src/sensor/gravity/gravity_sensor.h similarity index 100% rename from src/server/plugins/gravity/gravity_sensor.h rename to src/sensor/gravity/gravity_sensor.h diff --git a/src/server/plugins/linear_accel/linear_accel_sensor.cpp b/src/sensor/linear_accel/linear_accel_sensor.cpp similarity index 100% rename from src/server/plugins/linear_accel/linear_accel_sensor.cpp rename to src/sensor/linear_accel/linear_accel_sensor.cpp diff --git a/src/server/plugins/linear_accel/linear_accel_sensor.h b/src/sensor/linear_accel/linear_accel_sensor.h similarity index 100% rename from src/server/plugins/linear_accel/linear_accel_sensor.h rename to src/sensor/linear_accel/linear_accel_sensor.h diff --git a/src/server/plugins/orientation/orientation_sensor.cpp b/src/sensor/orientation/orientation_sensor.cpp similarity index 100% rename from src/server/plugins/orientation/orientation_sensor.cpp rename to src/sensor/orientation/orientation_sensor.cpp diff --git a/src/server/plugins/orientation/orientation_sensor.h b/src/sensor/orientation/orientation_sensor.h similarity index 100% rename from src/server/plugins/orientation/orientation_sensor.h rename to src/sensor/orientation/orientation_sensor.h diff --git a/src/server/plugins/rotation_vector/gaming_rv/gaming_rv_sensor.cpp b/src/sensor/rotation_vector/gaming_rv/gaming_rv_sensor.cpp similarity index 100% rename from src/server/plugins/rotation_vector/gaming_rv/gaming_rv_sensor.cpp rename to src/sensor/rotation_vector/gaming_rv/gaming_rv_sensor.cpp diff --git a/src/server/plugins/rotation_vector/gaming_rv/gaming_rv_sensor.h b/src/sensor/rotation_vector/gaming_rv/gaming_rv_sensor.h similarity index 100% rename from src/server/plugins/rotation_vector/gaming_rv/gaming_rv_sensor.h rename to src/sensor/rotation_vector/gaming_rv/gaming_rv_sensor.h diff --git a/src/server/plugins/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.cpp b/src/sensor/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.cpp similarity index 100% rename from src/server/plugins/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.cpp rename to src/sensor/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.cpp diff --git a/src/server/plugins/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.h b/src/sensor/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.h similarity index 100% rename from src/server/plugins/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.h rename to src/sensor/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.h diff --git a/src/server/plugins/rotation_vector/rv/rv_sensor.cpp b/src/sensor/rotation_vector/rv/rv_sensor.cpp similarity index 100% rename from src/server/plugins/rotation_vector/rv/rv_sensor.cpp rename to src/sensor/rotation_vector/rv/rv_sensor.cpp diff --git a/src/server/plugins/rotation_vector/rv/rv_sensor.h b/src/sensor/rotation_vector/rv/rv_sensor.h similarity index 100% rename from src/server/plugins/rotation_vector/rv/rv_sensor.h rename to src/sensor/rotation_vector/rv/rv_sensor.h diff --git a/src/server/plugins/sensor_fusion/design/data/100ms/gravity/single_roll_throw/accel.txt b/src/sensor/sensor_fusion/design/data/100ms/gravity/single_roll_throw/accel.txt similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/100ms/gravity/single_roll_throw/accel.txt rename to src/sensor/sensor_fusion/design/data/100ms/gravity/single_roll_throw/accel.txt diff --git a/src/server/plugins/sensor_fusion/design/data/100ms/gravity/single_roll_throw/gyro.txt b/src/sensor/sensor_fusion/design/data/100ms/gravity/single_roll_throw/gyro.txt similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/100ms/gravity/single_roll_throw/gyro.txt rename to src/sensor/sensor_fusion/design/data/100ms/gravity/single_roll_throw/gyro.txt diff --git a/src/server/plugins/sensor_fusion/design/data/100ms/gravity/single_roll_throw/magnetic.txt b/src/sensor/sensor_fusion/design/data/100ms/gravity/single_roll_throw/magnetic.txt similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/100ms/gravity/single_roll_throw/magnetic.txt rename to src/sensor/sensor_fusion/design/data/100ms/gravity/single_roll_throw/magnetic.txt diff --git a/src/server/plugins/sensor_fusion/design/data/100ms/linear_acceleration/move_x_y_z/accel.txt b/src/sensor/sensor_fusion/design/data/100ms/linear_acceleration/move_x_y_z/accel.txt similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/100ms/linear_acceleration/move_x_y_z/accel.txt rename to src/sensor/sensor_fusion/design/data/100ms/linear_acceleration/move_x_y_z/accel.txt diff --git a/src/server/plugins/sensor_fusion/design/data/100ms/linear_acceleration/move_x_y_z/gyro.txt b/src/sensor/sensor_fusion/design/data/100ms/linear_acceleration/move_x_y_z/gyro.txt similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/100ms/linear_acceleration/move_x_y_z/gyro.txt rename to src/sensor/sensor_fusion/design/data/100ms/linear_acceleration/move_x_y_z/gyro.txt diff --git a/src/server/plugins/sensor_fusion/design/data/100ms/linear_acceleration/move_x_y_z/magnetic.txt b/src/sensor/sensor_fusion/design/data/100ms/linear_acceleration/move_x_y_z/magnetic.txt similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/100ms/linear_acceleration/move_x_y_z/magnetic.txt rename to src/sensor/sensor_fusion/design/data/100ms/linear_acceleration/move_x_y_z/magnetic.txt diff --git a/src/server/plugins/sensor_fusion/design/data/100ms/orientation/roll_pitch_yaw/accel.txt b/src/sensor/sensor_fusion/design/data/100ms/orientation/roll_pitch_yaw/accel.txt similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/100ms/orientation/roll_pitch_yaw/accel.txt rename to src/sensor/sensor_fusion/design/data/100ms/orientation/roll_pitch_yaw/accel.txt diff --git a/src/server/plugins/sensor_fusion/design/data/100ms/orientation/roll_pitch_yaw/gyro.txt b/src/sensor/sensor_fusion/design/data/100ms/orientation/roll_pitch_yaw/gyro.txt similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/100ms/orientation/roll_pitch_yaw/gyro.txt rename to src/sensor/sensor_fusion/design/data/100ms/orientation/roll_pitch_yaw/gyro.txt diff --git a/src/server/plugins/sensor_fusion/design/data/100ms/orientation/roll_pitch_yaw/magnetic.txt b/src/sensor/sensor_fusion/design/data/100ms/orientation/roll_pitch_yaw/magnetic.txt similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/100ms/orientation/roll_pitch_yaw/magnetic.txt rename to src/sensor/sensor_fusion/design/data/100ms/orientation/roll_pitch_yaw/magnetic.txt diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/In_hand/accel b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/In_hand/accel similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/In_hand/accel rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/In_hand/accel diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/In_hand/gyro b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/In_hand/gyro similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/In_hand/gyro rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/In_hand/gyro diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/In_hand/magnetic b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/In_hand/magnetic similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/In_hand/magnetic rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/In_hand/magnetic diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Pant_pocket/accel b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Pant_pocket/accel similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Pant_pocket/accel rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Pant_pocket/accel diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Pant_pocket/gyro b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Pant_pocket/gyro similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Pant_pocket/gyro rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Pant_pocket/gyro diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Pant_pocket/magnetic b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Pant_pocket/magnetic similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Pant_pocket/magnetic rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Pant_pocket/magnetic diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Shirt_pocket/accel b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Shirt_pocket/accel similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Shirt_pocket/accel rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Shirt_pocket/accel diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Shirt_pocket/gyro b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Shirt_pocket/gyro similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Shirt_pocket/gyro rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Shirt_pocket/gyro diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Shirt_pocket/magnetic b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Shirt_pocket/magnetic similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Shirt_pocket/magnetic rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/Shirt_pocket/magnetic diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/While_talking/accel b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/While_talking/accel similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/While_talking/accel rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/While_talking/accel diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/While_talking/gyro b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/While_talking/gyro similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/While_talking/gyro rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/While_talking/gyro diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/While_talking/magnetic b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/While_talking/magnetic similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/While_talking/magnetic rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_down/While_talking/magnetic diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/In_hand/accel b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/In_hand/accel similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/In_hand/accel rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/In_hand/accel diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/In_hand/gyro b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/In_hand/gyro similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/In_hand/gyro rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/In_hand/gyro diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/In_hand/magnetic b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/In_hand/magnetic similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/In_hand/magnetic rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/In_hand/magnetic diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Pant_pocket/accel b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Pant_pocket/accel similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Pant_pocket/accel rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Pant_pocket/accel diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Pant_pocket/gyro b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Pant_pocket/gyro similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Pant_pocket/gyro rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Pant_pocket/gyro diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Pant_pocket/magnetic b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Pant_pocket/magnetic similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Pant_pocket/magnetic rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Pant_pocket/magnetic diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Shirt_pocket/accel b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Shirt_pocket/accel similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Shirt_pocket/accel rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Shirt_pocket/accel diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Shirt_pocket/gyro b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Shirt_pocket/gyro similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Shirt_pocket/gyro rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Shirt_pocket/gyro diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Shirt_pocket/magnetic b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Shirt_pocket/magnetic similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Shirt_pocket/magnetic rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/Shirt_pocket/magnetic diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/While_talking/accel b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/While_talking/accel similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/While_talking/accel rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/While_talking/accel diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/While_talking/gyro b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/While_talking/gyro similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/While_talking/gyro rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/While_talking/gyro diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/While_talking/magnetic b/src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/While_talking/magnetic similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/While_talking/magnetic rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Climb_stairs_up/While_talking/magnetic diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/In_hand/accel b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/In_hand/accel similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/In_hand/accel rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/In_hand/accel diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/In_hand/gyro b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/In_hand/gyro similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/In_hand/gyro rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/In_hand/gyro diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/In_hand/magnetic b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/In_hand/magnetic similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/In_hand/magnetic rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/In_hand/magnetic diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/Pant_pocket/accel b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/Pant_pocket/accel similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/Pant_pocket/accel rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/Pant_pocket/accel diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/Pant_pocket/gyro b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/Pant_pocket/gyro similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/Pant_pocket/gyro rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/Pant_pocket/gyro diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/Pant_pocket/magnetic b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/Pant_pocket/magnetic similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/Pant_pocket/magnetic rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/Pant_pocket/magnetic diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/Shirt_pocket/accel b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/Shirt_pocket/accel similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/Shirt_pocket/accel rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/Shirt_pocket/accel diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/Shirt_pocket/gyro b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/Shirt_pocket/gyro similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/Shirt_pocket/gyro rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/Shirt_pocket/gyro diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/Shirt_pocket/magnetic b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/Shirt_pocket/magnetic similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/Shirt_pocket/magnetic rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/Shirt_pocket/magnetic diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/While_talking/accel b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/While_talking/accel similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/While_talking/accel rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/While_talking/accel diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/While_talking/gyro b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/While_talking/gyro similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/While_talking/gyro rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/While_talking/gyro diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/While_talking/magnetic b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/While_talking/magnetic similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_fast/While_talking/magnetic rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_fast/While_talking/magnetic diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/In_hand/accel b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/In_hand/accel similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/In_hand/accel rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/In_hand/accel diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/In_hand/gyro b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/In_hand/gyro similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/In_hand/gyro rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/In_hand/gyro diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/In_hand/magnetic b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/In_hand/magnetic similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/In_hand/magnetic rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/In_hand/magnetic diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/Pant_pocket/accel b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/Pant_pocket/accel similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/Pant_pocket/accel rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/Pant_pocket/accel diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/Pant_pocket/gyro b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/Pant_pocket/gyro similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/Pant_pocket/gyro rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/Pant_pocket/gyro diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/Pant_pocket/magnetic b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/Pant_pocket/magnetic similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/Pant_pocket/magnetic rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/Pant_pocket/magnetic diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/Shirt_pocket/accel b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/Shirt_pocket/accel similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/Shirt_pocket/accel rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/Shirt_pocket/accel diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/Shirt_pocket/gyro b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/Shirt_pocket/gyro similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/Shirt_pocket/gyro rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/Shirt_pocket/gyro diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/Shirt_pocket/magnetic b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/Shirt_pocket/magnetic similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/Shirt_pocket/magnetic rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/Shirt_pocket/magnetic diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/While_talking/accel b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/While_talking/accel similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/While_talking/accel rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/While_talking/accel diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/While_talking/gyro b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/While_talking/gyro similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/While_talking/gyro rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/While_talking/gyro diff --git a/src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/While_talking/magnetic b/src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/While_talking/magnetic similarity index 100% rename from src/server/plugins/sensor_fusion/design/data/25ms/pedo/Walk_slow/While_talking/magnetic rename to src/sensor/sensor_fusion/design/data/25ms/pedo/Walk_slow/While_talking/magnetic diff --git a/src/server/plugins/sensor_fusion/design/documentation/diagram/block_diagram_gravity_and_linear_acceleration.png b/src/sensor/sensor_fusion/design/documentation/diagram/block_diagram_gravity_and_linear_acceleration.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/diagram/block_diagram_gravity_and_linear_acceleration.png rename to src/sensor/sensor_fusion/design/documentation/diagram/block_diagram_gravity_and_linear_acceleration.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/diagram/block_diagram_orientation_estimation.png b/src/sensor/sensor_fusion/design/documentation/diagram/block_diagram_orientation_estimation.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/diagram/block_diagram_orientation_estimation.png rename to src/sensor/sensor_fusion/design/documentation/diagram/block_diagram_orientation_estimation.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/diagram/device_orientation.png b/src/sensor/sensor_fusion/design/documentation/diagram/device_orientation.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/diagram/device_orientation.png rename to src/sensor/sensor_fusion/design/documentation/diagram/device_orientation.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/diagram/kalman_filter_stages.png b/src/sensor/sensor_fusion/design/documentation/diagram/kalman_filter_stages.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/diagram/kalman_filter_stages.png rename to src/sensor/sensor_fusion/design/documentation/diagram/kalman_filter_stages.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/diagram/orientation_effect_on_gravity.png b/src/sensor/sensor_fusion/design/documentation/diagram/orientation_effect_on_gravity.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/diagram/orientation_effect_on_gravity.png rename to src/sensor/sensor_fusion/design/documentation/diagram/orientation_effect_on_gravity.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/diagram/projection_diagram_gravity_computation.png b/src/sensor/sensor_fusion/design/documentation/diagram/projection_diagram_gravity_computation.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/diagram/projection_diagram_gravity_computation.png rename to src/sensor/sensor_fusion/design/documentation/diagram/projection_diagram_gravity_computation.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_1.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_1.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_1.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_1.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_10.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_10.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_10.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_10.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_11.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_11.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_11.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_11.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_12.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_12.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_12.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_12.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_13.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_13.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_13.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_13.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_13_updated.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_13_updated.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_13_updated.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_13_updated.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_14.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_14.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_14.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_14.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_15.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_15.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_15.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_15.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_16.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_16.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_16.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_16.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_17.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_17.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_17.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_17.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_18.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_18.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_18.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_18.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_19.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_19.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_19.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_19.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_2.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_2.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_2.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_2.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_20.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_20.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_20.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_20.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_21.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_21.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_21.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_21.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_22.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_22.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_22.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_22.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_23.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_23.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_23.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_23.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_24.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_24.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_24.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_24.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_25.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_25.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_25.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_25.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_26.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_26.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_26.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_26.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_27.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_27.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_27.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_27.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_28.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_28.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_28.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_28.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_29.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_29.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_29.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_29.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_3.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_3.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_3.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_3.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_30.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_30.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_30.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_30.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_31.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_31.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_31.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_31.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_32.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_32.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_32.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_32.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_33.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_33.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_33.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_33.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_34.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_34.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_34.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_34.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_35.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_35.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_35.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_35.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_36.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_36.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_36.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_36.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_37.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_37.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_37.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_37.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_38.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_38.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_38.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_38.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_39.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_39.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_39.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_39.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_4.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_4.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_4.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_4.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_40.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_40.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_40.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_40.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_5.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_5.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_5.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_5.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_6.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_6.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_6.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_6.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_7.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_7.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_7.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_7.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_8.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_8.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_8.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_8.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/equation/equation_9.png b/src/sensor/sensor_fusion/design/documentation/equation/equation_9.png similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/equation/equation_9.png rename to src/sensor/sensor_fusion/design/documentation/equation/equation_9.png diff --git a/src/server/plugins/sensor_fusion/design/documentation/sensor_fusion.htm b/src/sensor/sensor_fusion/design/documentation/sensor_fusion.htm similarity index 100% rename from src/server/plugins/sensor_fusion/design/documentation/sensor_fusion.htm rename to src/sensor/sensor_fusion/design/documentation/sensor_fusion.htm diff --git a/src/server/plugins/sensor_fusion/design/lib/axis_rot2quat.m b/src/sensor/sensor_fusion/design/lib/axis_rot2quat.m similarity index 100% rename from src/server/plugins/sensor_fusion/design/lib/axis_rot2quat.m rename to src/sensor/sensor_fusion/design/lib/axis_rot2quat.m diff --git a/src/server/plugins/sensor_fusion/design/lib/estimate_gaming_rv.m b/src/sensor/sensor_fusion/design/lib/estimate_gaming_rv.m similarity index 100% rename from src/server/plugins/sensor_fusion/design/lib/estimate_gaming_rv.m rename to src/sensor/sensor_fusion/design/lib/estimate_gaming_rv.m diff --git a/src/server/plugins/sensor_fusion/design/lib/estimate_geomagnetic_rv.m b/src/sensor/sensor_fusion/design/lib/estimate_geomagnetic_rv.m similarity index 100% rename from src/server/plugins/sensor_fusion/design/lib/estimate_geomagnetic_rv.m rename to src/sensor/sensor_fusion/design/lib/estimate_geomagnetic_rv.m diff --git a/src/server/plugins/sensor_fusion/design/lib/estimate_gravity.m b/src/sensor/sensor_fusion/design/lib/estimate_gravity.m similarity index 100% rename from src/server/plugins/sensor_fusion/design/lib/estimate_gravity.m rename to src/sensor/sensor_fusion/design/lib/estimate_gravity.m diff --git a/src/server/plugins/sensor_fusion/design/lib/estimate_linear_acceleration.m b/src/sensor/sensor_fusion/design/lib/estimate_linear_acceleration.m similarity index 100% rename from src/server/plugins/sensor_fusion/design/lib/estimate_linear_acceleration.m rename to src/sensor/sensor_fusion/design/lib/estimate_linear_acceleration.m diff --git a/src/server/plugins/sensor_fusion/design/lib/estimate_orientation.m b/src/sensor/sensor_fusion/design/lib/estimate_orientation.m similarity index 100% rename from src/server/plugins/sensor_fusion/design/lib/estimate_orientation.m rename to src/sensor/sensor_fusion/design/lib/estimate_orientation.m diff --git a/src/server/plugins/sensor_fusion/design/lib/euler2quat.m b/src/sensor/sensor_fusion/design/lib/euler2quat.m similarity index 100% rename from src/server/plugins/sensor_fusion/design/lib/euler2quat.m rename to src/sensor/sensor_fusion/design/lib/euler2quat.m diff --git a/src/server/plugins/sensor_fusion/design/lib/quat2euler.m b/src/sensor/sensor_fusion/design/lib/quat2euler.m similarity index 100% rename from src/server/plugins/sensor_fusion/design/lib/quat2euler.m rename to src/sensor/sensor_fusion/design/lib/quat2euler.m diff --git a/src/server/plugins/sensor_fusion/design/lib/quat2rot_mat.m b/src/sensor/sensor_fusion/design/lib/quat2rot_mat.m similarity index 100% rename from src/server/plugins/sensor_fusion/design/lib/quat2rot_mat.m rename to src/sensor/sensor_fusion/design/lib/quat2rot_mat.m diff --git a/src/server/plugins/sensor_fusion/design/lib/quat_prod.m b/src/sensor/sensor_fusion/design/lib/quat_prod.m similarity index 100% rename from src/server/plugins/sensor_fusion/design/lib/quat_prod.m rename to src/sensor/sensor_fusion/design/lib/quat_prod.m diff --git a/src/server/plugins/sensor_fusion/design/lib/rot_mat2quat.m b/src/sensor/sensor_fusion/design/lib/rot_mat2quat.m similarity index 100% rename from src/server/plugins/sensor_fusion/design/lib/rot_mat2quat.m rename to src/sensor/sensor_fusion/design/lib/rot_mat2quat.m diff --git a/src/server/plugins/sensor_fusion/design/lib/sf_pedometer.m b/src/sensor/sensor_fusion/design/lib/sf_pedometer.m similarity index 100% rename from src/server/plugins/sensor_fusion/design/lib/sf_pedometer.m rename to src/sensor/sensor_fusion/design/lib/sf_pedometer.m diff --git a/src/server/plugins/sensor_fusion/design/readme b/src/sensor/sensor_fusion/design/readme similarity index 100% rename from src/server/plugins/sensor_fusion/design/readme rename to src/sensor/sensor_fusion/design/readme diff --git a/src/server/plugins/sensor_fusion/design/sf_gaming_rv.m b/src/sensor/sensor_fusion/design/sf_gaming_rv.m similarity index 100% rename from src/server/plugins/sensor_fusion/design/sf_gaming_rv.m rename to src/sensor/sensor_fusion/design/sf_gaming_rv.m diff --git a/src/server/plugins/sensor_fusion/design/sf_geomagnetic_rv.m b/src/sensor/sensor_fusion/design/sf_geomagnetic_rv.m similarity index 100% rename from src/server/plugins/sensor_fusion/design/sf_geomagnetic_rv.m rename to src/sensor/sensor_fusion/design/sf_geomagnetic_rv.m diff --git a/src/server/plugins/sensor_fusion/design/sf_gravity.m b/src/sensor/sensor_fusion/design/sf_gravity.m similarity index 100% rename from src/server/plugins/sensor_fusion/design/sf_gravity.m rename to src/sensor/sensor_fusion/design/sf_gravity.m diff --git a/src/server/plugins/sensor_fusion/design/sf_linear_acceleration.m b/src/sensor/sensor_fusion/design/sf_linear_acceleration.m similarity index 100% rename from src/server/plugins/sensor_fusion/design/sf_linear_acceleration.m rename to src/sensor/sensor_fusion/design/sf_linear_acceleration.m diff --git a/src/server/plugins/sensor_fusion/design/sf_orientation.m b/src/sensor/sensor_fusion/design/sf_orientation.m similarity index 100% rename from src/server/plugins/sensor_fusion/design/sf_orientation.m rename to src/sensor/sensor_fusion/design/sf_orientation.m diff --git a/src/server/plugins/sensor_fusion/euler_angles.cpp b/src/sensor/sensor_fusion/euler_angles.cpp similarity index 100% rename from src/server/plugins/sensor_fusion/euler_angles.cpp rename to src/sensor/sensor_fusion/euler_angles.cpp diff --git a/src/server/plugins/sensor_fusion/euler_angles.h b/src/sensor/sensor_fusion/euler_angles.h similarity index 100% rename from src/server/plugins/sensor_fusion/euler_angles.h rename to src/sensor/sensor_fusion/euler_angles.h diff --git a/src/server/plugins/sensor_fusion/matrix.cpp b/src/sensor/sensor_fusion/matrix.cpp similarity index 100% rename from src/server/plugins/sensor_fusion/matrix.cpp rename to src/sensor/sensor_fusion/matrix.cpp diff --git a/src/server/plugins/sensor_fusion/matrix.h b/src/sensor/sensor_fusion/matrix.h similarity index 100% rename from src/server/plugins/sensor_fusion/matrix.h rename to src/sensor/sensor_fusion/matrix.h diff --git a/src/server/plugins/sensor_fusion/orientation_filter.cpp b/src/sensor/sensor_fusion/orientation_filter.cpp similarity index 100% rename from src/server/plugins/sensor_fusion/orientation_filter.cpp rename to src/sensor/sensor_fusion/orientation_filter.cpp diff --git a/src/server/plugins/sensor_fusion/orientation_filter.h b/src/sensor/sensor_fusion/orientation_filter.h similarity index 100% rename from src/server/plugins/sensor_fusion/orientation_filter.h rename to src/sensor/sensor_fusion/orientation_filter.h diff --git a/src/server/plugins/sensor_fusion/quaternion.cpp b/src/sensor/sensor_fusion/quaternion.cpp similarity index 100% rename from src/server/plugins/sensor_fusion/quaternion.cpp rename to src/sensor/sensor_fusion/quaternion.cpp diff --git a/src/server/plugins/sensor_fusion/quaternion.h b/src/sensor/sensor_fusion/quaternion.h similarity index 100% rename from src/server/plugins/sensor_fusion/quaternion.h rename to src/sensor/sensor_fusion/quaternion.h diff --git a/src/server/plugins/sensor_fusion/rotation_matrix.cpp b/src/sensor/sensor_fusion/rotation_matrix.cpp similarity index 100% rename from src/server/plugins/sensor_fusion/rotation_matrix.cpp rename to src/sensor/sensor_fusion/rotation_matrix.cpp diff --git a/src/server/plugins/sensor_fusion/rotation_matrix.h b/src/sensor/sensor_fusion/rotation_matrix.h similarity index 100% rename from src/server/plugins/sensor_fusion/rotation_matrix.h rename to src/sensor/sensor_fusion/rotation_matrix.h diff --git a/src/server/plugins/sensor_fusion/sensor_data.cpp b/src/sensor/sensor_fusion/sensor_data.cpp similarity index 100% rename from src/server/plugins/sensor_fusion/sensor_data.cpp rename to src/sensor/sensor_fusion/sensor_data.cpp diff --git a/src/server/plugins/sensor_fusion/sensor_data.h b/src/sensor/sensor_fusion/sensor_data.h similarity index 100% rename from src/server/plugins/sensor_fusion/sensor_data.h rename to src/sensor/sensor_fusion/sensor_data.h diff --git a/src/server/plugins/sensor_fusion/test/gravity_sensor.cpp b/src/sensor/sensor_fusion/test/gravity_sensor.cpp similarity index 100% rename from src/server/plugins/sensor_fusion/test/gravity_sensor.cpp rename to src/sensor/sensor_fusion/test/gravity_sensor.cpp diff --git a/src/server/plugins/sensor_fusion/test/gravity_sensor.h b/src/sensor/sensor_fusion/test/gravity_sensor.h similarity index 100% rename from src/server/plugins/sensor_fusion/test/gravity_sensor.h rename to src/sensor/sensor_fusion/test/gravity_sensor.h diff --git a/src/server/plugins/sensor_fusion/test/linear_acceleration_sensor.cpp b/src/sensor/sensor_fusion/test/linear_acceleration_sensor.cpp similarity index 100% rename from src/server/plugins/sensor_fusion/test/linear_acceleration_sensor.cpp rename to src/sensor/sensor_fusion/test/linear_acceleration_sensor.cpp diff --git a/src/server/plugins/sensor_fusion/test/linear_acceleration_sensor.h b/src/sensor/sensor_fusion/test/linear_acceleration_sensor.h similarity index 100% rename from src/server/plugins/sensor_fusion/test/linear_acceleration_sensor.h rename to src/sensor/sensor_fusion/test/linear_acceleration_sensor.h diff --git a/src/server/plugins/sensor_fusion/test/orientation_sensor.cpp b/src/sensor/sensor_fusion/test/orientation_sensor.cpp similarity index 100% rename from src/server/plugins/sensor_fusion/test/orientation_sensor.cpp rename to src/sensor/sensor_fusion/test/orientation_sensor.cpp diff --git a/src/server/plugins/sensor_fusion/test/orientation_sensor.h b/src/sensor/sensor_fusion/test/orientation_sensor.h similarity index 100% rename from src/server/plugins/sensor_fusion/test/orientation_sensor.h rename to src/sensor/sensor_fusion/test/orientation_sensor.h diff --git a/src/server/plugins/sensor_fusion/test/test_projects/euler_angles_test/euler_angles_main.cpp b/src/sensor/sensor_fusion/test/test_projects/euler_angles_test/euler_angles_main.cpp similarity index 100% rename from src/server/plugins/sensor_fusion/test/test_projects/euler_angles_test/euler_angles_main.cpp rename to src/sensor/sensor_fusion/test/test_projects/euler_angles_test/euler_angles_main.cpp diff --git a/src/server/plugins/sensor_fusion/test/test_projects/gravity_sensor_test/gravity_sensor_main.cpp b/src/sensor/sensor_fusion/test/test_projects/gravity_sensor_test/gravity_sensor_main.cpp similarity index 100% rename from src/server/plugins/sensor_fusion/test/test_projects/gravity_sensor_test/gravity_sensor_main.cpp rename to src/sensor/sensor_fusion/test/test_projects/gravity_sensor_test/gravity_sensor_main.cpp diff --git a/src/server/plugins/sensor_fusion/test/test_projects/linear_acceleration_sensor_test/linear_acceleration_sensor_main.cpp b/src/sensor/sensor_fusion/test/test_projects/linear_acceleration_sensor_test/linear_acceleration_sensor_main.cpp similarity index 100% rename from src/server/plugins/sensor_fusion/test/test_projects/linear_acceleration_sensor_test/linear_acceleration_sensor_main.cpp rename to src/sensor/sensor_fusion/test/test_projects/linear_acceleration_sensor_test/linear_acceleration_sensor_main.cpp diff --git a/src/server/plugins/sensor_fusion/test/test_projects/matrix_test/matrix_main.cpp b/src/sensor/sensor_fusion/test/test_projects/matrix_test/matrix_main.cpp similarity index 100% rename from src/server/plugins/sensor_fusion/test/test_projects/matrix_test/matrix_main.cpp rename to src/sensor/sensor_fusion/test/test_projects/matrix_test/matrix_main.cpp diff --git a/src/server/plugins/sensor_fusion/test/test_projects/orientation_sensor_test/orientation_sensor_main.cpp b/src/sensor/sensor_fusion/test/test_projects/orientation_sensor_test/orientation_sensor_main.cpp similarity index 100% rename from src/server/plugins/sensor_fusion/test/test_projects/orientation_sensor_test/orientation_sensor_main.cpp rename to src/sensor/sensor_fusion/test/test_projects/orientation_sensor_test/orientation_sensor_main.cpp diff --git a/src/server/plugins/sensor_fusion/test/test_projects/quaternion_test/quaternion_main.cpp b/src/sensor/sensor_fusion/test/test_projects/quaternion_test/quaternion_main.cpp similarity index 100% rename from src/server/plugins/sensor_fusion/test/test_projects/quaternion_test/quaternion_main.cpp rename to src/sensor/sensor_fusion/test/test_projects/quaternion_test/quaternion_main.cpp diff --git a/src/server/plugins/sensor_fusion/test/test_projects/rotation_matrix_test/rotation_matrix_main.cpp b/src/sensor/sensor_fusion/test/test_projects/rotation_matrix_test/rotation_matrix_main.cpp similarity index 100% rename from src/server/plugins/sensor_fusion/test/test_projects/rotation_matrix_test/rotation_matrix_main.cpp rename to src/sensor/sensor_fusion/test/test_projects/rotation_matrix_test/rotation_matrix_main.cpp diff --git a/src/server/plugins/sensor_fusion/test/test_projects/sensor_data_test/sensor_data_main.cpp b/src/sensor/sensor_fusion/test/test_projects/sensor_data_test/sensor_data_main.cpp similarity index 100% rename from src/server/plugins/sensor_fusion/test/test_projects/sensor_data_test/sensor_data_main.cpp rename to src/sensor/sensor_fusion/test/test_projects/sensor_data_test/sensor_data_main.cpp diff --git a/src/server/plugins/sensor_fusion/test/test_projects/vector_test/vector_main.cpp b/src/sensor/sensor_fusion/test/test_projects/vector_test/vector_main.cpp similarity index 100% rename from src/server/plugins/sensor_fusion/test/test_projects/vector_test/vector_main.cpp rename to src/sensor/sensor_fusion/test/test_projects/vector_test/vector_main.cpp diff --git a/src/server/plugins/sensor_fusion/vector.cpp b/src/sensor/sensor_fusion/vector.cpp similarity index 100% rename from src/server/plugins/sensor_fusion/vector.cpp rename to src/sensor/sensor_fusion/vector.cpp diff --git a/src/server/plugins/sensor_fusion/vector.h b/src/sensor/sensor_fusion/vector.h similarity index 100% rename from src/server/plugins/sensor_fusion/vector.h rename to src/sensor/sensor_fusion/vector.h diff --git a/src/server/plugins/tilt/tilt_sensor.cpp b/src/sensor/tilt/tilt_sensor.cpp similarity index 100% rename from src/server/plugins/tilt/tilt_sensor.cpp rename to src/sensor/tilt/tilt_sensor.cpp diff --git a/src/server/plugins/tilt/tilt_sensor.h b/src/sensor/tilt/tilt_sensor.h similarity index 100% rename from src/server/plugins/tilt/tilt_sensor.h rename to src/sensor/tilt/tilt_sensor.h diff --git a/src/server/plugins/virtual_sensors.xml b/src/sensor/virtual_sensors.xml similarity index 100% rename from src/server/plugins/virtual_sensors.xml rename to src/sensor/virtual_sensors.xml diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index 7c33264..50ac418 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -6,20 +6,25 @@ SET(DEPENDENTS "glib-2.0 gio-2.0 dlog libsystemd-daemon libxml-2.0 cynara-client INCLUDE(FindPkgConfig) PKG_CHECK_MODULES(SERVER_PKGS REQUIRED ${DEPENDENTS}) -ADD_SUBDIRECTORY(plugins) -ADD_DEFINITIONS(${PLUGIN_DEFS}) +ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../sensor ${CMAKE_CURRENT_BINARY_DIR}/sensor) +ADD_DEFINITIONS(${SENSOR_DEFINITIONS}) FOREACH(flag ${SERVER_PKGS_CFLAGS}) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") ENDFOREACH(flag) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ldl -fPIE") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) -INCLUDE_DIRECTORIES(${DIR_INCLUDE}) +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/src/shared + ${CMAKE_SOURCE_DIR}/src/hal + ${CMAKE_CURRENT_SOURCE_DIR} + ${SENSOR_HEADERS} +) FILE(GLOB SERVER_SRCS *.cpp) -ADD_EXECUTABLE(${PROJECT_NAME} ${SERVER_SRCS} ${PLUGIN_SRCS}) +ADD_EXECUTABLE(${PROJECT_NAME} ${SENSOR_SRCS} ${SERVER_SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SERVER_PKGS_LDFLAGS} "sensord-shared") diff --git a/src/server/plugins/CMakeLists.txt b/src/server/plugins/CMakeLists.txt deleted file mode 100644 index 432e427..0000000 --- a/src/server/plugins/CMakeLists.txt +++ /dev/null @@ -1,126 +0,0 @@ -cmake_minimum_required(VERSION 2.6) -project(sensord-plugins CXX) - -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(plugin_pkgs REQUIRED dlog libxml-2.0) - -FOREACH(flag ${plugin_pkgs_LDFLAGS}) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") -ENDFOREACH(flag) - -FOREACH(flag ${plugin_pkgs_CFLAGS}) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") -ENDFOREACH(flag) - -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") - -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - -SET(DIR_INCLUDE "${DIR_INCLUDE} ${CMAKE_CURRENT_SOURCE_DIR}/accel") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/accel/accel_sensor.cpp") - -IF("${AUTO_ROTATION}" STREQUAL "ON") -list (APPEND DIR_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/auto_rotation") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/auto_rotation/auto_rotation_alg.cpp") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/auto_rotation/auto_rotation_alg_emul.cpp") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/auto_rotation/auto_rotation_sensor.cpp") -list (APPEND PLUGIN_DEFS "-DENABLE_AUTO_ROTATION") -ENDIF() - -IF("${ORIENTATION}" STREQUAL "ON") -set(SENSOR_FUSION_ENABLE "1") -set(ORIENTATION_ENABLE "1") -ENDIF() -IF("${RV}" STREQUAL "ON") -set(SENSOR_FUSION_ENABLE "1") -set(RV_ENABLE "1") -ENDIF() -IF("${GEOMAGNETIC_RV}" STREQUAL "ON") -set(SENSOR_FUSION_ENABLE "1") -set(GEOMAGNETIC_RV_ENABLE "1") -ENDIF() -IF("${GAMING_RV}" STREQUAL "ON") -set(SENSOR_FUSION_ENABLE "1") -set(GAMING_RV_ENABLE "1") -ENDIF() -IF("${TILT}" STREQUAL "ON") -set(SENSOR_FUSION_ENABLE "1") -set(TILT_ENABLE "1") -ENDIF() -IF("${GYROSCOPE_UNCAL}" STREQUAL "ON") -set(SENSOR_FUSION_ENABLE "1") -set(GYROSCOPE_UNCAL_ENABLE "1") -ENDIF() -IF("${GRAVITY}" STREQUAL "ON") -set(SENSOR_FUSION_ENABLE "1") -set(ORIENTATION_ENABLE "1") -set(GRAVITY_ENABLE "1") -ENDIF() -IF("${LINEAR_ACCEL}" STREQUAL "ON") -set(SENSOR_FUSION_ENABLE "1") -set(ORIENTATION_ENABLE "1") -set(GRAVITY_ENABLE "1") -set(LINEAR_ACCEL_ENABLE "1") -ENDIF() - -IF("${SENSOR_FUSION_ENABLE}" STREQUAL "1") -list (APPEND DIR_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/sensor_fusion") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/sensor_fusion/euler_angles.cpp") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/sensor_fusion/matrix.cpp") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/sensor_fusion/orientation_filter.cpp") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/sensor_fusion/quaternion.cpp") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/sensor_fusion/rotation_matrix.cpp") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/sensor_fusion/sensor_data.cpp") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/sensor_fusion/vector.cpp") -list (APPEND DIR_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/fusion") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/fusion/fusion_sensor.cpp") -list (APPEND PLUGIN_DEFS "-DENABLE_SENSOR_FUSION") -ENDIF() - -IF("${ORIENTATION_ENABLE}" STREQUAL "1") -list (APPEND DIR_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/orientation") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/orientation/orientation_sensor.cpp") -list (APPEND PLUGIN_DEFS "-DENABLE_ORIENTATION") -ENDIF() -IF("${GRAVITY_ENABLE}" STREQUAL "1") -list (APPEND DIR_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/gravity") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/gravity/gravity_sensor.cpp") -list (APPEND PLUGIN_DEFS "-DENABLE_GRAVITY") -ENDIF() -IF("${LINEAR_ACCEL_ENABLE}" STREQUAL "1") -list (APPEND DIR_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/linear_accel") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/linear_accel/linear_accel_sensor.cpp") -list (APPEND PLUGIN_DEFS "-DENABLE_LINEAR_ACCEL") -ENDIF() -IF("${TILT_ENABLE}" STREQUAL "1") -list (APPEND DIR_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/tilt") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/tilt/tilt_sensor.cpp") -list (APPEND PLUGIN_DEFS "-DENABLE_TILT") -ENDIF() -IF("${GYROSCOPE_UNCAL_ENABLE}" STREQUAL "1") -list (APPEND DIR_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/gyroscope_uncal") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/gyroscope_uncal/gyroscope_uncal_sensor.cpp") -list (APPEND PLUGIN_DEFS "-DENABLE_GYROSCOPE_UNCAL") -ENDIF() -IF("${RV_ENABLE}" STREQUAL "1") -list (APPEND DIR_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/rotation_vector/rv") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/rotation_vector/rv/rv_sensor.cpp") -list (APPEND PLUGIN_DEFS "-DENABLE_RV") -ENDIF() -IF("${GEOMAGNETIC_RV_ENABLE}" STREQUAL "1") -list (APPEND DIR_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/rotation_vector/geomagnetic_rv") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.cpp") -list (APPEND PLUGIN_DEFS "-DENABLE_GEOMAGNETIC_RV") -ENDIF() -IF("${GAMING_RV_ENABLE}" STREQUAL "1") -list (APPEND DIR_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/rotation_vector/gaming_rv") -list (APPEND PLUGIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/rotation_vector/gaming_rv/gaming_rv_sensor.cpp") -list (APPEND PLUGIN_DEFS "-DENABLE_GAMING_RV") -ENDIF() - -set(PLUGIN_SRCS ${PLUGIN_SRCS} PARENT_SCOPE) -set(DIR_INCLUDE ${DIR_INCLUDE} PARENT_SCOPE) -set(PLUGIN_DEFS ${PLUGIN_DEFS} PARENT_SCOPE) - -# Installing files -INSTALL(FILES virtual_sensors.xml virtual_sensors.xml DESTINATION etc) diff --git a/src/server/plugins/sensor_fusion/test/test_projects/euler_angles_test/.cproject b/src/server/plugins/sensor_fusion/test/test_projects/euler_angles_test/.cproject deleted file mode 100644 index 7f29995..0000000 --- a/src/server/plugins/sensor_fusion/test/test_projects/euler_angles_test/.cproject +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/server/plugins/sensor_fusion/test/test_projects/euler_angles_test/.project b/src/server/plugins/sensor_fusion/test/test_projects/euler_angles_test/.project deleted file mode 100644 index eca2f5e..0000000 --- a/src/server/plugins/sensor_fusion/test/test_projects/euler_angles_test/.project +++ /dev/null @@ -1,89 +0,0 @@ - - - euler_angles_test - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.autoBuildTarget - all - - - org.eclipse.cdt.make.core.buildArguments - - - - org.eclipse.cdt.make.core.buildCommand - make - - - org.eclipse.cdt.make.core.buildLocation - ${workspace_loc:/euler_angles_test/Debug} - - - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - false - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.fullBuildTarget - all - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - true - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - org.tizen.nativecpp.apichecker.core.builder - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - org.tizen.nativecpp.apichecker.core.tizenCppNature - - diff --git a/src/server/plugins/sensor_fusion/test/test_projects/gravity_sensor_test/.cproject b/src/server/plugins/sensor_fusion/test/test_projects/gravity_sensor_test/.cproject deleted file mode 100644 index ee95ab0..0000000 --- a/src/server/plugins/sensor_fusion/test/test_projects/gravity_sensor_test/.cproject +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/server/plugins/sensor_fusion/test/test_projects/gravity_sensor_test/.project b/src/server/plugins/sensor_fusion/test/test_projects/gravity_sensor_test/.project deleted file mode 100644 index db26c33..0000000 --- a/src/server/plugins/sensor_fusion/test/test_projects/gravity_sensor_test/.project +++ /dev/null @@ -1,89 +0,0 @@ - - - gravity_sensor_test - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.autoBuildTarget - all - - - org.eclipse.cdt.make.core.buildArguments - - - - org.eclipse.cdt.make.core.buildCommand - make - - - org.eclipse.cdt.make.core.buildLocation - ${workspace_loc:/gravity_sensor_test/Debug} - - - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - false - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.fullBuildTarget - all - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - true - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - org.tizen.nativecpp.apichecker.core.builder - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - org.tizen.nativecpp.apichecker.core.tizenCppNature - - diff --git a/src/server/plugins/sensor_fusion/test/test_projects/linear_acceleration_sensor_test/.cproject b/src/server/plugins/sensor_fusion/test/test_projects/linear_acceleration_sensor_test/.cproject deleted file mode 100644 index 2cab1cd..0000000 --- a/src/server/plugins/sensor_fusion/test/test_projects/linear_acceleration_sensor_test/.cproject +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/server/plugins/sensor_fusion/test/test_projects/linear_acceleration_sensor_test/.project b/src/server/plugins/sensor_fusion/test/test_projects/linear_acceleration_sensor_test/.project deleted file mode 100644 index b5b1ce9..0000000 --- a/src/server/plugins/sensor_fusion/test/test_projects/linear_acceleration_sensor_test/.project +++ /dev/null @@ -1,89 +0,0 @@ - - - linear_acceleration_sensor_test - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.autoBuildTarget - all - - - org.eclipse.cdt.make.core.buildArguments - - - - org.eclipse.cdt.make.core.buildCommand - make - - - org.eclipse.cdt.make.core.buildLocation - ${workspace_loc:/linear_acceleration_sensor_test/Debug} - - - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - false - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.fullBuildTarget - all - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - true - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - org.tizen.nativecpp.apichecker.core.builder - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - org.tizen.nativecpp.apichecker.core.tizenCppNature - - diff --git a/src/server/plugins/sensor_fusion/test/test_projects/matrix_test/.cproject b/src/server/plugins/sensor_fusion/test/test_projects/matrix_test/.cproject deleted file mode 100644 index 1e6728f..0000000 --- a/src/server/plugins/sensor_fusion/test/test_projects/matrix_test/.cproject +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/server/plugins/sensor_fusion/test/test_projects/matrix_test/.project b/src/server/plugins/sensor_fusion/test/test_projects/matrix_test/.project deleted file mode 100644 index 3d8db3d..0000000 --- a/src/server/plugins/sensor_fusion/test/test_projects/matrix_test/.project +++ /dev/null @@ -1,89 +0,0 @@ - - - matrix_test - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.autoBuildTarget - all - - - org.eclipse.cdt.make.core.buildArguments - - - - org.eclipse.cdt.make.core.buildCommand - make - - - org.eclipse.cdt.make.core.buildLocation - ${workspace_loc:/matrix_test/Debug} - - - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - false - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.fullBuildTarget - all - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - true - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - org.tizen.nativecpp.apichecker.core.builder - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - org.tizen.nativecpp.apichecker.core.tizenCppNature - - diff --git a/src/server/plugins/sensor_fusion/test/test_projects/orientation_sensor_test/.cproject b/src/server/plugins/sensor_fusion/test/test_projects/orientation_sensor_test/.cproject deleted file mode 100644 index 65deaf8..0000000 --- a/src/server/plugins/sensor_fusion/test/test_projects/orientation_sensor_test/.cproject +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/server/plugins/sensor_fusion/test/test_projects/orientation_sensor_test/.project b/src/server/plugins/sensor_fusion/test/test_projects/orientation_sensor_test/.project deleted file mode 100644 index 7ceec3c..0000000 --- a/src/server/plugins/sensor_fusion/test/test_projects/orientation_sensor_test/.project +++ /dev/null @@ -1,89 +0,0 @@ - - - orientation_sensor_test - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.autoBuildTarget - all - - - org.eclipse.cdt.make.core.buildArguments - - - - org.eclipse.cdt.make.core.buildCommand - make - - - org.eclipse.cdt.make.core.buildLocation - ${workspace_loc:/orientation_sensor_test/Debug} - - - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - false - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.fullBuildTarget - all - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - true - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - org.tizen.nativecpp.apichecker.core.builder - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - org.tizen.nativecpp.apichecker.core.tizenCppNature - - diff --git a/src/server/plugins/sensor_fusion/test/test_projects/quaternion_test/.cproject b/src/server/plugins/sensor_fusion/test/test_projects/quaternion_test/.cproject deleted file mode 100644 index de46268..0000000 --- a/src/server/plugins/sensor_fusion/test/test_projects/quaternion_test/.cproject +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/server/plugins/sensor_fusion/test/test_projects/quaternion_test/.project b/src/server/plugins/sensor_fusion/test/test_projects/quaternion_test/.project deleted file mode 100644 index 74b100d..0000000 --- a/src/server/plugins/sensor_fusion/test/test_projects/quaternion_test/.project +++ /dev/null @@ -1,89 +0,0 @@ - - - quaternion_test - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.autoBuildTarget - all - - - org.eclipse.cdt.make.core.buildArguments - - - - org.eclipse.cdt.make.core.buildCommand - make - - - org.eclipse.cdt.make.core.buildLocation - ${workspace_loc:/quaternion_test/Debug} - - - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - false - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.fullBuildTarget - all - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - true - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - org.tizen.nativecpp.apichecker.core.builder - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - org.tizen.nativecpp.apichecker.core.tizenCppNature - - diff --git a/src/server/plugins/sensor_fusion/test/test_projects/rotation_matrix_test/.cproject b/src/server/plugins/sensor_fusion/test/test_projects/rotation_matrix_test/.cproject deleted file mode 100644 index dd975a2..0000000 --- a/src/server/plugins/sensor_fusion/test/test_projects/rotation_matrix_test/.cproject +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/server/plugins/sensor_fusion/test/test_projects/rotation_matrix_test/.project b/src/server/plugins/sensor_fusion/test/test_projects/rotation_matrix_test/.project deleted file mode 100644 index 6e760b0..0000000 --- a/src/server/plugins/sensor_fusion/test/test_projects/rotation_matrix_test/.project +++ /dev/null @@ -1,89 +0,0 @@ - - - rotation_matrix_test - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.autoBuildTarget - all - - - org.eclipse.cdt.make.core.buildArguments - - - - org.eclipse.cdt.make.core.buildCommand - make - - - org.eclipse.cdt.make.core.buildLocation - ${workspace_loc:/rotation_matrix_test/Debug} - - - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - false - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.fullBuildTarget - all - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - true - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - org.tizen.nativecpp.apichecker.core.builder - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - org.tizen.nativecpp.apichecker.core.tizenCppNature - - diff --git a/src/server/plugins/sensor_fusion/test/test_projects/sensor_data_test/.cproject b/src/server/plugins/sensor_fusion/test/test_projects/sensor_data_test/.cproject deleted file mode 100644 index 031195b..0000000 --- a/src/server/plugins/sensor_fusion/test/test_projects/sensor_data_test/.cproject +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/server/plugins/sensor_fusion/test/test_projects/sensor_data_test/.project b/src/server/plugins/sensor_fusion/test/test_projects/sensor_data_test/.project deleted file mode 100644 index 2e0296a..0000000 --- a/src/server/plugins/sensor_fusion/test/test_projects/sensor_data_test/.project +++ /dev/null @@ -1,89 +0,0 @@ - - - sensor_data_test - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.autoBuildTarget - all - - - org.eclipse.cdt.make.core.buildArguments - - - - org.eclipse.cdt.make.core.buildCommand - make - - - org.eclipse.cdt.make.core.buildLocation - ${workspace_loc:/sensor_data_test/Debug} - - - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - false - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.fullBuildTarget - all - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - true - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - org.tizen.nativecpp.apichecker.core.builder - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - org.tizen.nativecpp.apichecker.core.tizenCppNature - - diff --git a/src/server/plugins/sensor_fusion/test/test_projects/vector_test/.cproject b/src/server/plugins/sensor_fusion/test/test_projects/vector_test/.cproject deleted file mode 100644 index bc0fbe4..0000000 --- a/src/server/plugins/sensor_fusion/test/test_projects/vector_test/.cproject +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/server/plugins/sensor_fusion/test/test_projects/vector_test/.project b/src/server/plugins/sensor_fusion/test/test_projects/vector_test/.project deleted file mode 100644 index 92bc08d..0000000 --- a/src/server/plugins/sensor_fusion/test/test_projects/vector_test/.project +++ /dev/null @@ -1,83 +0,0 @@ - - - vector_test - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.autoBuildTarget - all - - - org.eclipse.cdt.make.core.buildArguments - - - - org.eclipse.cdt.make.core.buildCommand - make - - - org.eclipse.cdt.make.core.buildLocation - ${workspace_loc:/vector_test/Debug} - - - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - false - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.fullBuildTarget - all - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - true - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - - diff --git a/src/server/plugins/sensor_module_create.cpp.in b/src/server/plugins/sensor_module_create.cpp.in deleted file mode 100644 index 576fdf6..0000000 --- a/src/server/plugins/sensor_module_create.cpp.in +++ /dev/null @@ -1,289 +0,0 @@ -#ifdef ENABLE_ACCEL -#include -#endif -#ifdef ENABLE_GYRO -#include -#endif -#ifdef ENABLE_PROXI -#include -#endif -#ifdef ENABLE_LIGHT -#include -#endif -#ifdef ENABLE_GEO -#include -#endif -#ifdef ENABLE_AUTO_ROTATION -#include -#endif -#ifdef ENABLE_PRESSURE -#include -#endif -#ifdef ENABLE_TEMPERATURE -#include -#endif -#ifdef ENABLE_ULTRAVIOLET -#include -#endif -#ifdef ENABLE_BIO_LED_RED -#include -#endif -#ifdef ENABLE_SENSOR_FUSION -#include -#endif -#ifdef ENABLE_ORIENTATION -#include -#endif -#ifdef ENABLE_GEOMAGNETIC_RV -#include -#endif -#ifdef ENABLE_GAMING_RV -#include -#endif -#ifdef ENABLE_TILT -#include -#endif -#ifdef ENABLE_UNCAL_GYRO -#include -#endif -#ifdef ENABLE_GRAVITY -#include -#endif -#ifdef ENABLE_LINEAR_ACCEL -#include -#endif -#ifdef ENABLE_RV -#include -#endif -#ifdef ENABLE_RV_RAW -#include -#endif - -extern "C" sensor_module* create(void) -{ - sensor_module *module = new(std::nothrow) sensor_module; - retvm_if(!module, NULL, "Failed to allocate memory"); - -#ifdef ENABLE_ACCEL - accel_sensor *accel_sensor_ptr = NULL; - try { - accel_sensor_ptr = new(std::nothrow) accel_sensor; - } catch (int err) { - ERR("Failed to create accel_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (accel_sensor_ptr != NULL) { - module->sensors.push_back(accel_sensor_ptr); - } -#endif - -#ifdef ENABLE_AUTO_ROTATION - auto_rotation_sensor *auto_rotation_sensor_ptr = NULL; - try { - auto_rotation_sensor_ptr = new(std::nothrow) auto_rotation_sensor; - } catch (int err) { - ERR("Failed to create auto_rotation_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (auto_rotation_sensor_ptr != NULL) - module->sensors.push_back(auto_rotation_sensor_ptr); -#endif - -#ifdef ENABLE_GYRO - gyro_sensor *gyro_sensor_ptr = NULL; - try { - gyro_sensor_ptr = new(std::nothrow) gyro_sensor; - } catch (int err) { - ERR("Failed to create gyro_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (gyro_sensor_ptr != NULL) - module->sensors.push_back(gyro_sensor_ptr); -#endif - -#ifdef ENABLE_PROXI - proxi_sensor *proxi_sensor_ptr = NULL; - try { - proxi_sensor_ptr = new(std::nothrow) proxi_sensor; - } catch (int err) { - ERR("Failed to create proxi_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (proxi_sensor_ptr != NULL) - module->sensors.push_back(proxi_sensor_ptr); -#endif - -#ifdef ENABLE_LIGHT - light_sensor *light_sensor_ptr = NULL; - try { - light_sensor_ptr = new(std::nothrow) light_sensor; - } catch (int err) { - ERR("Failed to create light_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (light_sensor_ptr != NULL) - module->sensors.push_back(light_sensor_ptr); -#endif - -#ifdef ENABLE_GEO - geo_sensor *geo_sensor_ptr = NULL; - try { - geo_sensor_ptr = new(std::nothrow) geo_sensor; - } catch (int err) { - ERR("Failed to create geo_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (geo_sensor_ptr != NULL) - module->sensors.push_back(geo_sensor_ptr); -#endif - -#ifdef ENABLE_PRESSURE - pressure_sensor *pressure_sensor_ptr = NULL; - try { - pressure_sensor_ptr = new(std::nothrow) pressure_sensor; - } catch (int err) { - ERR("Failed to create pressure_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (pressure_sensor_ptr != NULL) - module->sensors.push_back(pressure_sensor_ptr); -#endif - -#ifdef ENABLE_TEMPERATURE - temperature_sensor *temperature_sensor_ptr = NULL; - try { - temperature_sensor_ptr = new(std::nothrow) temperature_sensor; - } catch (int err) { - ERR("Failed to create temperature_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (temperature_sensor_ptr != NULL) - module->sensors.push_back(temperature_sensor_ptr); -#endif - -#ifdef ENABLE_ULTRAVIOLET - ultraviolet_sensor *ultraviolet_sensor_ptr = NULL; - try { - ultraviolet_sensor_ptr = new(std::nothrow) ultraviolet_sensor; - } catch (int err) { - ERR("Failed to create ultraviolet_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (ultraviolet_sensor_ptr != NULL) - module->sensors.push_back(ultraviolet_sensor_ptr); -#endif - -#ifdef ENABLE_SENSOR_FUSION - fusion_sensor *fusion_sensor_ptr = NULL; - try { - fusion_sensor_ptr = new(std::nothrow) fusion_sensor; - } catch (int err) { - ERR("Failed to create fusion_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (fusion_sensor_ptr != NULL) - module->sensors.push_back(fusion_sensor_ptr); -#endif - -#ifdef ENABLE_ORIENTATION - orientation_sensor *orientation_sensor_ptr = NULL; - try { - orientation_sensor_ptr = new(std::nothrow) orientation_sensor; - } catch (int err) { - ERR("Failed to create orientation_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (orientation_sensor_ptr != NULL) - module->sensors.push_back(orientation_sensor_ptr); -#endif - -#ifdef ENABLE_GRAVITY - gravity_sensor *gravity_sensor_ptr = NULL; - try { - gravity_sensor_ptr = new(std::nothrow) gravity_sensor; - } catch (int err) { - ERR("Failed to create gravity_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (gravity_sensor_ptr != NULL) - module->sensors.push_back(gravity_sensor_ptr); -#endif - -#ifdef ENABLE_LINEAR_ACCEL - linear_accel_sensor *linear_accel_sensor_ptr = NULL; - try { - linear_accel_sensor_ptr = new(std::nothrow) linear_accel_sensor; - } catch (int err) { - ERR("Failed to create linear_accel_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (linear_accel_sensor_ptr != NULL) - module->sensors.push_back(linear_accel_sensor_ptr); -#endif - -#ifdef ENABLE_GEOMAGNETIC_RV - geomagnetic_rv_sensor *geomagnetic_rv_sensor_ptr = NULL; - try { - geomagnetic_rv_sensor_ptr = new(std::nothrow) geomagnetic_rv_sensor; - } catch (int err) { - ERR("Failed to create geomagnetic_rv_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (geomagnetic_rv_sensor_ptr != NULL) - module->sensors.push_back(geomagnetic_rv_sensor_ptr); -#endif - -#ifdef ENABLE_GAMING_RV - gaming_rv_sensor *gaming_rv_sensor_ptr = NULL; - try { - gaming_rv_sensor_ptr = new(std::nothrow) gaming_rv_sensor; - } catch (int err) { - ERR("Failed to create gaming_rv_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (gaming_rv_sensor_ptr != NULL) - module->sensors.push_back(gaming_rv_sensor_ptr); -#endif - -#ifdef ENABLE_RV - rv_sensor *rv_sensor_ptr = NULL; - try { - rv_sensor_ptr = new(std::nothrow) rv_sensor; - } catch (int err) { - ERR("Failed to create rv_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (rv_sensor_ptr != NULL) - module->sensors.push_back(rv_sensor_ptr); -#endif - -#ifdef ENABLE_TILT - tilt_sensor *tilt_sensor_ptr = NULL; - try { - tilt_sensor_ptr = new(std::nothrow) tilt_sensor; - } catch (int err) { - ERR("Failed to create tilt_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (tilt_sensor_ptr != NULL) - module->sensors.push_back(tilt_sensor_ptr); -#endif - -#ifdef ENABLE_UNCAL_GYRO - uncal_gyro_sensor *uncal_gyro_sensor_ptr = NULL; - try { - uncal_gyro_sensor_ptr = new(std::nothrow) uncal_gyro_sensor; - } catch (int err) { - ERR("Failed to create uncal_gyro_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (uncal_gyro_sensor_ptr != NULL) - module->sensors.push_back(uncal_gyro_sensor_ptr); -#endif - -#ifdef ENABLE_BIO_LED_RED - bio_led_red_sensor *bio_led_red_sensor_ptr = NULL; - try { - bio_led_red_sensor_ptr = new(std::nothrow) bio_led_red_sensor; - } catch (int err) { - ERR("Failed to create bio_led_red_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (bio_led_red_sensor_ptr != NULL) - module->sensors.push_back(bio_led_red_sensor_ptr); -#endif - -#ifdef ENABLE_RV_RAW - rv_raw_sensor *rv_raw_sensor_ptr = NULL; - try { - rv_raw_sensor_ptr = new(std::nothrow) rv_raw_sensor; - } catch (int err) { - ERR("Failed to create rv_raw_sensor module, err: %d, cause: %s", err, strerror(err)); - } - if (rv_raw_sensor_ptr != NULL) - module->sensors.push_back(rv_raw_sensor_ptr); -#endif - - return module; -} diff --git a/src/shared/CMakeLists.txt b/src/shared/CMakeLists.txt index a1fb14d..8b8416e 100644 --- a/src/shared/CMakeLists.txt +++ b/src/shared/CMakeLists.txt @@ -11,8 +11,10 @@ FOREACH(flag ${SHARED_PKGS_CFLAGS}) ENDFOREACH(flag) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/client) +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/src/hal + ${CMAKE_CURRENT_SOURCE_DIR} +) FILE(GLOB_RECURSE SRCS *.cpp) ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) diff --git a/test/CMakeLists.txt b/src/test/CMakeLists.txt similarity index 100% rename from test/CMakeLists.txt rename to src/test/CMakeLists.txt diff --git a/test/src/api-test.c b/src/test/src/api-test.c similarity index 100% rename from test/src/api-test.c rename to src/test/src/api-test.c diff --git a/test/src/check-sensor.c b/src/test/src/check-sensor.c similarity index 100% rename from test/src/check-sensor.c rename to src/test/src/check-sensor.c diff --git a/test/src/check-sensor.h b/src/test/src/check-sensor.h similarity index 100% rename from test/src/check-sensor.h rename to src/test/src/check-sensor.h diff --git a/test/src/fusion-data-collection.c b/src/test/src/fusion-data-collection.c similarity index 100% rename from test/src/fusion-data-collection.c rename to src/test/src/fusion-data-collection.c diff --git a/test/src/multi-process-performance-test.c b/src/test/src/multi-process-performance-test.c similarity index 100% rename from test/src/multi-process-performance-test.c rename to src/test/src/multi-process-performance-test.c diff --git a/test/src/multi-thread-performance-test.c b/src/test/src/multi-thread-performance-test.c similarity index 100% rename from test/src/multi-thread-performance-test.c rename to src/test/src/multi-thread-performance-test.c diff --git a/test/src/sensor-test.c b/src/test/src/sensor-test.c similarity index 100% rename from test/src/sensor-test.c rename to src/test/src/sensor-test.c -- 2.7.4 From 0c16f3c7f6148217dd79db6bccc25d755a342285 Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Wed, 2 Mar 2016 22:49:00 +0900 Subject: [PATCH 14/16] sensord: clean up boiler plates Change-Id: I4740cd857c6b2b8c2f53bd0a14fa750c23c69de2 Signed-off-by: kibak.yoon --- src/client/client.cpp | 4 ++-- src/client/client_common.cpp | 4 ++-- src/client/client_common.h | 2 +- src/client/command_channel.cpp | 4 ++-- src/client/command_channel.h | 4 ++-- src/client/reg_event_info.h | 4 ++-- src/client/sensor_client_info.cpp | 4 ++-- src/client/sensor_client_info.h | 4 ++-- src/client/sensor_event_listener.cpp | 2 +- src/client/sensor_event_listener.h | 4 ++-- src/client/sensor_handle_info.cpp | 4 ++-- src/client/sensor_handle_info.h | 4 ++-- src/client/sensor_info_manager.cpp | 4 ++-- src/client/sensor_info_manager.h | 4 ++-- src/server/client_info_manager.cpp | 4 ++-- src/server/client_info_manager.h | 4 ++-- src/server/client_sensor_record.cpp | 4 ++-- src/server/client_sensor_record.h | 4 ++-- src/server/device_config.cpp | 2 +- src/server/device_config.h | 4 ++-- src/server/physical_sensor.cpp | 2 +- src/server/physical_sensor.h | 2 +- src/server/plugin_info_list.cpp | 4 ++-- src/server/plugin_info_list.h | 4 ++-- src/server/sensor_base.cpp | 2 +- src/server/sensor_base.h | 2 +- src/server/sensor_event_dispatcher.cpp | 4 ++-- src/server/sensor_event_dispatcher.h | 4 ++-- src/server/sensor_event_poller.cpp | 2 +- src/server/sensor_event_poller.h | 2 +- src/server/sensor_event_queue.cpp | 4 ++-- src/server/sensor_event_queue.h | 4 ++-- src/server/sensor_loader.cpp | 4 ++-- src/server/sensor_loader.h | 4 ++-- src/server/sensor_usage.cpp | 4 ++-- src/server/sensor_usage.h | 4 ++-- src/server/virtual_sensor.cpp | 2 +- src/server/virtual_sensor.h | 2 +- src/server/virtual_sensor_config.cpp | 2 +- src/server/virtual_sensor_config.h | 2 +- src/server/worker_thread.cpp | 2 +- src/server/worker_thread.h | 2 +- src/shared/cbase_lock.cpp | 4 ++-- src/shared/cbase_lock.h | 4 ++-- src/shared/cmutex.cpp | 6 +++--- src/shared/cmutex.h | 4 ++-- src/shared/command_common.h | 4 ++-- src/shared/cpacket.cpp | 4 ++-- src/shared/cpacket.h | 4 ++-- src/shared/csocket.cpp | 4 ++-- src/shared/csocket.h | 4 ++-- src/shared/poller.cpp | 4 ++-- src/shared/poller.h | 4 ++-- src/shared/sensor_common.h | 2 +- src/shared/sensor_deprecated.h | 4 ++-- src/shared/sensor_info.cpp | 4 ++-- src/shared/sensor_info.h | 4 ++-- src/shared/sensor_internal.h | 2 +- src/shared/sensor_internal_deprecated.h | 2 +- src/shared/sensor_log.cpp | 4 ++-- src/shared/sensor_log.h | 4 ++-- src/shared/sensor_types.h | 4 ++-- 62 files changed, 107 insertions(+), 107 deletions(-) diff --git a/src/client/client.cpp b/src/client/client.cpp index 81d00d0..6e1a416 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -1,7 +1,7 @@ /* - * libsensord + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/client/client_common.cpp b/src/client/client_common.cpp index 344af09..19831a2 100644 --- a/src/client/client_common.cpp +++ b/src/client/client_common.cpp @@ -1,7 +1,7 @@ /* - * libsensord + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/client/client_common.h b/src/client/client_common.h index 1d5938d..532cb8d 100644 --- a/src/client/client_common.h +++ b/src/client/client_common.h @@ -1,5 +1,5 @@ /* - * libsensord + * sensord * * Copyright (c) 2014 Samsung Electronics Co., Ltd. * diff --git a/src/client/command_channel.cpp b/src/client/command_channel.cpp index cdb8fe9..a034e0b 100644 --- a/src/client/command_channel.cpp +++ b/src/client/command_channel.cpp @@ -1,7 +1,7 @@ /* - * libsensord + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/client/command_channel.h b/src/client/command_channel.h index f205106..63d5ceb 100644 --- a/src/client/command_channel.h +++ b/src/client/command_channel.h @@ -1,7 +1,7 @@ /* - * libsensord + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/client/reg_event_info.h b/src/client/reg_event_info.h index 18e1335..cf2fd76 100644 --- a/src/client/reg_event_info.h +++ b/src/client/reg_event_info.h @@ -1,7 +1,7 @@ /* - * libsensord + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/client/sensor_client_info.cpp b/src/client/sensor_client_info.cpp index 30dfab2..3ffc120 100644 --- a/src/client/sensor_client_info.cpp +++ b/src/client/sensor_client_info.cpp @@ -1,7 +1,7 @@ /* - * libsensord + * sensord * - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * 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. diff --git a/src/client/sensor_client_info.h b/src/client/sensor_client_info.h index b408356..e3869d2 100644 --- a/src/client/sensor_client_info.h +++ b/src/client/sensor_client_info.h @@ -1,7 +1,7 @@ /* - * libsensord + * sensord * - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * 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. diff --git a/src/client/sensor_event_listener.cpp b/src/client/sensor_event_listener.cpp index 4550da6..568d8cb 100644 --- a/src/client/sensor_event_listener.cpp +++ b/src/client/sensor_event_listener.cpp @@ -1,5 +1,5 @@ /* - * libsensord + * sensord * * Copyright (c) 2014 Samsung Electronics Co., Ltd. * diff --git a/src/client/sensor_event_listener.h b/src/client/sensor_event_listener.h index d9fc2f8..aaa29a6 100644 --- a/src/client/sensor_event_listener.h +++ b/src/client/sensor_event_listener.h @@ -1,7 +1,7 @@ /* - * libsensord + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/client/sensor_handle_info.cpp b/src/client/sensor_handle_info.cpp index 1be96c0..6d9e429 100644 --- a/src/client/sensor_handle_info.cpp +++ b/src/client/sensor_handle_info.cpp @@ -1,7 +1,7 @@ /* - * libsensord + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/client/sensor_handle_info.h b/src/client/sensor_handle_info.h index d9b2ec9..c72fb00 100644 --- a/src/client/sensor_handle_info.h +++ b/src/client/sensor_handle_info.h @@ -1,7 +1,7 @@ /* - * libsensord + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/client/sensor_info_manager.cpp b/src/client/sensor_info_manager.cpp index 4a427f2..530eddd 100644 --- a/src/client/sensor_info_manager.cpp +++ b/src/client/sensor_info_manager.cpp @@ -1,7 +1,7 @@ /* - * libsensord + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/client/sensor_info_manager.h b/src/client/sensor_info_manager.h index 084b5a3..e36acc9 100644 --- a/src/client/sensor_info_manager.h +++ b/src/client/sensor_info_manager.h @@ -1,7 +1,7 @@ /* - * libsensord + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/server/client_info_manager.cpp b/src/server/client_info_manager.cpp index 6c84889..068778b 100644 --- a/src/server/client_info_manager.cpp +++ b/src/server/client_info_manager.cpp @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/server/client_info_manager.h b/src/server/client_info_manager.h index bee9995..7a9dde6 100644 --- a/src/server/client_info_manager.h +++ b/src/server/client_info_manager.h @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/server/client_sensor_record.cpp b/src/server/client_sensor_record.cpp index fbc4ed8..c7ee8e1 100644 --- a/src/server/client_sensor_record.cpp +++ b/src/server/client_sensor_record.cpp @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/server/client_sensor_record.h b/src/server/client_sensor_record.h index cad13f4..ac3f3db 100644 --- a/src/server/client_sensor_record.h +++ b/src/server/client_sensor_record.h @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/server/device_config.cpp b/src/server/device_config.cpp index 3497ca6..10239f1 100644 --- a/src/server/device_config.cpp +++ b/src/server/device_config.cpp @@ -1,5 +1,5 @@ /* - * libsensord-share + * sensord * * Copyright (c) 2014 Samsung Electronics Co., Ltd. * diff --git a/src/server/device_config.h b/src/server/device_config.h index a5f2339..3b85f2f 100644 --- a/src/server/device_config.h +++ b/src/server/device_config.h @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * 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. diff --git a/src/server/physical_sensor.cpp b/src/server/physical_sensor.cpp index 0096e8e..f631265 100644 --- a/src/server/physical_sensor.cpp +++ b/src/server/physical_sensor.cpp @@ -1,5 +1,5 @@ /* - * libsensord-share + * sensord * * Copyright (c) 2014 Samsung Electronics Co., Ltd. * diff --git a/src/server/physical_sensor.h b/src/server/physical_sensor.h index 33378f6..a35edc8 100644 --- a/src/server/physical_sensor.h +++ b/src/server/physical_sensor.h @@ -1,5 +1,5 @@ /* - * libsensord-share + * sensord * * Copyright (c) 2014 Samsung Electronics Co., Ltd. * diff --git a/src/server/plugin_info_list.cpp b/src/server/plugin_info_list.cpp index 0de1b21..db36f04 100644 --- a/src/server/plugin_info_list.cpp +++ b/src/server/plugin_info_list.cpp @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2013 Samsung Electronics Co., Ltd. + * 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. diff --git a/src/server/plugin_info_list.h b/src/server/plugin_info_list.h index b8ee5ea..e8b034e 100644 --- a/src/server/plugin_info_list.h +++ b/src/server/plugin_info_list.h @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2013 Samsung Electronics Co., Ltd. + * 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. diff --git a/src/server/sensor_base.cpp b/src/server/sensor_base.cpp index 654ac97..4aaacf6 100644 --- a/src/server/sensor_base.cpp +++ b/src/server/sensor_base.cpp @@ -1,5 +1,5 @@ /* - * libsensord-share + * sensord * * Copyright (c) 2014 Samsung Electronics Co., Ltd. * diff --git a/src/server/sensor_base.h b/src/server/sensor_base.h index 144de20..072c3f2 100644 --- a/src/server/sensor_base.h +++ b/src/server/sensor_base.h @@ -1,5 +1,5 @@ /* - * libsensord-share + * sensord * * Copyright (c) 2014 Samsung Electronics Co., Ltd. * diff --git a/src/server/sensor_event_dispatcher.cpp b/src/server/sensor_event_dispatcher.cpp index d2deaa2..564ab70 100644 --- a/src/server/sensor_event_dispatcher.cpp +++ b/src/server/sensor_event_dispatcher.cpp @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/server/sensor_event_dispatcher.h b/src/server/sensor_event_dispatcher.h index bc23f5c..b597816 100644 --- a/src/server/sensor_event_dispatcher.h +++ b/src/server/sensor_event_dispatcher.h @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/server/sensor_event_poller.cpp b/src/server/sensor_event_poller.cpp index 1d5e69b..97fd19a 100644 --- a/src/server/sensor_event_poller.cpp +++ b/src/server/sensor_event_poller.cpp @@ -1,5 +1,5 @@ /* - * libsensord-share + * sensord * * Copyright (c) 2016 Samsung Electronics Co., Ltd. * diff --git a/src/server/sensor_event_poller.h b/src/server/sensor_event_poller.h index 4267b1e..03e5a59 100644 --- a/src/server/sensor_event_poller.h +++ b/src/server/sensor_event_poller.h @@ -1,5 +1,5 @@ /* - * libsensord-share + * sensord * * Copyright (c) 2016 Samsung Electronics Co., Ltd. * diff --git a/src/server/sensor_event_queue.cpp b/src/server/sensor_event_queue.cpp index 27865ea..9378c8d 100644 --- a/src/server/sensor_event_queue.cpp +++ b/src/server/sensor_event_queue.cpp @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/server/sensor_event_queue.h b/src/server/sensor_event_queue.h index ba9decb..df33035 100644 --- a/src/server/sensor_event_queue.h +++ b/src/server/sensor_event_queue.h @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/server/sensor_loader.cpp b/src/server/sensor_loader.cpp index 95dfd6c..74448da 100644 --- a/src/server/sensor_loader.cpp +++ b/src/server/sensor_loader.cpp @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/server/sensor_loader.h b/src/server/sensor_loader.h index 9585105..19997d7 100644 --- a/src/server/sensor_loader.h +++ b/src/server/sensor_loader.h @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/server/sensor_usage.cpp b/src/server/sensor_usage.cpp index 08963ce..6041913 100644 --- a/src/server/sensor_usage.cpp +++ b/src/server/sensor_usage.cpp @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/server/sensor_usage.h b/src/server/sensor_usage.h index 59165e4..f13018d 100644 --- a/src/server/sensor_usage.h +++ b/src/server/sensor_usage.h @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/server/virtual_sensor.cpp b/src/server/virtual_sensor.cpp index 232d7f1..fd03a49 100644 --- a/src/server/virtual_sensor.cpp +++ b/src/server/virtual_sensor.cpp @@ -1,5 +1,5 @@ /* - * libsensord-share + * sensord * * Copyright (c) 2014 Samsung Electronics Co., Ltd. * diff --git a/src/server/virtual_sensor.h b/src/server/virtual_sensor.h index 5ea14e3..270285b 100644 --- a/src/server/virtual_sensor.h +++ b/src/server/virtual_sensor.h @@ -1,5 +1,5 @@ /* - * libsensord-share + * sensord * * Copyright (c) 2014 Samsung Electronics Co., Ltd. * diff --git a/src/server/virtual_sensor_config.cpp b/src/server/virtual_sensor_config.cpp index 4e30ba8..bc59fb7 100644 --- a/src/server/virtual_sensor_config.cpp +++ b/src/server/virtual_sensor_config.cpp @@ -1,5 +1,5 @@ /* - * libsensord-share + * sensord * * Copyright (c) 2014 Samsung Electronics Co., Ltd. * diff --git a/src/server/virtual_sensor_config.h b/src/server/virtual_sensor_config.h index d9ed919..37d9fd7 100644 --- a/src/server/virtual_sensor_config.h +++ b/src/server/virtual_sensor_config.h @@ -1,5 +1,5 @@ /* - * libsensord-share + * sensord * * Copyright (c) 2014 Samsung Electronics Co., Ltd. * diff --git a/src/server/worker_thread.cpp b/src/server/worker_thread.cpp index 152cc19..afd188c 100644 --- a/src/server/worker_thread.cpp +++ b/src/server/worker_thread.cpp @@ -1,5 +1,5 @@ /* - * libsensord-share + * sensord * * Copyright (c) 2014 Samsung Electronics Co., Ltd. * diff --git a/src/server/worker_thread.h b/src/server/worker_thread.h index b12fed5..2f5acab 100644 --- a/src/server/worker_thread.h +++ b/src/server/worker_thread.h @@ -1,5 +1,5 @@ /* - * libsensord-share + * sensord * * Copyright (c) 2014 Samsung Electronics Co., Ltd. * diff --git a/src/shared/cbase_lock.cpp b/src/shared/cbase_lock.cpp index 2aec244..f30ce18 100644 --- a/src/shared/cbase_lock.cpp +++ b/src/shared/cbase_lock.cpp @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/shared/cbase_lock.h b/src/shared/cbase_lock.h index 5b82be2..5a6b5e5 100644 --- a/src/shared/cbase_lock.h +++ b/src/shared/cbase_lock.h @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/shared/cmutex.cpp b/src/shared/cmutex.cpp index d8ef7fe..a033061 100644 --- a/src/shared/cmutex.cpp +++ b/src/shared/cmutex.cpp @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. @@ -18,7 +18,7 @@ */ #include -#include "sensor_log.h" +#include cmutex::cmutex() { diff --git a/src/shared/cmutex.h b/src/shared/cmutex.h index 7537c7c..868500a 100644 --- a/src/shared/cmutex.h +++ b/src/shared/cmutex.h @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/shared/command_common.h b/src/shared/command_common.h index 6fa17b4..141c24c 100644 --- a/src/shared/command_common.h +++ b/src/shared/command_common.h @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * 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. diff --git a/src/shared/cpacket.cpp b/src/shared/cpacket.cpp index a400b4e..fc908a4 100644 --- a/src/shared/cpacket.cpp +++ b/src/shared/cpacket.cpp @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/shared/cpacket.h b/src/shared/cpacket.h index 6cc69ec..6cf6317 100644 --- a/src/shared/cpacket.h +++ b/src/shared/cpacket.h @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/shared/csocket.cpp b/src/shared/csocket.cpp index b31cb0e..cf65aac 100644 --- a/src/shared/csocket.cpp +++ b/src/shared/csocket.cpp @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/shared/csocket.h b/src/shared/csocket.h index 81abac4..b538fe1 100644 --- a/src/shared/csocket.h +++ b/src/shared/csocket.h @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/shared/poller.cpp b/src/shared/poller.cpp index 50c1f18..b0180fe 100644 --- a/src/shared/poller.cpp +++ b/src/shared/poller.cpp @@ -1,7 +1,7 @@ /* - * libsensord + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/shared/poller.h b/src/shared/poller.h index 5f7e112..b43d491 100644 --- a/src/shared/poller.h +++ b/src/shared/poller.h @@ -1,7 +1,7 @@ /* - * libsensord + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/shared/sensor_common.h b/src/shared/sensor_common.h index abbb21c..de74ebb 100644 --- a/src/shared/sensor_common.h +++ b/src/shared/sensor_common.h @@ -1,5 +1,5 @@ /* - * libsensord-share + * sensord * * Copyright (c) 2014 Samsung Electronics Co., Ltd. * diff --git a/src/shared/sensor_deprecated.h b/src/shared/sensor_deprecated.h index bb80e6c..41b7945 100644 --- a/src/shared/sensor_deprecated.h +++ b/src/shared/sensor_deprecated.h @@ -1,7 +1,7 @@ /* - * libsensord + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * 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. diff --git a/src/shared/sensor_info.cpp b/src/shared/sensor_info.cpp index 030b99e..394ee92 100644 --- a/src/shared/sensor_info.cpp +++ b/src/shared/sensor_info.cpp @@ -1,7 +1,7 @@ /* - * libsensord + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/shared/sensor_info.h b/src/shared/sensor_info.h index 536c6f9..6a7ab8b 100644 --- a/src/shared/sensor_info.h +++ b/src/shared/sensor_info.h @@ -1,7 +1,7 @@ /* - * libsensord + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/shared/sensor_internal.h b/src/shared/sensor_internal.h index d5b495f..c1a102b 100644 --- a/src/shared/sensor_internal.h +++ b/src/shared/sensor_internal.h @@ -1,5 +1,5 @@ /* - * libsensord + * sensord * * Copyright (c) 2014 Samsung Electronics Co., Ltd. * diff --git a/src/shared/sensor_internal_deprecated.h b/src/shared/sensor_internal_deprecated.h index a2c05bd..5116303 100644 --- a/src/shared/sensor_internal_deprecated.h +++ b/src/shared/sensor_internal_deprecated.h @@ -1,5 +1,5 @@ /* - * libsensord + * sensord * * Copyright (c) 2014 Samsung Electronics Co., Ltd. * diff --git a/src/shared/sensor_log.cpp b/src/shared/sensor_log.cpp index 98ccf20..d28ae63 100644 --- a/src/shared/sensor_log.cpp +++ b/src/shared/sensor_log.cpp @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/shared/sensor_log.h b/src/shared/sensor_log.h index c414264..9df8791 100644 --- a/src/shared/sensor_log.h +++ b/src/shared/sensor_log.h @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2013 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. diff --git a/src/shared/sensor_types.h b/src/shared/sensor_types.h index f364b87..57b20eb 100644 --- a/src/shared/sensor_types.h +++ b/src/shared/sensor_types.h @@ -1,7 +1,7 @@ /* - * libsensord-share + * sensord * - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * 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. -- 2.7.4 From 5ef1fad6591e4fd56014bdcb35ca2eab17b9dc26 Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Wed, 2 Mar 2016 23:35:51 +0900 Subject: [PATCH 15/16] sensord: clean up the source code - syntax / coding style - clean up including header files - remove compiler warning - remove useless lines/white space - correct typing-errors - sync with private source Change-Id: I4abce149946aa4cf3a81296a88cb6288a71c1ced Signed-off-by: kibak.yoon --- src/client/client.cpp | 37 +++-- src/client/client_common.cpp | 161 ++++++--------------- src/client/client_common.h | 33 +---- src/client/command_channel.cpp | 23 ++- src/client/command_channel.h | 7 +- src/client/reg_event_info.h | 15 +- src/client/sensor_client_info.cpp | 5 - src/client/sensor_event_listener.cpp | 7 +- src/client/sensor_event_listener.h | 6 +- src/client/sensor_handle_info.h | 2 +- src/{shared => client}/sensor_internal.h | 5 +- .../sensor_internal_deprecated.h | 4 - src/hal/sensor_hal.h | 48 +++--- src/sensor/auto_rotation/auto_rotation_sensor.cpp | 5 + src/sensor/auto_rotation/auto_rotation_sensor.h | 4 +- .../rotation_vector/gaming_rv/gaming_rv_sensor.cpp | 4 +- .../rotation_vector/gaming_rv/gaming_rv_sensor.h | 6 +- src/server/client_sensor_record.h | 3 +- src/server/command_worker.cpp | 3 +- src/server/command_worker.h | 5 +- src/server/device_config.h | 8 +- src/server/physical_sensor.cpp | 16 +- src/server/sensor_base.cpp | 83 +++++------ src/server/sensor_base.h | 24 +-- src/server/sensor_event_dispatcher.cpp | 7 +- src/server/sensor_event_dispatcher.h | 3 +- src/server/sensor_event_poller.cpp | 2 - src/server/sensor_event_queue.cpp | 2 +- src/server/sensor_event_queue.h | 6 +- .../{plugin_info_list.cpp => sensor_info_list.cpp} | 55 ++++--- .../{plugin_info_list.h => sensor_info_list.h} | 52 +++---- src/server/sensor_loader.cpp | 56 ++++--- src/server/sensor_loader.h | 10 +- src/server/sensor_usage.cpp | 3 +- src/server/server.cpp | 2 +- src/server/server.h | 9 +- src/server/virtual_sensor.cpp | 1 - src/server/virtual_sensor.h | 2 - src/shared/command_common.h | 7 +- src/shared/cpacket.h | 2 + src/shared/csocket.cpp | 1 + src/shared/csocket.h | 2 +- src/shared/poller.cpp | 4 +- src/shared/sensor_common.h | 14 +- src/shared/sensor_info.cpp | 9 +- src/shared/sensor_info.h | 2 +- src/shared/sensor_log.cpp | 4 +- src/shared/sensor_log.h | 10 +- src/shared/sensor_types.h | 43 +++--- src/test/src/check-sensor.c | 6 +- src/test/src/sensor-test.c | 2 +- 51 files changed, 374 insertions(+), 456 deletions(-) rename src/{shared => client}/sensor_internal.h (99%) rename src/{shared => client}/sensor_internal_deprecated.h (99%) rename src/server/{plugin_info_list.cpp => sensor_info_list.cpp} (66%) rename src/server/{plugin_info_list.h => sensor_info_list.h} (57%) diff --git a/src/client/client.cpp b/src/client/client.cpp index 6e1a416..96a3e95 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -17,9 +17,11 @@ * */ +#include #include #include #include +#include #include #include #include @@ -37,9 +39,6 @@ using std::vector; #define DEFAULT_INTERVAL POLL_10HZ_MS -static const int OP_SUCCESS = 0; -static const int OP_ERROR = -1; - static cmutex lock; static int g_power_save_state = 0; @@ -161,7 +160,7 @@ void restore_session(void) { AUTOLOCK(lock); - _I("Trying to restore session for %s", get_client_name()); + _I("Trying to restore sensor client session for %s", get_client_name()); command_channel *cmd_channel; int client_id; @@ -221,7 +220,7 @@ void restore_session(void) ++it_sensor; } - _I("Succeeded to restore session for %s", get_client_name()); + _I("Succeeded to restore sensor client session for %s", get_client_name()); return; @@ -486,11 +485,12 @@ API bool sensord_get_supported_event_types(sensor_t sensor, unsigned int **event sensor_info* info = sensor_to_sensor_info(sensor); retvm_if (!sensor_info_manager::get_instance().is_valid(info) || !event_types || !count, - false, "Invalid param: sensor (%p), event_types(%p), count(%)", sensor, event_types, count); + false, "Invalid param: sensor (%p), event_types(%p), count(%p)", sensor, event_types, count); unsigned int event_type; event_type = info->get_supported_event(); - *event_types = (unsigned int *) malloc(sizeof(unsigned int)); + *event_types = (unsigned int *)malloc(sizeof(unsigned int)); + retvm_if(!*event_types, false, "Failed to allocate memory"); (*event_types)[0] = event_type; @@ -504,7 +504,7 @@ API bool sensord_is_supported_event_type(sensor_t sensor, unsigned int event_typ sensor_info* info = sensor_to_sensor_info(sensor); retvm_if (!sensor_info_manager::get_instance().is_valid(info) || !event_type || !supported, - false, "Invalid param: sensor (%p), event_type(%p), supported(%)", sensor, event_type, supported); + false, "Invalid param: sensor (%p), event_type(%p), supported(%p)", sensor, event_type, supported); *supported = info->is_supported_event(event_type); @@ -548,7 +548,11 @@ API int sensord_connect(sensor_t sensor) if (!sensor_registered) { cmd_channel = new(std::nothrow) command_channel(); - retvm_if (!cmd_channel, OP_ERROR, "Failed to allocate memory"); + if (!cmd_channel) { + _E("Failed to allocated memory"); + sensor_client_info::get_instance().delete_handle(handle); + return OP_ERROR; + } if (!cmd_channel->create_channel()) { _E("%s failed to create command channel for %s", get_client_name(), get_sensor_name(sensor_id)); @@ -881,6 +885,9 @@ static bool change_event_batch(int handle, unsigned int event_type, unsigned int return false; } + if (interval == 0) + interval = DEFAULT_INTERVAL; + _I("%s changes batch of event %s[0x%x] for %s[%d] to (%d, %d)", get_client_name(), get_event_name(event_type), event_type, get_sensor_name(sensor_id), handle, interval, latency); @@ -888,9 +895,6 @@ static bool change_event_batch(int handle, unsigned int event_type, unsigned int sensor_client_info::get_instance().get_event_info(handle, event_type, prev_interval, prev_latency, prev_cb_type, prev_cb, prev_user_data); - if (interval == 0) - interval = DEFAULT_INTERVAL; - if (!sensor_client_info::get_instance().set_event_batch(handle, event_type, interval, latency)) return false; @@ -1068,12 +1072,12 @@ API bool sensord_set_attribute_str(int handle, int attribute, const char *value, AUTOLOCK(lock); if (!sensor_client_info::get_instance().get_sensor_id(handle, sensor_id)) { - _E("client %s failed to get handle information", get_client_name()); + _E("Client %s failed to get handle information", get_client_name()); return false; } if (!sensor_client_info::get_instance().get_command_channel(sensor_id, &cmd_channel)) { - _E("client %s failed to get command channel for %s", + _E("Client %s failed to get command channel for %s", get_client_name(), get_sensor_name(sensor_id)); return false; } @@ -1101,6 +1105,11 @@ API bool sensord_send_sensorhub_data(int handle, const char *data, int data_len) return sensord_set_attribute_str(handle, 0, data, data_len); } +API bool sensord_send_command(int handle, const char *command, int command_len) +{ + return sensord_set_attribute_str(handle, 0, command, command_len); +} + API bool sensord_get_data(int handle, unsigned int data_id, sensor_data_t* sensor_data) { sensor_id_t sensor_id; diff --git a/src/client/client_common.cpp b/src/client/client_common.cpp index 19831a2..519880b 100644 --- a/src/client/client_common.cpp +++ b/src/client/client_common.cpp @@ -16,123 +16,69 @@ * limitations under the License. * */ +#include #include #include #include #include #include -#include -using std::unordered_map; - -#define FILL_LOG_ELEMENT(ID, TYPE, CNT, PRINT_PER_CNT) {ID, TYPE, {#TYPE, CNT, PRINT_PER_CNT} } - -log_element g_log_elements[] = { - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, UNKNOWN_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, ACCELEROMETER_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, GEOMAGNETIC_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, LIGHT_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, PROXIMITY_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, GYROSCOPE_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, PRESSURE_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, CONTEXT_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, AUTO_ROTATION_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, GRAVITY_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, LINEAR_ACCEL_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, ORIENTATION_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, TEMPERATURE_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, ROTATION_VECTOR_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, GEOMAGNETIC_RV_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, GAMING_RV_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, FUSION_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, TILT_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, GYROSCOPE_UNCAL_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, ULTRAVIOLET_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, BIO_LED_RED_SENSOR, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, GESTURE_WRIST_UP_SENSOR, 0, 1), - - FILL_LOG_ELEMENT(LOG_ID_EVENT, PROXIMITY_CHANGE_STATE_EVENT, 0,1), - FILL_LOG_ELEMENT(LOG_ID_EVENT, LIGHT_CHANGE_LEVEL_EVENT, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_EVENT, PROXIMITY_STATE_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, PROXIMITY_DISTANCE_DATA_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, AUTO_ROTATION_CHANGE_STATE_EVENT, 0, 1), - FILL_LOG_ELEMENT(LOG_ID_EVENT, ACCELEROMETER_RAW_DATA_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, GYROSCOPE_RAW_DATA_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, GEOMAGNETIC_RAW_DATA_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, PRESSURE_RAW_DATA_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, LIGHT_LEVEL_DATA_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, LIGHT_LUX_DATA_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, GRAVITY_RAW_DATA_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, LINEAR_ACCEL_RAW_DATA_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, ORIENTATION_RAW_DATA_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, PRESSURE_RAW_DATA_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, TEMPERATURE_RAW_DATA_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, ROTATION_VECTOR_RAW_DATA_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, GEOMAGNETIC_RV_RAW_DATA_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, GAMING_RV_RAW_DATA_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, FUSION_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, TILT_RAW_DATA_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, GYROSCOPE_UNCAL_RAW_DATA_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, ULTRAVIOLET_RAW_DATA_EVENT, 0, 10), - FILL_LOG_ELEMENT(LOG_ID_EVENT, BIO_LED_RED_RAW_DATA_EVENT, 0, 10), +#include + +typedef std::map sensor_type_map; +static sensor_type_map g_log_maps = { + {UNKNOWN_SENSOR, {"UNKNOWN", "UNKNOWN_EVENT"}}, + {ACCELEROMETER_SENSOR, {"ACCELEROMETER", "ACCELEROMETER_RAW_DATA_EVENT"}}, + {GRAVITY_SENSOR, {"GRAVITY", "GRAVITY_RAW_DATA_EVENT"}}, + {LINEAR_ACCEL_SENSOR, {"LINEAR_ACCEL", "LINEAR_ACCEL_RAW_DATA_EVENT"}}, + {GEOMAGNETIC_SENSOR, {"GEOMAGNETIC SENSOR", "GEOMAGNETIC SENSOR_RAW_DATA_EVENT"}}, + {ROTATION_VECTOR_SENSOR, {"ROTATION VECTOR", "ROTATION VECTOR_RAW_DATA_EVENT"}}, + {ORIENTATION_SENSOR, {"ORIENTATION", "ORIENTATION_RAW_DATA_EVENT"}}, + {GYROSCOPE_SENSOR, {"GYROSCOPE", "GYROSCOPE_RAW_DATA_EVENT"}}, + {LIGHT_SENSOR, {"LIGHT", "LIGHT_RAW_DATA_EVENT"}}, + {PROXIMITY_SENSOR, {"PROXIMITY", "PROXIMITY_RAW_DATA_EVENT"}}, + {PRESSURE_SENSOR, {"PRESSURE", "PRESSURE_RAW_DATA_EVENT"}}, + {ULTRAVIOLET_SENSOR, {"ULTRAVIOLET", "ULTRAVIOLET_RAW_DATA_EVENT"}}, + {TEMPERATURE_SENSOR, {"TEMPERATURE", "TEMPERATURE_RAW_DATA_EVENT"}}, + {HUMIDITY_SENSOR, {"HUMIDITY", "HUMIDITY_RAW_DATA_EVENT"}}, + {BIO_HRM_SENSOR, {"BIO_HRM", "BIO_HRM_RAW_DATA_EVENT"}}, + {BIO_LED_GREEN_SENSOR, {"BIO_LED_GREEN", "BIO_LED_GREEN_RAW_DATA_EVENT"}}, + {BIO_LED_IR_SENSOR, {"BIO_LED_IR", "BIO_LED_IR_RAW_DATA_EVENT"}}, + {BIO_LED_RED_SENSOR, {"BIO_LED_RED", "BIO_LED_RED_RAW_DATA_EVENT"}}, + {GYROSCOPE_UNCAL_SENSOR, {"GYROSCOPE_UNCAL", "GYROSCOPE_UNCAL_RAW_DATA_EVENT"}}, + {GEOMAGNETIC_UNCAL_SENSOR, {"GEOMAGNETIC_UNCAL", "GEOMAGNETIC_UNCAL_RAW_DATA_EVENT"}}, + {GYROSCOPE_RV_SENSOR, {"GYROSCOPE_RV", "GYROSCOPE_RV_RAW_DATA_EVENT"}}, + {GEOMAGNETIC_RV_SENSOR, {"GEOMAGNETIC_RV", "GEOMAGNETIC_RV_RAW_DATA_EVENT"}}, + {CONTEXT_SENSOR, {"CONTEXT", "CONTEXT_RAW_DATA_EVENT"}}, }; -typedef unordered_map log_map; -static log_map g_log_maps[LOG_ID_END]; - -static void init_log_maps(void); - -class initiator { -public: - initiator() - { - init_log_maps(); - } -}; - -static initiator g_initiator; - -void init_log_maps(void) +const char* get_sensor_name(sensor_id_t sensor_id) { - int cnt; + const char* p_unknown = "UNKNOWN"; + sensor_type_t sensor_type = (sensor_type_t) (sensor_id >> SENSOR_TYPE_SHIFT); - cnt = sizeof(g_log_elements) / sizeof(g_log_elements[0]); + auto iter = g_log_maps.find(sensor_type); - for (int i = 0; i < cnt; ++i) { - g_log_maps[g_log_elements[i].id][g_log_elements[i].type] = &g_log_elements[i].log_attr; + if (iter == g_log_maps.end()) { + _I("Unknown type value: 0x%x", sensor_type); + return p_unknown; } + return iter->second.sensor_name; } -const char* get_log_element_name(log_id id, unsigned int type) +const char* get_event_name(unsigned int event_type) { const char* p_unknown = "UNKNOWN"; + sensor_type_t sensor_type = (sensor_type_t) (event_type >> EVENT_TYPE_SHIFT); - auto iter = g_log_maps[id].find(type); + auto iter = g_log_maps.find(sensor_type); - if (iter == g_log_maps[id].end()) { - _I("Unknown type value: 0x%x", type); + if (iter == g_log_maps.end()) { + _I("Unknown type value: 0x%x", sensor_type); return p_unknown; } - return iter->second->name; -} - -const char* get_sensor_name(sensor_id_t sensor_id) -{ - sensor_type_t sensor_type = (sensor_type_t) (sensor_id >> SENSOR_TYPE_SHIFT); - - return get_log_element_name(LOG_ID_SENSOR_TYPE, sensor_type); -} - -const char* get_event_name(unsigned int event_type) -{ - return get_log_element_name(LOG_ID_EVENT, event_type); -} - - -const char* get_data_name(unsigned int data_id) -{ - return get_log_element_name(LOG_ID_DATA, data_id); + return iter->second.event_name; } bool is_one_shot_event(unsigned int event_type) @@ -200,27 +146,8 @@ unsigned long long get_timestamp(void) void print_event_occurrence_log(sensor_handle_info &sensor_handle_info, const reg_event_info *event_info) { - log_attr *log_attr; - - auto iter = g_log_maps[LOG_ID_EVENT].find(event_info->type); - - if (iter == g_log_maps[LOG_ID_EVENT].end()) - return; - - log_attr = iter->second; - - log_attr->cnt++; - - if ((log_attr->cnt != 1) && ((log_attr->cnt % log_attr->print_per_cnt) != 0)) { - return; - } - - _I("%s receives %s with %s[%d][state: %d, option: %d count: %d]", get_client_name(), log_attr->name, - get_sensor_name(sensor_handle_info.m_sensor_id), sensor_handle_info.m_handle, sensor_handle_info.m_sensor_state, - sensor_handle_info.m_sensor_option, log_attr->cnt); - - _I("0x%x(cb_event_type = %s, &user_data, client_data = 0x%x)\n", event_info->m_cb, - log_attr->name, event_info->m_user_data); + _D("%s receives %s[%d]", get_client_name(), + get_sensor_name(sensor_handle_info.m_sensor_id), sensor_handle_info.m_handle); } /* diff --git a/src/client/client_common.h b/src/client/client_common.h index 532cb8d..85606db 100644 --- a/src/client/client_common.h +++ b/src/client/client_common.h @@ -30,38 +30,11 @@ #define CLIENT_NAME_SIZE NAME_MAX+10 -enum log_id { - LOG_ID_START = 0, - LOG_ID_SENSOR_TYPE = 0, - LOG_ID_EVENT, - LOG_ID_DATA, - LOG_ID_PROPERTY, - LOG_ID_END, -}; - struct log_attr { - const char *name; - unsigned long cnt; - const unsigned int print_per_cnt; -}; - -struct log_element { - log_id id; - int type; - struct log_attr log_attr; + char *sensor_name; + char *event_name; }; - -typedef struct { - int handle; - unsigned int event_type; - sensor_event_data_t ev_data; - int sensor_state; - int sensor_option; - sensor_type_t sensor; - reg_event_info event_info; -} log_info; - bool is_one_shot_event(unsigned int event_type); bool is_ontime_event(unsigned int event_type); bool is_panning_event(unsigned int event_type); @@ -69,10 +42,8 @@ bool is_single_state_event(unsigned int event_type); unsigned int get_calibration_event_type(unsigned int event_type); unsigned long long get_timestamp(void); -const char* get_log_element_name(log_id id, unsigned int type); const char* get_sensor_name(sensor_id_t sensor_id); const char* get_event_name(unsigned int event_type); -const char* get_data_name(unsigned int data_id); void print_event_occurrence_log(sensor_handle_info &sensor_handle_info, const reg_event_info *event_info); class sensor_info; diff --git a/src/client/command_channel.cpp b/src/client/command_channel.cpp index a034e0b..4e978a8 100644 --- a/src/client/command_channel.cpp +++ b/src/client/command_channel.cpp @@ -58,7 +58,7 @@ bool command_channel::command_handler(cpacket *packet, void **return_payload) if (m_command_socket.recv(&header, sizeof(header)) <= 0) { m_command_socket.close(); - _E("Failed to receive header for reply packet in client %s", get_client_name()); + _E("Failed to receive header for command reply packet in client %s", get_client_name()); return false; } @@ -67,7 +67,7 @@ bool command_channel::command_handler(cpacket *packet, void **return_payload) if (m_command_socket.recv(buffer, header.size) <= 0) { m_command_socket.close(); - _E("Failed to receive reply packet in client %s", get_client_name()); + _E("Failed to receive command reply packet in client %s", get_client_name()); delete[] buffer; return false; } @@ -611,15 +611,15 @@ bool command_channel::cmd_get_data(unsigned int type, sensor_data_t* sensor_data cmd_get_data->type = type; if (!command_handler(packet, (void **)&cmd_get_data_done)) { - _E("Client %s failed to send/receive command with client_id [%d], data_id[%s]", - get_client_name(), m_client_id, get_data_name(type)); + _E("Client %s failed to send/receive command with client_id [%d]", + get_client_name(), m_client_id); delete packet; return false; } if (cmd_get_data_done->state < 0 ) { - _E("Client %s got error[%d] from server with client_id [%d], data_id[%s]", - get_client_name(), cmd_get_data_done->state, m_client_id, get_data_name(type)); + _E("Client %s got error[%d] from server with client_id [%d]", + get_client_name(), cmd_get_data_done->state, m_client_id); sensor_data->accuracy = SENSOR_ACCURACY_UNDEFINED; sensor_data->timestamp = 0; sensor_data->value_count = 0; @@ -663,14 +663,14 @@ bool command_channel::cmd_set_attribute_int(int attribute, int value) get_client_name(), m_client_id, get_sensor_name(m_sensor_id), attribute, value); if (!command_handler(packet, (void **)&cmd_done)) { - _E("Client %s failed to send/receive command for sensor[%s] with client_id [%d], property[0x%x], value[%d]", + _E("Client %s failed to send/receive command for sensor[%s] with client_id [%d], attribute[0x%x], value[%d]", get_client_name(), get_sensor_name(m_sensor_id), m_client_id, attribute, value); delete packet; return false; } if (cmd_done->value < 0) { - _E("Client %s got error[%d] from server for sensor[%s] with property[0x%x], value[%d]", + _E("Client %s got error[%d] from server for sensor[%s] with attribute[0x%x], value[%d]", get_client_name(), cmd_done->value, get_sensor_name(m_sensor_id), attribute, value); delete[] (char *)cmd_done; @@ -700,8 +700,8 @@ bool command_channel::cmd_set_attribute_str(int attribute, const char* value, in cmd_set_attribute_str->value_len = value_len; memcpy(cmd_set_attribute_str->value, value, value_len); - _I("%s send cmd_set_attribute_str(client_id=%d, value_len = %d, buffer = 0x%x)", - get_client_name(), m_client_id, value_len, value); + _I("%s send cmd_set_attribute_str(client_id=%d, attribute = 0x%x, value_len = %d, value = 0x%x)", + get_client_name(), m_client_id, attribute, value_len, value); if (!command_handler(packet, (void **)&cmd_done)) { _E("%s failed to send/receive command with client_id [%d]", @@ -721,8 +721,5 @@ bool command_channel::cmd_set_attribute_str(int attribute, const char* value, in delete[] (char *)cmd_done; delete packet; - return true; - - } diff --git a/src/client/command_channel.h b/src/client/command_channel.h index 63d5ceb..faa3837 100644 --- a/src/client/command_channel.h +++ b/src/client/command_channel.h @@ -27,7 +27,6 @@ class command_channel { public: - command_channel(); ~command_channel(); @@ -48,9 +47,9 @@ public: bool cmd_unregister_events(event_type_vector &event_vec); bool cmd_set_batch(unsigned int interval, unsigned int latency); bool cmd_unset_batch(void); - bool cmd_get_data(unsigned int type, sensor_data_t* values); + bool cmd_get_data(unsigned int type, sensor_data_t *values); bool cmd_set_attribute_int(int attribute, int value); - bool cmd_set_attribute_str(int attribute, const char* buffer, int data_len); + bool cmd_set_attribute_str(int attribute, const char *value, int value_len); private: csocket m_command_socket; int m_client_id; @@ -58,4 +57,4 @@ private: bool command_handler(cpacket *packet, void **return_payload); }; -#endif /* COMMAND_CHANNEL_H_ */ +#endif /* _COMMAND_CHANNEL_H_ */ diff --git a/src/client/reg_event_info.h b/src/client/reg_event_info.h index cf2fd76..fa8994c 100644 --- a/src/client/reg_event_info.h +++ b/src/client/reg_event_info.h @@ -40,17 +40,16 @@ public: void *m_cb; void *m_user_data; unsigned long long m_previous_event_time; - bool m_fired; + bool m_fired; GMainContext *m_maincontext; - reg_event_info():m_id(0), m_handle(-1), - type(0), m_interval(POLL_1HZ_MS), - m_latency(0), - m_cb_type(SENSOR_EVENT_CB), m_cb(NULL), m_user_data(NULL), - m_previous_event_time(0), m_fired(false), m_maincontext(NULL){} + reg_event_info() + : m_id(0), m_handle(-1), + type(0), m_interval(POLL_1HZ_MS), m_latency(0), + m_cb_type(SENSOR_EVENT_CB), m_cb(NULL), m_user_data(NULL), + m_previous_event_time(0), m_fired(false), m_maincontext(NULL) {} - ~reg_event_info(){} + ~reg_event_info() {} }; - #endif /* _REG_EVENT_INFO_H_ */ diff --git a/src/client/sensor_client_info.cpp b/src/client/sensor_client_info.cpp index 3ffc120..684cd52 100644 --- a/src/client/sensor_client_info.cpp +++ b/src/client/sensor_client_info.cpp @@ -24,9 +24,6 @@ #include #include -#define MS_TO_US 1000 -#define MIN_DELIVERY_DIFF_FACTOR 0.75f - using std::thread; using std::pair; @@ -417,7 +414,6 @@ bool sensor_client_info::close_command_channel(sensor_id_t sensor_id) return true; } - bool sensor_client_info::has_client_id(void) { return (m_client_id != CLIENT_ID_INVALID); @@ -641,7 +637,6 @@ bool sensor_client_info::is_sensor_registered(sensor_id_t sensor) return false; } - bool sensor_client_info::is_sensor_active(sensor_id_t sensor) { AUTOLOCK(m_handle_info_lock); diff --git a/src/client/sensor_event_listener.cpp b/src/client/sensor_event_listener.cpp index 568d8cb..7ea6c95 100644 --- a/src/client/sensor_event_listener.cpp +++ b/src/client/sensor_event_listener.cpp @@ -25,10 +25,9 @@ #include #include -#define MS_TO_US 1000 -#define MIN_DELIVERY_DIFF_FACTOR 0.75f +#include -/* TODO: this macro should be adjusted */ +/* TODO: this macro should be adjusted(4224 = 4096(data) + 128(header)) */ #define EVENT_BUFFER_SIZE 4224 using std::thread; @@ -353,8 +352,6 @@ ssize_t sensor_event_listener::sensor_event_poll(void* buffer, int buffer_len, s return len; } - - void sensor_event_listener::listen_events(void) { struct epoll_event event; diff --git a/src/client/sensor_event_listener.h b/src/client/sensor_event_listener.h index aaa29a6..4af7092 100644 --- a/src/client/sensor_event_listener.h +++ b/src/client/sensor_event_listener.h @@ -97,6 +97,8 @@ private: hup_observer_t m_hup_observer; + sensor_client_info &m_client_info; + sensor_event_listener(); ~sensor_event_listener(); @@ -106,7 +108,7 @@ private: bool create_event_channel(void); void close_event_channel(void); - ssize_t sensor_event_poll(void* buffer, int buffer_len, struct epoll_event &event); + ssize_t sensor_event_poll(void *buffer, int buffer_len, struct epoll_event &event); void listen_events(void); client_callback_info* handle_calibration_cb(sensor_handle_info &handle_info, unsigned event_type, unsigned long long time, int accuracy); @@ -122,7 +124,5 @@ private: static gboolean callback_dispatcher(gpointer data); void set_thread_state(thread_state state); - - sensor_client_info &m_client_info; }; #endif /* _SENSOR_EVENT_LISTENER_H_ */ diff --git a/src/client/sensor_handle_info.h b/src/client/sensor_handle_info.h index c72fb00..f56da67 100644 --- a/src/client/sensor_handle_info.h +++ b/src/client/sensor_handle_info.h @@ -20,12 +20,12 @@ #ifndef _SENSOR_HANDLE_INFO_H_ #define _SENSOR_HANDLE_INFO_H_ +#include #include #include #include #include #include -#include typedef std::unordered_map event_info_map; diff --git a/src/shared/sensor_internal.h b/src/client/sensor_internal.h similarity index 99% rename from src/shared/sensor_internal.h rename to src/client/sensor_internal.h index c1a102b..b16e086 100644 --- a/src/shared/sensor_internal.h +++ b/src/client/sensor_internal.h @@ -30,10 +30,8 @@ /*header for common sensor type*/ #include - -/*header for each sensor type*/ #include - +#include #include #ifdef __cplusplus @@ -355,6 +353,7 @@ bool sensord_set_attribute_str(int handle, int attribute, const char *value, int * @return true on success, otherwise false. */ bool sensord_send_sensorhub_data(int handle, const char *data, int data_len); +bool sensord_send_command(int handle, const char *command, int command_len); /** * @brief get sensor data from a connected sensor diff --git a/src/shared/sensor_internal_deprecated.h b/src/client/sensor_internal_deprecated.h similarity index 99% rename from src/shared/sensor_internal_deprecated.h rename to src/client/sensor_internal_deprecated.h index 5116303..469b8da 100644 --- a/src/shared/sensor_internal_deprecated.h +++ b/src/client/sensor_internal_deprecated.h @@ -30,13 +30,9 @@ /*header for common sensor type*/ #include - -/*header for each sensor type*/ #include - #include - #ifdef __cplusplus extern "C" { diff --git a/src/hal/sensor_hal.h b/src/hal/sensor_hal.h index 9ae5c62..8d89f75 100644 --- a/src/hal/sensor_hal.h +++ b/src/hal/sensor_hal.h @@ -69,16 +69,6 @@ typedef enum { SENSOR_DEVICE_GYROSCOPE_RV, SENSOR_DEVICE_GEOMAGNETIC_RV, - SENSOR_DEVICE_ACTIVITY_STATIONARY = 0x100, - SENSOR_DEVICE_ACTIVITY_WALK, - SENSOR_DEVICE_ACTIVITY_RUN, - SENSOR_DEVICE_ACTIVITY_IN_VEHICLE, - SENSOR_DEVICE_ACTIVITY_ON_BICYCLE, - - SENSOR_DEVICE_GESTURE_MOVEMENT = 0x200, - SENSOR_DEVICE_GESTURE_WRIST_UP, - SENSOR_DEVICE_GESTURE_WRIST_DOWN, - SENSOR_DEVICE_HUMAN_PEDOMETER = 0x300, SENSOR_DEVICE_HUMAN_SLEEP_MONITOR, @@ -96,11 +86,21 @@ typedef enum { SENSOR_DEVICE_HRM_RAW, SENSOR_DEVICE_TILT, SENSOR_DEVICE_ROTATION_VECTOR_RAW, + + SENSOR_DEVICE_ACTIVITY_STATIONARY = 0x1100, + SENSOR_DEVICE_ACTIVITY_WALK, + SENSOR_DEVICE_ACTIVITY_RUN, + SENSOR_DEVICE_ACTIVITY_IN_VEHICLE, + SENSOR_DEVICE_ACTIVITY_ON_BICYCLE, + + SENSOR_DEVICE_GESTURE_MOVEMENT = 0x1200, + SENSOR_DEVICE_GESTURE_WRIST_UP, + SENSOR_DEVICE_GESTURE_WRIST_DOWN, } sensor_device_type; /* * A platform sensor handler is generated based on this handle - * ID can be assigned from HAL developer. so it has to be unique in HAL. + * This id can be assigned from HAL developer. so it has to be unique in 1 sensor_device. */ typedef struct sensor_info_t { uint32_t id; @@ -175,15 +175,29 @@ public: virtual bool enable(uint32_t id) = 0; virtual bool disable(uint32_t id) = 0; - virtual bool set_interval(uint32_t id, unsigned long val) = 0; - virtual bool set_batch_latency(uint32_t id, unsigned long val) = 0; - virtual bool set_attribute_int(uint32_t id, int32_t attribute, int32_t value) = 0; - virtual bool set_attribute_str(uint32_t id, int32_t attribute, char *value, int value_len) = 0; - virtual int read_fd(uint32_t **ids) = 0; virtual int get_data(uint32_t id, sensor_data_t **data, int *length) = 0; - virtual bool flush(uint32_t id) = 0; + virtual bool set_interval(uint32_t id, unsigned long val) + { + return false; + } + virtual bool set_batch_latency(uint32_t id, unsigned long val) + { + return false; + } + virtual bool set_attribute_int(uint32_t id, int32_t attribute, int32_t value) + { + return false; + } + virtual bool set_attribute_str(uint32_t id, int32_t attribute, char *value, int value_len) + { + return false; + } + virtual bool flush(uint32_t id) + { + return false; + } }; #endif /* __cplusplus */ diff --git a/src/sensor/auto_rotation/auto_rotation_sensor.cpp b/src/sensor/auto_rotation/auto_rotation_sensor.cpp index b1f7dba..3afd961 100644 --- a/src/sensor/auto_rotation/auto_rotation_sensor.cpp +++ b/src/sensor/auto_rotation/auto_rotation_sensor.cpp @@ -174,6 +174,11 @@ void auto_rotation_sensor::synthesize(const sensor_event_t& event) int remains; rotation_event = (sensor_event_t *)malloc(sizeof(sensor_event_t)); + if (!rotation_event) { + _E("Failed to allocate memory"); + return; + } + remains = get_data(&rotation_data, &data_length); if (remains < 0) diff --git a/src/sensor/auto_rotation/auto_rotation_sensor.h b/src/sensor/auto_rotation/auto_rotation_sensor.h index 9b40c7c..ef69a6d 100644 --- a/src/sensor/auto_rotation/auto_rotation_sensor.h +++ b/src/sensor/auto_rotation/auto_rotation_sensor.h @@ -21,7 +21,7 @@ #define _AUTO_ROTATION_SENSOR_H_ #include -#include +#include #include class auto_rotation_sensor : public virtual_sensor { @@ -67,4 +67,4 @@ private: auto_rotation_alg *get_alg(); }; -#endif +#endif /* _AUTO_ROTATION_SENSOR_H_ */ diff --git a/src/sensor/rotation_vector/gaming_rv/gaming_rv_sensor.cpp b/src/sensor/rotation_vector/gaming_rv/gaming_rv_sensor.cpp index 5a7adc2..3fd0268 100644 --- a/src/sensor/rotation_vector/gaming_rv/gaming_rv_sensor.cpp +++ b/src/sensor/rotation_vector/gaming_rv/gaming_rv_sensor.cpp @@ -34,7 +34,7 @@ using std::string; using std::vector; -#define SENSOR_NAME "GAMING_RV_SENSOR" +#define SENSOR_NAME "GYROSCOPE_RV_SENSOR" #define SENSOR_TYPE_GAMING_RV "GAMING_ROTATION_VECTOR" #define ACCELEROMETER_ENABLED 0x01 @@ -144,7 +144,7 @@ bool gaming_rv_sensor::init() void gaming_rv_sensor::get_types(vector &types) { - types.push_back(GAMING_RV_SENSOR); + types.push_back(GYROSCOPE_RV_SENSOR); } bool gaming_rv_sensor::on_start(void) diff --git a/src/sensor/rotation_vector/gaming_rv/gaming_rv_sensor.h b/src/sensor/rotation_vector/gaming_rv/gaming_rv_sensor.h index 3307263..ec89b21 100644 --- a/src/sensor/rotation_vector/gaming_rv/gaming_rv_sensor.h +++ b/src/sensor/rotation_vector/gaming_rv/gaming_rv_sensor.h @@ -17,8 +17,8 @@ * */ -#ifndef _GAMING_RV_SENSOR_H_ -#define _GAMING_RV_SENSOR_H_ +#ifndef _GYROSCOPE_RV_SENSOR_H_ +#define _GYROSCOPE_RV_SENSOR_H_ #include #include @@ -70,4 +70,4 @@ private: bool on_stop(void); }; -#endif /*_GAMING_RV_SENSOR_H_*/ +#endif /*_GYROSCOPE_RV_SENSOR_H_*/ diff --git a/src/server/client_sensor_record.h b/src/server/client_sensor_record.h index ac3f3db..9386507 100644 --- a/src/server/client_sensor_record.h +++ b/src/server/client_sensor_record.h @@ -20,7 +20,8 @@ #ifndef _CLIENT_SENSOR_RECORD_H_ #define _CLIENT_SENSOR_RECORD_H_ -#include +#include +#include #include #include #include diff --git a/src/server/command_worker.cpp b/src/server/command_worker.cpp index 8e6931d..4970e2a 100644 --- a/src/server/command_worker.cpp +++ b/src/server/command_worker.cpp @@ -17,10 +17,10 @@ * */ +#include #include #include #include -#include #include #include #include @@ -221,7 +221,6 @@ bool command_worker::stopped(void *ctx) _I("%s is stopped", info.c_str()); if ((inst->m_module) && (inst->m_client_id != CLIENT_ID_INVALID)) { - if (get_client_info_manager().is_started(inst->m_client_id, inst->m_sensor_id)) { _W("Does not receive cmd_stop before connection broken for [%s]!!", inst->m_module->get_name()); inst->m_module->delete_interval(inst->m_client_id, false); diff --git a/src/server/command_worker.h b/src/server/command_worker.h index f455cb6..abe89e6 100644 --- a/src/server/command_worker.h +++ b/src/server/command_worker.h @@ -20,13 +20,13 @@ #ifndef _COMMAND_WORKER_H_ #define _COMMAND_WORKER_H_ +#include #include #include #include #include #include #include -#include typedef std::multimap sensor_raw_data_map; void insert_priority_list(unsigned int); @@ -35,9 +35,6 @@ class command_worker { private: typedef bool (command_worker::*cmd_handler_t)(void *payload); - static const int OP_ERROR = -1; - static const int OP_SUCCESS = 0; - int m_client_id; int m_permission; csocket m_socket; diff --git a/src/server/device_config.h b/src/server/device_config.h index 3b85f2f..5c73509 100644 --- a/src/server/device_config.h +++ b/src/server/device_config.h @@ -25,16 +25,16 @@ #include class device_config { -protected: - virtual bool load_config(const std::string& config_path) = 0; - - std::string m_device_id; public: device_config(); virtual ~device_config(); bool get_device_id(void); +protected: + virtual bool load_config(const std::string& config_path) = 0; + + std::string m_device_id; }; #endif /* _DEVICE_CONFIG_H_ */ diff --git a/src/server/physical_sensor.cpp b/src/server/physical_sensor.cpp index f631265..83efec8 100644 --- a/src/server/physical_sensor.cpp +++ b/src/server/physical_sensor.cpp @@ -17,14 +17,12 @@ * */ +#include #include #include #define UNKNOWN_NAME "UNKNOWN_SENSOR" -#define OP_SUCCESS 0 -#define OP_ERROR -1 - cmutex physical_sensor::m_mutex; physical_sensor::physical_sensor() @@ -74,7 +72,7 @@ int physical_sensor::get_poll_fd() AUTOLOCK(m_mutex); if (!m_sensor_device) - return -1; + return OP_ERROR; return m_sensor_device->get_poll_fd(); } @@ -101,14 +99,14 @@ int physical_sensor::get_data(sensor_data_t **data, int *length) AUTOLOCK(m_mutex); if (!m_sensor_device) - return -1; + return OP_ERROR; int remains = 0; remains = m_sensor_device->get_data(m_info->id, data, length); if (*length < 0) { _E("Failed to get sensor event"); - return -1; + return OP_ERROR; } return remains; @@ -153,7 +151,7 @@ int physical_sensor::set_attribute(int32_t attribute, int32_t value) AUTOLOCK(m_mutex); if (!m_sensor_device) - return false; + return OP_ERROR; if (!m_sensor_device->set_attribute_int(m_info->id, attribute, value)) return OP_ERROR; @@ -166,7 +164,7 @@ int physical_sensor::set_attribute(int32_t attribute, char *value, int value_len AUTOLOCK(m_mutex); if (!m_sensor_device) - return false; + return OP_ERROR; if (!m_sensor_device->set_attribute_str(m_info->id, attribute, value, value_len)) return OP_ERROR; @@ -210,7 +208,7 @@ bool physical_sensor::get_sensor_info(sensor_info &info) info.set_max_range(m_info->max_range); info.set_resolution(m_info->resolution); info.set_min_interval(m_info->min_interval); - info.set_fifo_count(0); // FIXME + info.set_fifo_count(0); info.set_max_batch_count(m_info->max_batch_count); info.set_supported_event(get_event_type()); info.set_wakeup_supported(m_info->wakeup_supported); diff --git a/src/server/sensor_base.cpp b/src/server/sensor_base.cpp index 4aaacf6..4fefeff 100644 --- a/src/server/sensor_base.cpp +++ b/src/server/sensor_base.cpp @@ -18,18 +18,20 @@ */ #include -#include -#include -#include #include #include #include +#include + +#include +#include +#include using std::make_pair; using std::vector; sensor_base::sensor_base() -: m_unique_id(-1) +: m_id(SENSOR_ID_INVALID) , m_permission(SENSOR_PERMISSION_STANDARD) , m_started(false) , m_client(0) @@ -42,15 +44,15 @@ sensor_base::~sensor_base() void sensor_base::set_id(sensor_id_t id) { - m_unique_id = id; + m_id = id; } sensor_id_t sensor_base::get_id(void) { - if (m_unique_id == -1) + if (m_id == SENSOR_ID_INVALID) return UNKNOWN_SENSOR; - return m_unique_id; + return m_id; } sensor_type_t sensor_base::get_type(void) @@ -80,7 +82,7 @@ bool sensor_base::is_virtual() int sensor_base::get_data(sensor_data_t **data, int *length) { - return -1; + return OP_ERROR; } bool sensor_base::flush(void) @@ -90,12 +92,12 @@ bool sensor_base::flush(void) int sensor_base::set_attribute(int32_t cmd, int32_t value) { - return -1; + return OP_ERROR; } int sensor_base::set_attribute(int32_t attribute, char *value, int value_size) { - return -1; + return OP_ERROR; } bool sensor_base::start() @@ -149,14 +151,14 @@ bool sensor_base::add_interval(int client_id, unsigned int interval, bool is_pro { unsigned int prev_min, cur_min; - AUTOLOCK(m_plugin_info_list_mutex); + AUTOLOCK(m_sensor_info_list_mutex); - prev_min = m_plugin_info_list.get_min_interval(); + prev_min = m_sensor_info_list.get_min_interval(); - if (!m_plugin_info_list.add_interval(client_id, interval, is_processor)) + if (!m_sensor_info_list.add_interval(client_id, interval, is_processor)) return false; - cur_min = m_plugin_info_list.get_min_interval(); + cur_min = m_sensor_info_list.get_min_interval(); if (cur_min != prev_min) { _I("Min interval for sensor[0x%llx] is changed from %dms to %dms" @@ -173,14 +175,14 @@ bool sensor_base::add_interval(int client_id, unsigned int interval, bool is_pro bool sensor_base::delete_interval(int client_id, bool is_processor) { unsigned int prev_min, cur_min; - AUTOLOCK(m_plugin_info_list_mutex); + AUTOLOCK(m_sensor_info_list_mutex); - prev_min = m_plugin_info_list.get_min_interval(); + prev_min = m_sensor_info_list.get_min_interval(); - if (!m_plugin_info_list.delete_interval(client_id, is_processor)) + if (!m_sensor_info_list.delete_interval(client_id, is_processor)) return false; - cur_min = m_plugin_info_list.get_min_interval(); + cur_min = m_sensor_info_list.get_min_interval(); if (!cur_min) { _I("No interval for sensor[0x%llx] by%sclient[%d] deleting interval, " @@ -203,23 +205,23 @@ bool sensor_base::delete_interval(int client_id, bool is_processor) unsigned int sensor_base::get_interval(int client_id, bool is_processor) { - AUTOLOCK(m_plugin_info_list_mutex); + AUTOLOCK(m_sensor_info_list_mutex); - return m_plugin_info_list.get_interval(client_id, is_processor); + return m_sensor_info_list.get_interval(client_id, is_processor); } bool sensor_base::add_batch(int client_id, unsigned int latency) { unsigned int prev_max, cur_max; - AUTOLOCK(m_plugin_info_list_mutex); + AUTOLOCK(m_sensor_info_list_mutex); - prev_max = m_plugin_info_list.get_max_batch(); + prev_max = m_sensor_info_list.get_max_batch(); - if (!m_plugin_info_list.add_batch(client_id, latency)) + if (!m_sensor_info_list.add_batch(client_id, latency)) return false; - cur_max = m_plugin_info_list.get_max_batch(); + cur_max = m_sensor_info_list.get_max_batch(); if (cur_max != prev_max) { _I("Max latency for sensor[0x%llx] is changed from %dms to %dms by client[%d] adding latency", @@ -233,14 +235,14 @@ bool sensor_base::add_batch(int client_id, unsigned int latency) bool sensor_base::delete_batch(int client_id) { unsigned int prev_max, cur_max; - AUTOLOCK(m_plugin_info_list_mutex); + AUTOLOCK(m_sensor_info_list_mutex); - prev_max = m_plugin_info_list.get_max_batch(); + prev_max = m_sensor_info_list.get_max_batch(); - if (!m_plugin_info_list.delete_batch(client_id)) + if (!m_sensor_info_list.delete_batch(client_id)) return false; - cur_max = m_plugin_info_list.get_max_batch(); + cur_max = m_sensor_info_list.get_max_batch(); if (!cur_max) { _I("No latency for sensor[0x%llx] by client[%d] deleting latency, so set to default 0 ms", @@ -259,23 +261,23 @@ bool sensor_base::delete_batch(int client_id) unsigned int sensor_base::get_batch(int client_id) { - AUTOLOCK(m_plugin_info_list_mutex); + AUTOLOCK(m_sensor_info_list_mutex); - return m_plugin_info_list.get_batch(client_id); + return m_sensor_info_list.get_batch(client_id); } bool sensor_base::add_wakeup(int client_id, int wakeup) { int prev_wakeup, cur_wakeup; - AUTOLOCK(m_plugin_info_list_mutex); + AUTOLOCK(m_sensor_info_list_mutex); - prev_wakeup = m_plugin_info_list.is_wakeup_on(); + prev_wakeup = m_sensor_info_list.is_wakeup_on(); - if (!m_plugin_info_list.add_wakeup(client_id, wakeup)) + if (!m_sensor_info_list.add_wakeup(client_id, wakeup)) return false; - cur_wakeup = m_plugin_info_list.is_wakeup_on(); + cur_wakeup = m_sensor_info_list.is_wakeup_on(); if ((cur_wakeup == SENSOR_WAKEUP_ON) && (prev_wakeup < SENSOR_WAKEUP_ON)) { _I("Wakeup for sensor[0x%llx] is changed from %d to %d by client[%d] adding wakeup", @@ -289,14 +291,14 @@ bool sensor_base::add_wakeup(int client_id, int wakeup) bool sensor_base::delete_wakeup(int client_id) { int prev_wakeup, cur_wakeup; - AUTOLOCK(m_plugin_info_list_mutex); + AUTOLOCK(m_sensor_info_list_mutex); - prev_wakeup = m_plugin_info_list.is_wakeup_on(); + prev_wakeup = m_sensor_info_list.is_wakeup_on(); - if (!m_plugin_info_list.delete_wakeup(client_id)) + if (!m_sensor_info_list.delete_wakeup(client_id)) return false; - cur_wakeup = m_plugin_info_list.is_wakeup_on(); + cur_wakeup = m_sensor_info_list.is_wakeup_on(); if ((cur_wakeup < SENSOR_WAKEUP_ON) && (prev_wakeup == SENSOR_WAKEUP_ON)) { _I("Wakeup for sensor[0x%llx] is changed from %d to %d by client[%d] deleting wakeup", @@ -309,9 +311,9 @@ bool sensor_base::delete_wakeup(int client_id) int sensor_base::get_wakeup(int client_id) { - AUTOLOCK(m_plugin_info_list_mutex); + AUTOLOCK(m_sensor_info_list_mutex); - return m_plugin_info_list.is_wakeup_on(); + return m_sensor_info_list.is_wakeup_on(); } bool sensor_base::is_wakeup_supported(void) @@ -381,4 +383,3 @@ unsigned long long sensor_base::get_timestamp(timeval *t) return ((unsigned long long)(t->tv_sec)*1000000LL +t->tv_usec); } - diff --git a/src/server/sensor_base.h b/src/server/sensor_base.h index 072c3f2..0260119 100644 --- a/src/server/sensor_base.h +++ b/src/server/sensor_base.h @@ -20,9 +20,8 @@ #ifndef _SENSOR_BASE_H_ #define _SENSOR_BASE_H_ -#include #include -#include +#include #include #include @@ -30,6 +29,7 @@ #include #include #include +#include class sensor_base { public: @@ -44,9 +44,9 @@ public: virtual sensor_type_t get_type(); virtual unsigned int get_event_type(void); virtual const char* get_name(void); + virtual bool is_virtual(void); virtual bool get_sensor_info(sensor_info &info); - virtual bool is_virtual(void); /* set/get data */ virtual int get_data(sensor_data_t **data, int *length); @@ -61,16 +61,16 @@ public: bool is_started(void); /* interval / batch / wakeup */ - bool add_interval(int client_id, unsigned int interval, bool is_processor); - bool delete_interval(int client_id, bool is_processor); + virtual bool add_interval(int client_id, unsigned int interval, bool is_processor); + virtual bool delete_interval(int client_id, bool is_processor); unsigned int get_interval(int client_id, bool is_processor); - bool add_batch(int client_id, unsigned int latency); - bool delete_batch(int client_id); + virtual bool add_batch(int client_id, unsigned int latency); + virtual bool delete_batch(int client_id); unsigned int get_batch(int client_id); - bool add_wakeup(int client_id, int wakeup); - bool delete_wakeup(int client_id); + virtual bool add_wakeup(int client_id, int wakeup); + virtual bool delete_wakeup(int client_id); int get_wakeup(int client_id); bool is_wakeup_supported(void); @@ -83,11 +83,11 @@ protected: void set_permission(int permission); private: - sensor_id_t m_unique_id; + sensor_id_t m_id; int m_permission; - plugin_info_list m_plugin_info_list; - cmutex m_plugin_info_list_mutex; + sensor_info_list m_sensor_info_list; + cmutex m_sensor_info_list_mutex; bool m_started; unsigned int m_client; diff --git a/src/server/sensor_event_dispatcher.cpp b/src/server/sensor_event_dispatcher.cpp index 564ab70..a673ae4 100644 --- a/src/server/sensor_event_dispatcher.cpp +++ b/src/server/sensor_event_dispatcher.cpp @@ -17,6 +17,7 @@ * */ +#include #include #include #include @@ -29,7 +30,6 @@ using std::pair; #define MAX_PENDING_CONNECTION 32 sensor_event_dispatcher::sensor_event_dispatcher() -: m_lcd_on(false) { } @@ -282,8 +282,7 @@ void sensor_event_dispatcher::request_last_event(int client_id, sensor_id_t sens } } - -bool sensor_event_dispatcher::add_active_virtual_sensor(virtual_sensor * sensor) +bool sensor_event_dispatcher::add_active_virtual_sensor(virtual_sensor *sensor) { AUTOLOCK(m_active_virtual_sensors_mutex); @@ -297,7 +296,7 @@ bool sensor_event_dispatcher::add_active_virtual_sensor(virtual_sensor * sensor) return true; } -bool sensor_event_dispatcher::delete_active_virtual_sensor(virtual_sensor * sensor) +bool sensor_event_dispatcher::delete_active_virtual_sensor(virtual_sensor *sensor) { AUTOLOCK(m_active_virtual_sensors_mutex); diff --git a/src/server/sensor_event_dispatcher.h b/src/server/sensor_event_dispatcher.h index b597816..befb9ea 100644 --- a/src/server/sensor_event_dispatcher.h +++ b/src/server/sensor_event_dispatcher.h @@ -20,6 +20,7 @@ #ifndef _SENSOR_EVENT_DISPATCHER_H_ #define _SENSOR_EVENT_DISPATCHER_H_ +#include #include #include #include @@ -28,13 +29,11 @@ #include #include - typedef std::unordered_map event_type_last_event_map; typedef std::list virtual_sensors; class sensor_event_dispatcher { private: - bool m_lcd_on; csocket m_accept_socket; cmutex m_mutex; cmutex m_last_events_mutex; diff --git a/src/server/sensor_event_poller.cpp b/src/server/sensor_event_poller.cpp index 97fd19a..274c11e 100644 --- a/src/server/sensor_event_poller.cpp +++ b/src/server/sensor_event_poller.cpp @@ -24,8 +24,6 @@ #include #include -#define EPOLL_MAX_FD 32 - sensor_event_poller::sensor_event_poller() { init_sensor_map(); diff --git a/src/server/sensor_event_queue.cpp b/src/server/sensor_event_queue.cpp index 9378c8d..26b4d97 100644 --- a/src/server/sensor_event_queue.cpp +++ b/src/server/sensor_event_queue.cpp @@ -18,7 +18,7 @@ */ #include -#include "sensor_log.h" +#include sensor_event_queue& sensor_event_queue::get_instance() { diff --git a/src/server/sensor_event_queue.h b/src/server/sensor_event_queue.h index df33035..1564d7d 100644 --- a/src/server/sensor_event_queue.h +++ b/src/server/sensor_event_queue.h @@ -82,9 +82,9 @@ private: typedef std::lock_guard lock; typedef std::unique_lock ulock; - sensor_event_queue() {}; - ~sensor_event_queue() {}; - sensor_event_queue(const sensor_event_queue &) {}; + sensor_event_queue() {} + ~sensor_event_queue() {} + sensor_event_queue(const sensor_event_queue &) {} sensor_event_queue& operator=(const sensor_event_queue &); void push_internal(void *event); public: diff --git a/src/server/plugin_info_list.cpp b/src/server/sensor_info_list.cpp similarity index 66% rename from src/server/plugin_info_list.cpp rename to src/server/sensor_info_list.cpp index db36f04..21e6f62 100644 --- a/src/server/plugin_info_list.cpp +++ b/src/server/sensor_info_list.cpp @@ -17,40 +17,39 @@ * */ -#include +#include #include - -cinterval_info::cinterval_info(int client_id, bool is_processor, unsigned int interval) +interval_info::interval_info(int client_id, bool is_processor, unsigned int interval) { this->client_id = client_id; this->is_processor = is_processor; this->interval = interval; } -cbatch_info::cbatch_info(int client_id, unsigned int latency) +batch_info::batch_info(int client_id, unsigned int latency) { this->client_id = client_id; this->latency = latency; } -cwakeup_info::cwakeup_info(int client_id, int wakeup) +wakeup_info::wakeup_info(int client_id, int wakeup) { this->client_id = client_id; this->wakeup = wakeup; } -bool plugin_info_list::comp_interval_info(cinterval_info a, cinterval_info b) +bool sensor_info_list::comp_interval_info(interval_info a, interval_info b) { return a.interval < b.interval; } -bool plugin_info_list::comp_batch_info(cbatch_info a, cbatch_info b) +bool sensor_info_list::comp_batch_info(batch_info a, batch_info b) { return a.latency < b.latency; } -cinterval_info_iterator plugin_info_list::find_if_interval_info(int client_id, bool is_processor) +interval_info_iterator sensor_info_list::find_if_interval_info(int client_id, bool is_processor) { auto iter = m_interval_info_list.begin(); @@ -64,7 +63,7 @@ cinterval_info_iterator plugin_info_list::find_if_interval_info(int client_id, b return iter; } -cbatch_info_iterator plugin_info_list::find_if_batch_info(int client_id) +batch_info_iterator sensor_info_list::find_if_batch_info(int client_id) { auto iter = m_batch_info_list.begin(); @@ -78,7 +77,7 @@ cbatch_info_iterator plugin_info_list::find_if_batch_info(int client_id) return iter; } -cwakeup_info_iterator plugin_info_list::find_if_wakeup_info(int client_id) +wakeup_info_iterator sensor_info_list::find_if_wakeup_info(int client_id) { auto iter = m_wakeup_info_list.begin(); @@ -92,19 +91,19 @@ cwakeup_info_iterator plugin_info_list::find_if_wakeup_info(int client_id) return iter; } -bool plugin_info_list::add_interval(int client_id, unsigned int interval, bool is_processor) +bool sensor_info_list::add_interval(int client_id, unsigned int interval, bool is_processor) { auto iter = find_if_interval_info(client_id, is_processor); if (iter != m_interval_info_list.end()) - *iter = cinterval_info(client_id, is_processor, interval); + *iter = interval_info(client_id, is_processor, interval); else - m_interval_info_list.push_back(cinterval_info(client_id, is_processor, interval)); + m_interval_info_list.push_back(interval_info(client_id, is_processor, interval)); return true; } -bool plugin_info_list::delete_interval(int client_id, bool is_processor) +bool sensor_info_list::delete_interval(int client_id, bool is_processor) { auto iter = find_if_interval_info(client_id, is_processor); @@ -116,7 +115,7 @@ bool plugin_info_list::delete_interval(int client_id, bool is_processor) return true; } -unsigned int plugin_info_list::get_interval(int client_id, bool is_processor) +unsigned int sensor_info_list::get_interval(int client_id, bool is_processor) { auto iter = find_if_interval_info(client_id, is_processor); @@ -126,7 +125,7 @@ unsigned int plugin_info_list::get_interval(int client_id, bool is_processor) return iter->interval; } -unsigned int plugin_info_list::get_min_interval(void) +unsigned int sensor_info_list::get_min_interval(void) { if (m_interval_info_list.empty()) return 0; @@ -136,19 +135,19 @@ unsigned int plugin_info_list::get_min_interval(void) return iter->interval; } -bool plugin_info_list::add_batch(int client_id, unsigned int latency) +bool sensor_info_list::add_batch(int client_id, unsigned int latency) { auto iter = find_if_batch_info(client_id); if (iter != m_batch_info_list.end()) - *iter = cbatch_info(client_id, latency); + *iter = batch_info(client_id, latency); else - m_batch_info_list.push_back(cbatch_info(client_id, latency)); + m_batch_info_list.push_back(batch_info(client_id, latency)); return true; } -bool plugin_info_list::delete_batch(int client_id) +bool sensor_info_list::delete_batch(int client_id) { auto iter = find_if_batch_info(client_id); @@ -160,7 +159,7 @@ bool plugin_info_list::delete_batch(int client_id) return true; } -unsigned int plugin_info_list::get_batch(int client_id) +unsigned int sensor_info_list::get_batch(int client_id) { auto iter = find_if_batch_info(client_id); @@ -170,7 +169,7 @@ unsigned int plugin_info_list::get_batch(int client_id) return iter->latency; } -unsigned int plugin_info_list::get_max_batch(void) +unsigned int sensor_info_list::get_max_batch(void) { if (m_batch_info_list.empty()) return 0; @@ -180,19 +179,19 @@ unsigned int plugin_info_list::get_max_batch(void) return iter->latency; } -bool plugin_info_list::add_wakeup(int client_id, int wakeup) +bool sensor_info_list::add_wakeup(int client_id, int wakeup) { auto iter = find_if_wakeup_info(client_id); if (iter != m_wakeup_info_list.end()) - *iter = cwakeup_info(client_id, wakeup); + *iter = wakeup_info(client_id, wakeup); else - m_wakeup_info_list.push_back(cwakeup_info(client_id, wakeup)); + m_wakeup_info_list.push_back(wakeup_info(client_id, wakeup)); return true; } -bool plugin_info_list::delete_wakeup(int client_id) +bool sensor_info_list::delete_wakeup(int client_id) { auto iter = find_if_wakeup_info(client_id); @@ -204,7 +203,7 @@ bool plugin_info_list::delete_wakeup(int client_id) return true; } -int plugin_info_list::get_wakeup(int client_id) +int sensor_info_list::get_wakeup(int client_id) { auto iter = find_if_wakeup_info(client_id); @@ -214,7 +213,7 @@ int plugin_info_list::get_wakeup(int client_id) return iter->wakeup; } -int plugin_info_list::is_wakeup_on(void) +int sensor_info_list::is_wakeup_on(void) { if (m_wakeup_info_list.empty()) return -1; diff --git a/src/server/plugin_info_list.h b/src/server/sensor_info_list.h similarity index 57% rename from src/server/plugin_info_list.h rename to src/server/sensor_info_list.h index e8b034e..fc253aa 100644 --- a/src/server/plugin_info_list.h +++ b/src/server/sensor_info_list.h @@ -17,53 +17,40 @@ * */ -#ifndef _PLUGIN_INFO_LIST_H_ -#define _PLUGIN_INFO_LIST_H_ +#ifndef _SENSOR_INFO_LIST_H_ +#define _SENSOR_INFO_LIST_H_ #include -class cinterval_info { +class interval_info { public: - cinterval_info(int client_id, bool is_processor, unsigned int interval); + interval_info(int client_id, bool is_processor, unsigned int interval); int client_id; bool is_processor; unsigned int interval; }; -typedef std::list::iterator cinterval_info_iterator; +typedef std::list::iterator interval_info_iterator; -class cbatch_info { +class batch_info { public: - cbatch_info(int client_id, unsigned int latency); + batch_info(int client_id, unsigned int latency); int client_id; unsigned int latency; }; -typedef std::list::iterator cbatch_info_iterator; +typedef std::list::iterator batch_info_iterator; -class cwakeup_info { +class wakeup_info { public: - cwakeup_info(int client_id, int wakeup); + wakeup_info(int client_id, int wakeup); int client_id; int wakeup; }; -typedef std::list::iterator cwakeup_info_iterator; - -class plugin_info_list { -private: - static bool comp_interval_info(cinterval_info a, cinterval_info b); - cinterval_info_iterator find_if_interval_info(int client_id, bool is_processor); - - static bool comp_batch_info(cbatch_info a, cbatch_info b); - cbatch_info_iterator find_if_batch_info(int client_id); - - cwakeup_info_iterator find_if_wakeup_info(int client_id); - - std::list m_interval_info_list; - std::list m_batch_info_list; - std::list m_wakeup_info_list; +typedef std::list::iterator wakeup_info_iterator; +class sensor_info_list { public: bool add_interval(int client_id, unsigned int interval, bool is_processor); bool delete_interval(int client_id, bool is_processor); @@ -79,5 +66,18 @@ public: bool delete_wakeup(int client_id); int get_wakeup(int client_id); int is_wakeup_on(void); + +private: + static bool comp_interval_info(interval_info a, interval_info b); + interval_info_iterator find_if_interval_info(int client_id, bool is_processor); + + static bool comp_batch_info(batch_info a, batch_info b); + batch_info_iterator find_if_batch_info(int client_id); + + wakeup_info_iterator find_if_wakeup_info(int client_id); + + std::list m_interval_info_list; + std::list m_batch_info_list; + std::list m_wakeup_info_list; }; -#endif /* _PLUGIN_INFO_LIST_H_ */ +#endif /* _SENSOR_INFO_LIST_H_ */ diff --git a/src/server/sensor_loader.cpp b/src/server/sensor_loader.cpp index 74448da..d8636f1 100644 --- a/src/server/sensor_loader.cpp +++ b/src/server/sensor_loader.cpp @@ -17,15 +17,15 @@ * */ +#include +#include +#include #include -#include -#include #include #include -#include -#include -#include #include +#include +#include #include #include @@ -37,9 +37,7 @@ using std::vector; using std::string; -#define DEVICE_PLUGINS_DIR_PATH "/usr/lib/sensor" -#define SENSOR_TYPE_SHIFT 32 -#define SENSOR_INDEX_MASK 0xFFFFFFFF +#define DEVICE_HAL_DIR_PATH "/usr/lib/sensor" sensor_loader::sensor_loader() { @@ -53,10 +51,10 @@ sensor_loader& sensor_loader::get_instance() bool sensor_loader::load(void) { - std::vector device_plugin_paths; - std::vector unique_device_plugin_paths; + std::vector device_hal_paths; + std::vector unique_device_hal_paths; - get_paths_from_dir(string(DEVICE_PLUGINS_DIR_PATH), device_plugin_paths); + get_paths_from_dir(string(DEVICE_HAL_DIR_PATH), device_hal_paths); std::unordered_set s; auto unique = [&s](vector &paths, const string &path) { @@ -64,13 +62,13 @@ bool sensor_loader::load(void) paths.push_back(path); }; - for_each(device_plugin_paths.begin(), device_plugin_paths.end(), + for_each(device_hal_paths.begin(), device_hal_paths.end(), [&](const string &path) { - unique(unique_device_plugin_paths, path); + unique(unique_device_hal_paths, path); } ); - for_each(unique_device_plugin_paths.begin(), unique_device_plugin_paths.end(), + for_each(unique_device_hal_paths.begin(), unique_device_hal_paths.end(), [&](const string &path) { void *handle; load_sensor_devices(path, handle); @@ -86,7 +84,7 @@ bool sensor_loader::load(void) bool sensor_loader::load_sensor_devices(const string &path, void* &handle) { sensor_device_t *_devices = NULL; - sensor_device *device; + sensor_device *device = NULL; const sensor_info_t *infos; _I("load device: [%s]", path.c_str()); @@ -156,7 +154,7 @@ void sensor_loader::create_physical_sensors(sensor_type_t type) continue; } - sensor = reinterpret_cast(create_sensor<_sensor>()); + sensor = dynamic_cast(create_sensor<_sensor>()); if (!sensor) { _E("Memory allocation failed[%s]", info->name); @@ -177,7 +175,6 @@ void sensor_loader::create_physical_sensors(sensor_type_t type) m_devices[info] = NULL; } - return; } template @@ -187,7 +184,7 @@ void sensor_loader::create_virtual_sensors(const char *name) sensor_type_t type; virtual_sensor *instance; - instance = reinterpret_cast(create_sensor<_sensor>()); + instance = dynamic_cast(create_sensor<_sensor>()); if (!instance) { _E("Memory allocation failed[%s]", name); return; @@ -249,7 +246,7 @@ void sensor_loader::show_sensor_info(void) _I("===============================================\n"); } -bool sensor_loader::get_paths_from_dir(const string &dir_path, vector &plugin_paths) +bool sensor_loader::get_paths_from_dir(const string &dir_path, vector &hal_paths) { DIR *dir = NULL; struct dirent *dir_entry = NULL; @@ -263,13 +260,13 @@ bool sensor_loader::get_paths_from_dir(const string &dir_path, vector &p string name; - while ((dir_entry = readdir(dir))) { + while (dir_entry = readdir(dir)) { name = string(dir_entry->d_name); if (name == "." || name == "..") continue; - plugin_paths.push_back(dir_path + "/" + name); + hal_paths.push_back(dir_path + "/" + name); } closedir(dir); @@ -278,12 +275,12 @@ bool sensor_loader::get_paths_from_dir(const string &dir_path, vector &p sensor_base* sensor_loader::get_sensor(sensor_type_t type) { - auto it_plugins = m_sensors.find(type); + auto it = m_sensors.find(type); - if (it_plugins == m_sensors.end()) + if (it == m_sensors.end()) return NULL; - return it_plugins->second.get(); + return it->second.get(); } sensor_base* sensor_loader::get_sensor(sensor_id_t id) @@ -336,12 +333,13 @@ vector sensor_loader::get_virtual_sensors(void) vector virtual_list; sensor_base* sensor; - for (auto sensor_it = m_sensors.begin(); sensor_it != m_sensors.end(); ++sensor_it) { - sensor = sensor_it->second.get(); + for (auto it = m_sensors.begin(); it != m_sensors.end(); ++it) { + sensor = it->second.get(); - if (sensor && sensor->is_virtual() == true) { - virtual_list.push_back(sensor); - } + if (!sensor || !sensor->is_virtual()) + continue; + + virtual_list.push_back(sensor); } return virtual_list; diff --git a/src/server/sensor_loader.h b/src/server/sensor_loader.h index 19997d7..763ea9a 100644 --- a/src/server/sensor_loader.h +++ b/src/server/sensor_loader.h @@ -17,8 +17,8 @@ * */ -#ifndef _SENSOR_PLUGIN_LOADER_H_ -#define _SENSOR_PLUGIN_LOADER_H_ +#ifndef _SENSOR_LOADER_H_ +#define _SENSOR_LOADER_H_ #include #include @@ -32,8 +32,6 @@ #include #include #include -#include -#include class sensor_base; @@ -52,7 +50,7 @@ private: template sensor_base* create_sensor(void); void show_sensor_info(void); - bool get_paths_from_dir(const std::string &dir_path, std::vector &plugin_paths); + bool get_paths_from_dir(const std::string &dir_path, std::vector &hal_paths); sensor_map_t m_sensors; sensor_device_map_t m_devices; @@ -67,4 +65,4 @@ public: std::vector get_sensors(sensor_type_t type); std::vector get_virtual_sensors(void); }; -#endif /* _SENSOR_PLUGIN_LOADER_H_ */ +#endif /* _SENSOR_LOADER_H_ */ diff --git a/src/server/sensor_usage.cpp b/src/server/sensor_usage.cpp index 6041913..8f4e758 100644 --- a/src/server/sensor_usage.cpp +++ b/src/server/sensor_usage.cpp @@ -17,7 +17,8 @@ * */ -#include +#include +#include #include #include diff --git a/src/server/server.cpp b/src/server/server.cpp index 52671ce..213a43c 100644 --- a/src/server/server.cpp +++ b/src/server/server.cpp @@ -57,7 +57,7 @@ int server::get_systemd_socket(const char *name) } if (sd_listen_fds(fd_env) < 0) { - ERR("Failed to listen fds from systemd"); + _E("Failed to listen fds from systemd"); return -1; } diff --git a/src/server/server.h b/src/server/server.h index 8c69a7a..3f32b3f 100644 --- a/src/server/server.h +++ b/src/server/server.h @@ -24,6 +24,11 @@ #include class server { +public: + void run(void); + void stop(void); + static server& get_instance(); + private: GMainLoop *m_mainloop; csocket m_command_channel_accept_socket; @@ -42,10 +47,6 @@ private: void accept_event_channel(void); int get_systemd_socket(const char *name); -public: - void run(void); - void stop(void); - static server& get_instance(); }; #endif /* _SERVER_H_ */ diff --git a/src/server/virtual_sensor.cpp b/src/server/virtual_sensor.cpp index fd03a49..6701642 100644 --- a/src/server/virtual_sensor.cpp +++ b/src/server/virtual_sensor.cpp @@ -22,7 +22,6 @@ virtual_sensor::virtual_sensor() -: m_hardware_fusion(false) { } diff --git a/src/server/virtual_sensor.h b/src/server/virtual_sensor.h index 270285b..a0adbcc 100644 --- a/src/server/virtual_sensor.h +++ b/src/server/virtual_sensor.h @@ -50,8 +50,6 @@ protected: bool deactivate(void); private: - bool m_hardware_fusion; - virtual bool set_interval(unsigned long interval) = 0; virtual bool set_batch_latency(unsigned long latency) = 0; virtual bool set_wakeup(int wakeup) = 0; diff --git a/src/shared/command_common.h b/src/shared/command_common.h index 141c24c..a75415c 100644 --- a/src/shared/command_common.h +++ b/src/shared/command_common.h @@ -20,21 +20,22 @@ #ifndef _COMMAND_COMMON_H_ #define _COMMAND_COMMON_H_ +#include #include -#define COMMAND_CHANNEL_PATH "/tmp/sensord_command_socket" -#define EVENT_CHANNEL_PATH "/tmp/sensord_event_socket" +#define COMMAND_CHANNEL_PATH "/tmp/sensord_command_socket" +#define EVENT_CHANNEL_PATH "/tmp/sensord_event_socket" #define MAX_HANDLE 256 #define MAX_HANDLE_REACHED -2 enum packet_type_t { + CMD_DONE = -1, CMD_NONE = 0, CMD_GET_ID, CMD_GET_SENSOR_LIST, CMD_HELLO, CMD_BYEBYE, - CMD_DONE, CMD_START, CMD_STOP, CMD_REG, diff --git a/src/shared/cpacket.h b/src/shared/cpacket.h index 6cf6317..64845e8 100644 --- a/src/shared/cpacket.h +++ b/src/shared/cpacket.h @@ -20,6 +20,8 @@ #ifndef _CPACKET_H_ #define _CPACKET_H_ +#include + typedef struct packet_header { int cmd; size_t size; diff --git a/src/shared/csocket.cpp b/src/shared/csocket.cpp index cf65aac..513c4b1 100644 --- a/src/shared/csocket.cpp +++ b/src/shared/csocket.cpp @@ -17,6 +17,7 @@ * */ +#include #include #include #include diff --git a/src/shared/csocket.h b/src/shared/csocket.h index b538fe1..474c38d 100644 --- a/src/shared/csocket.h +++ b/src/shared/csocket.h @@ -26,7 +26,7 @@ #include #include #include -#include "sensor_log.h" +#include class csocket { public: diff --git a/src/shared/poller.cpp b/src/shared/poller.cpp index b0180fe..6676632 100644 --- a/src/shared/poller.cpp +++ b/src/shared/poller.cpp @@ -24,11 +24,13 @@ #define EPOLL_MAX 32 poller::poller() +: m_epfd(-1) { init_poll_fd(); } poller::poller(int fd) +: m_epfd(-1) { init_poll_fd(); add_fd(fd); @@ -100,7 +102,7 @@ bool poller::poll(struct epoll_event &event) m_event_queue.pop(); if (event.events & EPOLLERR) { - _D("Poll error!"); + _E("Poll error!"); return false; } diff --git a/src/shared/sensor_common.h b/src/shared/sensor_common.h index de74ebb..7ba2a89 100644 --- a/src/shared/sensor_common.h +++ b/src/shared/sensor_common.h @@ -20,11 +20,19 @@ #ifndef __SENSOR_COMMON_H__ #define __SENSOR_COMMON_H__ +#include +#include #include #include -#include -#define CLIENT_ID_INVALID -1 +#define OP_ERROR -1 +#define OP_SUCCESS 0 + +#define CLIENT_ID_INVALID -1 +#define SENSOR_ID_INVALID -1 + +#define SENSOR_TYPE_SHIFT 32 +#define SENSOR_INDEX_MASK 0xFFFFFFFF #ifndef NAME_MAX #define NAME_MAX 256 @@ -125,6 +133,6 @@ typedef struct sensor_event_t { #include typedef std::vector event_type_vector; -#endif +#endif /* __cplusplus */ #endif /* __SENSOR_COMMON_H__ */ diff --git a/src/shared/sensor_info.cpp b/src/shared/sensor_info.cpp index 394ee92..eae3bde 100644 --- a/src/shared/sensor_info.cpp +++ b/src/shared/sensor_info.cpp @@ -81,7 +81,7 @@ int sensor_info::get_max_batch_count(void) return m_max_batch_count; } -unsigned int sensor_info::get_supported_event() +unsigned int sensor_info::get_supported_event(void) { return m_supported_event; } @@ -221,8 +221,7 @@ void sensor_info::show(void) _I("Min_interval = %d", m_min_interval); _I("Fifo_count = %d", m_fifo_count); _I("Max_batch_count = %d", m_max_batch_count); - _I("supported_event = 0x%x", m_supported_event); - + _I("Supported_event = 0x%x", m_supported_event); _I("Wakeup_supported = %d", m_wakeup_supported); } @@ -249,7 +248,7 @@ void sensor_info::put(raw_data_t &data, int value) { char buffer[sizeof(value)]; - int *temp = (int *) buffer; + int *temp = (int *)buffer; *temp = value; copy(&buffer[0], &buffer[sizeof(buffer)], back_inserter(data)); @@ -259,7 +258,7 @@ void sensor_info::put(raw_data_t &data, unsigned int value) { char buffer[sizeof(value)]; - unsigned int *temp = (unsigned int *) buffer; + unsigned int *temp = (unsigned int *)buffer; *temp = value; copy(&buffer[0], &buffer[sizeof(buffer)], back_inserter(data)); diff --git a/src/shared/sensor_info.h b/src/shared/sensor_info.h index 6a7ab8b..e2e9e57 100644 --- a/src/shared/sensor_info.h +++ b/src/shared/sensor_info.h @@ -42,7 +42,7 @@ public: int get_min_interval(void); int get_fifo_count(void); int get_max_batch_count(void); - unsigned int get_supported_event(); + unsigned int get_supported_event(void); bool is_supported_event(unsigned int event); bool is_wakeup_supported(void); diff --git a/src/shared/sensor_log.cpp b/src/shared/sensor_log.cpp index d28ae63..0026801 100644 --- a/src/shared/sensor_log.cpp +++ b/src/shared/sensor_log.cpp @@ -23,9 +23,11 @@ #include #include #include +#include #include +#include #include -#include "sensor_log.h" +#include #define PATH_MAX 256 diff --git a/src/shared/sensor_log.h b/src/shared/sensor_log.h index 9df8791..be30df0 100644 --- a/src/shared/sensor_log.h +++ b/src/shared/sensor_log.h @@ -17,10 +17,10 @@ * */ -#ifndef _SENSOR_LOGS_H_ -#define _SENSOR_LOGS_H_ +#ifndef _SENSOR_LOG_H_ +#define _SENSOR_LOG_H_ -#include +#include #include #define EVENT_TYPE_SHIFT 16 @@ -33,6 +33,8 @@ #endif #define LOG_TAG "SENSOR" +#define LOG_DUMP(fp, fmt, arg...) do { if (fp) fprintf(fp, fmt, ##arg); else _E(fmt, ##arg); } while(0) + #ifdef _DEBUG #define DBG SLOGD #else @@ -123,4 +125,4 @@ bool get_proc_name(pid_t pid, char *process_name); } #endif -#endif /* _SENSOR_LOGS_H_ */ +#endif /* _SENSOR_LOG_H_ */ diff --git a/src/shared/sensor_types.h b/src/shared/sensor_types.h index 57b20eb..dfa5461 100644 --- a/src/shared/sensor_types.h +++ b/src/shared/sensor_types.h @@ -41,25 +41,19 @@ typedef enum { ULTRAVIOLET_SENSOR, TEMPERATURE_SENSOR, HUMIDITY_SENSOR, - BIO_HRM_SENSOR, - BIO_LED_GREEN_SENSOR, - BIO_LED_IR_SENSOR, - BIO_LED_RED_SENSOR, + HRM_SENSOR, + BIO_HRM_SENSOR = HRM_SENSOR, + HRM_LED_GREEN_SENSOR, + BIO_LED_GREEN_SENSOR = HRM_LED_GREEN_SENSOR, + HRM_LED_IR_SENSOR, + BIO_LED_IR_SENSOR = HRM_LED_IR_SENSOR, + HRM_LED_RED_SENSOR, + BIO_LED_RED_SENSOR = HRM_LED_RED_SENSOR, GYROSCOPE_UNCAL_SENSOR, - UNCAL_GEOMAGNETIC_SENSOR, - GAMING_RV_SENSOR, + GEOMAGNETIC_UNCAL_SENSOR, + GYROSCOPE_RV_SENSOR, GEOMAGNETIC_RV_SENSOR, - ACTIVITY_STATIONARY_SENSOR = 0x1100, - ACTIVITY_WALK_SENSOR, - ACTIVITY_RUN_SENSOR, - ACTIVITY_IN_VEHICLE_SENSOR, - ACTIVITY_ON_BICYCLE_SENSOR, - - GESTURE_MOVEMENT_SENSOR = 0x1200, - GESTURE_WRIST_UP_SENSOR, - GESTURE_WRIST_DOWN_SENSOR, - HUMAN_PEDOMETER_SENSOR = 0x300, HUMAN_SLEEP_MONITOR_SENSOR, @@ -74,9 +68,20 @@ typedef enum { THERMOMETER_SENSOR, PEDOMETER_SENSOR, FLAT_SENSOR, - BIO_SENSOR, + HRM_RAW_SENSOR, + BIO_SENSOR = HRM_RAW_SENSOR, TILT_SENSOR, RV_RAW_SENSOR, + + ACTIVITY_STATIONARY_SENSOR = 0x1100, + ACTIVITY_WALK_SENSOR, + ACTIVITY_RUN_SENSOR, + ACTIVITY_IN_VEHICLE_SENSOR, + ACTIVITY_ON_BICYCLE_SENSOR, + + GESTURE_MOVEMENT_SENSOR = 0x1200, + GESTURE_WRIST_UP_SENSOR, + GESTURE_WRIST_DOWN_SENSOR, } sensor_type_t; // Sensor Event Types @@ -112,7 +117,7 @@ enum event_types_t { BIO_LED_RED_RAW_DATA_EVENT = (BIO_LED_RED_SENSOR << 16) | 0x0001, - GAMING_RV_RAW_DATA_EVENT = (GAMING_RV_SENSOR << 16) | 0x0001, + GAMING_RV_RAW_DATA_EVENT = (GYROSCOPE_RV_SENSOR << 16) | 0x0001, GEOMAGNETIC_RV_RAW_DATA_EVENT = (GEOMAGNETIC_RV_SENSOR << 16) | 0x0001, @@ -262,4 +267,6 @@ enum motion_property_id { } #endif +#include + #endif /* _SENSOR_TYPES_H_ */ diff --git a/src/test/src/check-sensor.c b/src/test/src/check-sensor.c index 0475880..d9cd3ba 100644 --- a/src/test/src/check-sensor.c +++ b/src/test/src/check-sensor.c @@ -80,7 +80,7 @@ void printpollinglogs(sensor_type_t type,sensor_data_t data) case(GEOMAGNETIC_RV_SENSOR): printf("Geomagnetic Rv [%lld] [%6.6f] [%6.6f] [%6.6f] [%6.6f]\n\n", data.timestamp, data.values[0], data.values[1], data.values[2], data.values[3]); break; - case(GAMING_RV_SENSOR): + case(GYROSCOPE_RV_SENSOR): printf("Gaming Rv [%lld] [%6.6f] [%6.6f] [%6.6f] [%6.6f]\n\n", data.timestamp, data.values[0], data.values[1], data.values[2], data.values[3]); break; case(GYROSCOPE_UNCAL_SENSOR): @@ -158,7 +158,7 @@ int get_event(sensor_type_t sensor_type, char str[]) if (strcmp(str, "RAW_DATA_EVENT") == 0) return GEOMAGNETIC_RV_RAW_DATA_EVENT; break; - case GAMING_RV_SENSOR: + case GYROSCOPE_RV_SENSOR: if (strcmp(str, "RAW_DATA_EVENT") == 0) return GAMING_RV_RAW_DATA_EVENT; break; @@ -226,7 +226,7 @@ void callback(sensor_t sensor, unsigned int event_type, sensor_data_t *data, voi case GEOMAGNETIC_RV_SENSOR: printf("Geomagnetic RV [%lld] [%6.6f] [%6.6f] [%6.6f] [%6.6f]\n", data->timestamp, data->values[0], data->values[1], data->values[2], data->values[3]); break; - case GAMING_RV_SENSOR: + case GYROSCOPE_RV_SENSOR: printf("Gaming RV [%lld] [%6.6f] [%6.6f] [%6.6f] [%6.6f]\n", data->timestamp, data->values[0], data->values[1], data->values[2], data->values[3]); break; case GYROSCOPE_UNCAL_SENSOR: diff --git a/src/test/src/sensor-test.c b/src/test/src/sensor-test.c index 82d27fa..9f5310f 100644 --- a/src/test/src/sensor-test.c +++ b/src/test/src/sensor-test.c @@ -125,7 +125,7 @@ int main(int argc, char **argv) event = GEOMAGNETIC_RV_RAW_DATA_EVENT; } else if (strcmp(argv[1], "gaming_rv") == 0) { - sensor_type = GAMING_RV_SENSOR; + sensor_type = GYROSCOPE_RV_SENSOR; event = GAMING_RV_RAW_DATA_EVENT; } else if (strcmp(argv[1], "light") == 0) { -- 2.7.4 From 672dffa735835a38540fe397675f47c9819e1388 Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Wed, 2 Mar 2016 23:38:31 +0900 Subject: [PATCH 16/16] sensord: lazy loading atexit() because static variables is used in atexit() - if atexit() is called before the declaration of static variables, they can be released while the registered callback is processing. - so atexit() function has to be called lazily. Change-Id: I2feef2013d01470559ad51f8712fbd8ea9f2ae02 Signed-off-by: kibak.yoon --- src/client/client.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/client/client.cpp b/src/client/client.cpp index 96a3e95..3ab4146 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -56,14 +56,14 @@ public: { sensor_event_listener::get_instance().set_hup_observer(restore_session); } - - ~initiator() - { - _D("Good bye! %s\n", get_client_name()); - clean_up(); - } }; +void good_bye(void) +{ + _I("Good bye! %s\n", get_client_name()); + clean_up(); +} + static initiator g_initiator; static int g_power_save_state_cb_cnt = 0; @@ -540,6 +540,9 @@ API int sensord_connect(sensor_t sensor) sensor_registered = sensor_client_info::get_instance().is_sensor_registered(sensor_id); + // lazy loading after creating static variables + atexit(good_bye); + handle = sensor_client_info::get_instance().create_handle(sensor_id); if (handle == MAX_HANDLE_REACHED) { _E("Maximum number of handles reached, sensor: %s in client %s", get_sensor_name(sensor_id), get_client_name()); -- 2.7.4