Remove unused sensorhub code 43/260143/1 submit/tizen/20210621.095917
authorYunmi Ha <yunmi.ha@samsung.com>
Mon, 21 Jun 2021 06:51:14 +0000 (15:51 +0900)
committerYunmi Ha <yunmi.ha@samsung.com>
Mon, 21 Jun 2021 06:51:14 +0000 (15:51 +0900)
Change-Id: Ibf0091280e4f743c70dd5d9275c50c4b40d104f9
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
17 files changed:
CMakeLists.txt
src/hal-backend-sensor.cpp
src/sensorhub/dbus_util.cpp [deleted file]
src/sensorhub/dbus_util.h [deleted file]
src/sensorhub/sensorhub.cpp [deleted file]
src/sensorhub/sensorhub.h [deleted file]
src/sensorhub/sensorhub_controller.cpp [deleted file]
src/sensorhub/sensorhub_controller.h [deleted file]
src/sensorhub/sensorhub_manager.cpp [deleted file]
src/sensorhub/sensorhub_manager.h [deleted file]
src/sensorhub/sensorhub_sensor.cpp [deleted file]
src/sensorhub/sensorhub_sensor.h [deleted file]
src/sensorhub/system_state.cpp [deleted file]
src/sensorhub/system_state.h [deleted file]
src/sensorhub/wristup.cpp [deleted file]
src/sensorhub/wristup.h [deleted file]
testcase/sensor_device_haltest.cpp

index 1101ec2..70525e4 100755 (executable)
@@ -9,7 +9,6 @@ SET(DEPENDENTS "dlog hal-api-common hal-api-sensor")
 
 SET(ACCEL "ON")
 SET(PROXIMITY "ON")
-SET(SENSORHUB "OFF")
 
 # Common Options
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O2 -omit-frame-pointer -std=gnu++0x")
@@ -43,11 +42,6 @@ FILE(GLOB_RECURSE SRCS ${SRCS} src/proxi/*.cpp)
 ADD_DEFINITIONS(-DENABLE_PROXIMITY)
 ENDIF()
 
-IF("${SENSORHUB}" STREQUAL "ON")
-FILE(GLOB_RECURSE SRCS ${SRCS} src/sensorhub/*.cpp)
-ADD_DEFINITIONS(-DENABLE_SENSORHUB)
-ENDIF()
-
 MESSAGE("Sources: ${SRCS}")
 ADD_LIBRARY(${LIBRARY_NAME} SHARED ${SRCS})
 TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${HAL_PKGS_LDFLAGS})
index f9ffc13..c6d1f8c 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "accel/accel_device.h"
 #include "proxi/proxi_device.h"
-#include "sensorhub/sensorhub.h"
 
 static std::vector<sensor_device_t> devs;
 
@@ -51,9 +50,6 @@ static int sensor_tm1_create(sensor_device_t **devices) {
 #ifdef ENABLE_PROXIMITY
   create_sensor<proxi_device>("Proximity");
 #endif
-#ifdef ENABLE_SENSORHUB
-  create_sensor<sensorhub_device>("Sensorhub");
-#endif
   }
 
   *devices = &devs[0];
diff --git a/src/sensorhub/dbus_util.cpp b/src/sensorhub/dbus_util.cpp
deleted file mode 100644 (file)
index c617090..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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 <gio/gio.h>
-#include <sensor_log.h>
-#include "dbus_util.h"
-
-void init_dbus(void)
-{
-}
-
-void fini_dbus(void)
-{
-}
diff --git a/src/sensorhub/dbus_util.h b/src/sensorhub/dbus_util.h
deleted file mode 100644 (file)
index 39ac187..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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 _DBUS_UTIL_H_
-#define _DBUS_UTIL_H_
-
-void init_dbus(void);
-void fini_dbus(void);
-
-#endif /* _DBUS_UTIL_H_ */
diff --git a/src/sensorhub/sensorhub.cpp b/src/sensorhub/sensorhub.cpp
deleted file mode 100755 (executable)
index 0d61e7f..0000000
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * 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 <algorithm>
-#include <sensor_log.h>
-
-#include "sensorhub.h"
-#include "sensorhub_controller.h"
-#include "sensorhub_manager.h"
-#include "system_state.h"
-
-#define MAX_ID 0x3
-
-sensorhub_device::sensorhub_device()
-{
-       controller = &sensorhub_controller::get_instance();
-       if (!controller) {
-               ERR("Failed to allocated memory");
-               throw;
-       }
-
-       manager = &sensorhub_manager::get_instance();
-       if (!manager) {
-               ERR("Failed to allocated memory");
-               throw;
-       }
-       manager->set_controller(controller);
-       system_state_handler::get_instance().set_controller(controller);
-
-       INFO("sensorhub_device is created!");
-}
-
-sensorhub_device::~sensorhub_device()
-{
-       INFO("sensorhub_device is destroyed!");
-}
-
-int sensorhub_device::get_poll_fd(void)
-{
-       return controller->get_poll_fd();
-}
-
-int sensorhub_device::get_sensors(const sensor_info_t **sensors)
-{
-       int size;
-
-       retvm_if(sensors == NULL || sensors == nullptr, -EINVAL, "sensorhub_device:NULL interface");
-       size = manager->get_sensors(sensors);
-
-       return size;
-}
-
-bool sensorhub_device::enable(uint32_t id)
-{
-       system_state_handler::get_instance().initialize();
-       retvm_if(id == 0 || id > MAX_ID, false, "%s:Invalid ID Received", SENSOR_NAME);
-       controller->enable();
-       sensorhub_sensor *sensor = manager->get_sensor(id);
-
-       if (!sensor) {
-               ERR("Failed to enable sensor(0x%x)", id);
-               return false;
-       }
-
-       return sensor->enable();
-}
-
-bool sensorhub_device::disable(uint32_t id)
-{
-       system_state_handler::get_instance().finalize();
-       retvm_if(id == 0 || id > MAX_ID, false, "%s:Invalid ID Received", SENSOR_NAME);
-       controller->disable();
-       sensorhub_sensor *sensor = manager->get_sensor(id);
-
-       if (!sensor) {
-               ERR("Failed to disable sensor(0x%x)", id);
-               return false;
-       }
-
-       return sensor->disable();
-}
-
-bool sensorhub_device::set_interval(uint32_t id, unsigned long val)
-{
-       sensorhub_sensor *sensor = NULL;
-       retvm_if(id == 0 || id > MAX_ID, false, "%s:Invalid ID Received", SENSOR_NAME);
-       retvm_if(val < 0, false, "%s:Invalid value Received", SENSOR_NAME);
-       sensor = manager->get_sensor(id);
-       if (!sensor) {
-               ERR("Failed to set interval to sensor(0x%x)", id);
-               return false;
-       }
-
-       return sensor->set_interval(val);
-}
-
-bool sensorhub_device::set_batch_latency(uint32_t id, unsigned long val)
-{
-       sensorhub_sensor *sensor = NULL;
-       retvm_if(id == 0 || id > MAX_ID, false, "%s:Invalid ID Received", SENSOR_NAME);
-       sensor = manager->get_sensor(id);
-
-       if (!sensor) {
-               ERR("Failed to set batch latency to sensor(0x%x)", id);
-               return false;
-       }
-
-       return sensor->set_batch_latency(val);
-}
-
-bool sensorhub_device::set_attribute_int(uint32_t id, int32_t attribute, int32_t value)
-{
-       int ret;
-
-       sensorhub_sensor *sensor = NULL;
-       retvm_if(id == 0 || id > MAX_ID, false, "%s:Invalid ID Received", SENSOR_NAME);
-       retvm_if(value < 0, false, "%s:Invalid value Received", SENSOR_NAME);
-       retvm_if(attribute < 0, false, "%s:Invalid attribute Received", SENSOR_NAME);
-
-       sensor = manager->get_sensor(id);
-       if (!sensor) {
-               ERR("Failed to set attribute to sensor(0x%x)", id);
-               return false;
-       }
-
-       ret = sensor->set_attribute_int(attribute, value);
-
-       if ((ret < 0) && (ret != -EBUSY)) {
-               ERR("Failed to send sensorhub data");
-               return false;
-       }
-
-       if (ret == -EBUSY) {
-               WARN("Command is sent during sensorhub firmware update");
-               return false;
-       }
-
-       return true;
-}
-
-bool sensorhub_device::set_attribute_str(uint32_t id, int32_t attribute, char *value, int value_len)
-{
-       int ret;
-
-       sensorhub_sensor *sensor = NULL;
-       retvm_if(id == 0 || id > MAX_ID, false, "%s:Invalid ID Received", SENSOR_NAME);
-       retvm_if(value == NULL || value == nullptr, false, "%s:Invalid string Received", SENSOR_NAME);
-       retvm_if(value_len <= 0, false, "%s:Invalid value_len Received", SENSOR_NAME);
-       sensor = manager->get_sensor(id);
-
-       if (!sensor) {
-               ERR("Failed to set attribute to sensor(0x%x)", id);
-               return false;
-       }
-
-       ret = sensor->set_attribute_str(attribute, value, value_len);
-
-       if ((ret < 0) && (ret != -EBUSY)) {
-               ERR("Failed to send sensorhub data");
-               return false;
-       }
-
-       if (ret == -EBUSY) {
-               WARN("Command is sent during sensorhub firmware update");
-               return false;
-       }
-
-       return true;
-}
-
-int sensorhub_device::read_fd(uint32_t **ids)
-{
-       sensorhub_data_t data;
-       retvm_if(ids == NULL || ids == nullptr, -EINVAL, "%s:NULL interface", SENSOR_NAME);
-       // step 1
-       if (!controller->read_fd(data))
-               return 0;
-
-       // step 2
-       const char *hub_data = data.values;
-       int data_len = data.value_count;
-
-       // step 3
-       event_ids.clear();
-
-       while (data_len > 0) {
-               DBG("Remaining data length: %d", data_len);
-               int parsed = parse(hub_data, data_len);
-               if (parsed < 0) {
-                       ERR("Parsing failed");
-                       break;
-               }
-
-               data_len -= parsed;
-               hub_data += parsed;
-       }
-
-       // step 4
-       int size = event_ids.size();
-
-       if (event_ids.empty())
-               return 0;
-
-       *ids = &event_ids[0];
-
-       return size;
-}
-
-int sensorhub_device::get_data(uint32_t id, sensor_data_t **data, int *length)
-{
-       int remains = 1;
-       retvm_if(data == NULL || data == nullptr, -EINVAL, "%s:NULL data interface", SENSOR_NAME);
-       retvm_if(length == NULL || length == nullptr, -EINVAL, "%s:NULL length interface", SENSOR_NAME);
-       retvm_if(id == 0 || id > MAX_ID, -EINVAL, "%s:Invalid ID Received", SENSOR_NAME);
-
-       sensorhub_sensor *sensor = manager->get_sensor(id);
-       if (!sensor) {
-               ERR("Failed to get data from sensor(0x%x)", id);
-               return -1;
-       }
-
-       remains = sensor->get_data(data, length);
-
-       return remains;
-}
-
-bool sensorhub_device::flush(uint32_t id)
-{
-       return false;
-}
-
-int sensorhub_device::parse(const char *hub_data, int data_len)
-{
-       return parse_data(hub_data, data_len);
-}
-
-int sensorhub_device::parse_data(const char *hub_data, int data_len)
-{
-       const char *cursor = hub_data;
-       int32_t libtype = 0;
-
-       sensorhub_sensor *sensor = manager->get_sensor(libtype);
-       if (!sensor) {
-               ERR("Unknown Sensorhub lib type: %d", libtype);
-               return -1;
-       }
-
-       event_ids.push_back(sensor->get_id());
-
-       return sensor->parse(cursor, data_len);
-}
-
-int sensorhub_device::parse_debug(const char *hub_data, int data_len)
-{
-       return 0;
-}
-
diff --git a/src/sensorhub/sensorhub.h b/src/sensorhub/sensorhub.h
deleted file mode 100644 (file)
index 0af386c..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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 _SENSORHUB_DEVICE_H_
-#define _SENSORHUB_DEVICE_H_
-
-#include <vector>
-#include <hal/hal-sensor-types.h>
-
-#include "sensorhub_controller.h"
-#include "sensorhub_manager.h"
-
-class sensorhub_device : public sensor_device {
-public:
-       sensorhub_device();
-       virtual ~sensorhub_device();
-
-       int get_poll_fd(void);
-       int get_sensors(const sensor_info_t **sensors);
-
-       bool enable(uint32_t id);
-       bool disable(uint32_t id);
-
-       bool set_interval(uint32_t id, unsigned long val);
-       bool set_batch_latency(uint32_t id, unsigned long val);
-       bool set_attribute_int(uint32_t id, int32_t attribute, int32_t value);
-       bool set_attribute_str(uint32_t id, int32_t attribute, char *value, int value_len);
-
-       int read_fd(uint32_t **ids);
-       int get_data(uint32_t id, sensor_data_t **data, int *length);
-
-       bool flush(uint32_t id);
-
-private:
-       sensorhub_manager *manager;
-       sensorhub_controller *controller;
-       std::vector<uint32_t> event_ids;
-
-       int parse(const char *hub_data, int data_len);
-       int parse_data(const char *hub_data, int data_len);
-       int parse_debug(const char *hub_data, int data_len);
-};
-
-#endif /* _SENSORHUB_DEVICE_H_ */
diff --git a/src/sensorhub/sensorhub_controller.cpp b/src/sensorhub/sensorhub_controller.cpp
deleted file mode 100644 (file)
index d8ee72a..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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 <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <linux/input.h>
-#include <sys/ioctl.h>
-#include <fstream>
-
-#include <sensor_log.h>
-#include <util.h>
-#include "sensorhub_controller.h"
-
-sensorhub_controller::sensorhub_controller()
-: m_enabled(false)
-, m_poll_node(-1)
-, m_data_node(-1)
-{
-}
-
-sensorhub_controller::~sensorhub_controller()
-{
-}
-
-sensorhub_controller& sensorhub_controller::get_instance(void)
-{
-       static sensorhub_controller instance;
-       return instance;
-}
-
-int sensorhub_controller::get_poll_fd(void)
-{
-       return -1;
-}
-
-bool sensorhub_controller::enable(void)
-{
-       m_enabled = true;
-       INFO("Enable Sensorhub");
-       return true;
-}
-
-bool sensorhub_controller::disable(void)
-{
-       m_enabled = false;
-       INFO("Disable Sensorhub");
-       return true;
-}
-
-int sensorhub_controller::open_input_node(const char* input_node)
-{
-       return -1;
-}
-
-bool sensorhub_controller::read_fd(sensorhub_data_t &data)
-{
-       return false;
-}
-
-int sensorhub_controller::read_sensorhub_data(void)
-{
-       return -1;
-}
-
-int sensorhub_controller::read_large_sensorhub_data(void)
-{
-       return -1;
-}
-
-int sensorhub_controller::send_sensorhub_data(const char *data, int data_len)
-{
-       return -1;
-}
-
-int sensorhub_controller::print_sensorhub_data(const char* name, const char *data, int length)
-{
-       return 0;
-}
-
diff --git a/src/sensorhub/sensorhub_controller.h b/src/sensorhub/sensorhub_controller.h
deleted file mode 100644 (file)
index 6f44137..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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 _SENSORHUB_CONTROLLER_H_
-#define _SENSORHUB_CONTROLLER_H_
-
-#include <hal/hal-sensor-types.h>
-
-class sensorhub_controller {
-public:
-       static sensorhub_controller& get_instance();
-       virtual ~sensorhub_controller();
-
-       int open_input_node(const char* input_node);
-       int get_poll_fd(void);
-
-       bool enable(void);
-       bool disable(void);
-
-       bool read_fd(sensorhub_data_t &data);
-
-       int read_sensorhub_data(void);
-       int read_large_sensorhub_data(void);
-       int send_sensorhub_data(const char *data, int data_len);
-
-private:
-       sensorhub_controller();
-
-       bool m_enabled;
-       int m_poll_node;
-       int m_data_node;
-
-       int print_sensorhub_data(const char* name, const char *data, int length);
-};
-
-#endif /* _SENSORHUB_CONTROLLER_H_ */
diff --git a/src/sensorhub/sensorhub_manager.cpp b/src/sensorhub/sensorhub_manager.cpp
deleted file mode 100644 (file)
index 8620739..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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 "sensorhub_controller.h"
-#include "sensorhub_manager.h"
-#include "sensorhub_sensor.h"
-
-sensorhub_manager::sensorhub_manager()
-{
-}
-
-sensorhub_manager::~sensorhub_manager()
-{
-       for (auto &it : m_id_sensors)
-               delete it.second;
-
-       m_id_sensors.clear();
-       m_infos.clear();
-}
-
-sensorhub_manager& sensorhub_manager::get_instance() {
-       static sensorhub_manager instance;
-       return instance;
-}
-
-bool sensorhub_manager::add_sensor(sensor_info_t info, sensorhub_sensor *sensor)
-{
-       m_infos.push_back(info);
-       m_id_sensors[info.id] = sensor;
-
-       return true;
-}
-
-void sensorhub_manager::set_controller(sensorhub_controller *controller)
-{
-       for (auto const &it : m_id_sensors) {
-               sensorhub_sensor *sensor = it.second;
-               sensor->set_controller(controller);
-       }
-}
-
-sensorhub_sensor *sensorhub_manager::get_sensor(uint32_t id)
-{
-       return m_id_sensors[id];
-}
-
-int sensorhub_manager::get_sensors(const sensor_info_t **sensors)
-{
-       int size;
-
-       if (m_infos.empty()) {
-               *sensors = 0;
-               return 0;
-       }
-
-       size = m_infos.size();
-       *sensors = &m_infos[0];
-
-       return size;
-}
diff --git a/src/sensorhub/sensorhub_manager.h b/src/sensorhub/sensorhub_manager.h
deleted file mode 100644 (file)
index 6ee16a2..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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 _SENSORHUB_MANAGER_H_
-#define _SENSORHUB_MANAGER_H_
-
-#include <map>
-#include <vector>
-#include <sensor_log.h>
-
-#include "sensorhub_controller.h"
-#include "sensorhub_sensor.h"
-
-#define REGISTER_SENSORHUB_LIB(info, sensor_class) \
-       static sensor_initializer<sensor_class> initializer((info)); \
-
-class sensorhub_manager {
-public:
-       static sensorhub_manager& get_instance();
-       virtual ~sensorhub_manager();
-
-       sensorhub_sensor *get_sensor(uint32_t id);
-       int get_sensors(const sensor_info_t **sensors);
-
-       void set_controller(sensorhub_controller *controller);
-       bool add_sensor(sensor_info_t info, sensorhub_sensor *sensor);
-private:
-       sensorhub_manager();
-
-       std::map<char, sensorhub_sensor *> m_id_sensors;
-       std::vector<sensor_info_t> m_infos;
-};
-
-template <typename T>
-class sensor_initializer {
-public:
-       sensor_initializer(sensor_info_t info)
-       {
-               T *sensor = new(std::nothrow) T();
-               if (!sensor) {
-                       ERR("Failed to allocate memory");
-                       return;
-               }
-               sensorhub_manager::get_instance().add_sensor(info, sensor);
-       }
-       ~sensor_initializer() {}
-};
-
-#endif /* _SENSORHUB_MANAGER_H_ */
diff --git a/src/sensorhub/sensorhub_sensor.cpp b/src/sensorhub/sensorhub_sensor.cpp
deleted file mode 100644 (file)
index 528f4c6..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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 <sensor_log.h>
-#include <time.h>
-#include "sensorhub_controller.h"
-#include "sensorhub_sensor.h"
-
-void sensorhub_sensor::set_controller(sensorhub_controller *controller)
-{
-       m_controller = controller;
-}
-
-bool sensorhub_sensor::set_interval(unsigned long val)
-{
-       return false;
-}
-
-bool sensorhub_sensor::set_batch_latency(unsigned long val)
-{
-       return false;
-}
-
-bool sensorhub_sensor::set_attribute_int(int32_t attribute, int32_t value)
-{
-       return false;
-}
-
-bool sensorhub_sensor::set_attribute_str(int32_t attribute, char *value, int value_len)
-{
-       return false;
-}
-
-bool sensorhub_sensor::flush(void)
-{
-       return false;
-}
-
-unsigned long long sensorhub_sensor::get_timestamp(void)
-{
-       struct timespec t;
-       clock_gettime(CLOCK_REALTIME, &t);
-       return ((unsigned long long)(t.tv_sec)*1000000000LL + t.tv_nsec) / 1000;
-}
-
diff --git a/src/sensorhub/sensorhub_sensor.h b/src/sensorhub/sensorhub_sensor.h
deleted file mode 100644 (file)
index 552a792..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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 _SENSORHUB_SENSOR_H_
-#define _SENSORHUB_SENSOR_H_
-
-class sensorhub_sensor {
-public:
-       sensorhub_sensor() {}
-       virtual ~sensorhub_sensor() {}
-
-       virtual int32_t get_id(void) = 0;
-
-       virtual bool enable(void) = 0;
-       virtual bool disable(void) = 0;
-       virtual int parse(const char *hub_data, int data_len) = 0;
-       virtual int get_data(sensor_data_t **data, int *length) = 0;
-
-       void set_controller(sensorhub_controller *controller);
-
-       virtual bool set_interval(unsigned long val);
-       virtual bool set_batch_latency(unsigned long val);
-       virtual bool set_attribute_int(int32_t attribute, int32_t value);
-       virtual bool set_attribute_str(int32_t key, char *value, int value_len);
-
-       virtual bool flush(void);
-protected:
-       sensorhub_controller *m_controller;
-
-       unsigned long long get_timestamp(void);
-};
-
-#endif /* _SENSORHUB_SENSOR_H_ */
diff --git a/src/sensorhub/system_state.cpp b/src/sensorhub/system_state.cpp
deleted file mode 100644 (file)
index e3eb041..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * 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 <sensor_log.h>
-#include "dbus_util.h"
-#include "system_state.h"
-
-system_state_handler::system_state_handler()
-{
-}
-
-system_state_handler::~system_state_handler()
-{
-       INFO("system_state_handler is destroyed!\n");
-}
-
-system_state_handler& system_state_handler::get_instance()
-{
-       static system_state_handler instance;
-       return instance;
-}
-
-void system_state_handler::set_controller(sensorhub_controller *controller)
-{
-       m_controller = controller;
-}
-
-bool system_state_handler::initialize()
-{
-       return true;
-}
-
-void system_state_handler::finalize(void)
-{
-}
-
-void system_state_handler::set_poweroff_state(void)
-{
-}
-
-void system_state_handler::display_signal_handler(GDBusConnection *conn,
-               const gchar *name, const gchar *path, const gchar *interface,
-               const gchar *sig, GVariant *param, gpointer user_data)
-{
-}
-
-bool system_state_handler::start_listen_display_state()
-{
-       return true;
-}
-
-void system_state_handler::stop_listen_display_state()
-{
-}
-
-void system_state_handler::poweroff_signal_handler(GDBusConnection *conn, const gchar *name, const gchar *path, const gchar *interface,
-               const gchar *sig, GVariant *param, gpointer user_data)
-{
-}
-
-bool system_state_handler::start_listen_poweroff_state(void)
-{
-       return true;
-}
-
-void system_state_handler::stop_listen_poweroff_state(void)
-{
-}
-
-void system_state_handler::charger_state_cb(keynode_t *node, void *user_data)
-{
-}
-
-bool system_state_handler::is_display_on(void)
-{
-       return true;
-}
-
-bool system_state_handler::inform_display_state(bool display_on)
-{
-       return inform_display_state();
-}
-
-bool system_state_handler::inform_display_state()
-{
-       return true;
-}
-
-bool system_state_handler::is_charger_connected(void)
-{
-       return false;
-}
-
-bool system_state_handler::is_powering_off()
-{
-       return false;
-}
-
-bool system_state_handler::inform_charger_state()
-{
-       return true;
-}
-
-bool system_state_handler::inform_ssp_sleep(void)
-{
-       return true;
-}
-
-bool system_state_handler::inform_ssp_wakeup(void)
-{
-       return true;
-}
-
-bool system_state_handler::inform_current_time(void)
-{
-       return true;
-}
-
-void system_state_handler::request_display_lock(int msec)
-{
-       return;
-}
-
-void system_state_handler::request_display_wakeup()
-{
-       return;
-}
diff --git a/src/sensorhub/system_state.h b/src/sensorhub/system_state.h
deleted file mode 100755 (executable)
index 025955d..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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 _SYSTEM_STATE_HANDLER_H_
-#define _SYSTEM_STATE_HANDLER_H_
-
-#include <glib.h>
-#include <vconf.h>
-#include <gio/gio.h>
-
-#include "sensorhub_controller.h"
-
-class system_state_handler {
-private:
-       system_state_handler();
-       ~system_state_handler();
-
-       void set_poweroff_state(void);
-
-       bool start_listen_display_state(void);
-       bool start_listen_poweroff_state(void);
-       void stop_listen_display_state(void);
-       void stop_listen_poweroff_state(void);
-
-       bool inform_display_state(bool display_on);
-       bool inform_display_state(void);
-       bool inform_ssp_sleep(void);
-       bool inform_ssp_wakeup(void);
-
-       static void display_signal_handler(GDBusConnection *conn, const gchar *name, const gchar *path, const gchar *interface,
-               const gchar *sig, GVariant *param, gpointer user_data);
-
-       static void poweroff_signal_handler(GDBusConnection *conn, const gchar *name, const gchar *path, const gchar *interface,
-               const gchar *sig, GVariant *param, gpointer user_data);
-
-       static void display_state_cb(keynode_t *node, void *user_data);
-       static void charger_state_cb(keynode_t *node, void *user_data);
-       static void sleep_state_cb(keynode_t *node, void *user_data);
-
-       sensorhub_controller *m_controller;
-
-public:
-       void set_controller(sensorhub_controller *controller);
-       bool initialize(void);
-       void finalize(void);
-
-       bool is_display_on(void);
-       bool is_charger_connected(void);
-       bool is_powering_off(void);
-
-       bool inform_charger_state(void);
-       bool inform_current_time(void);
-       void request_display_lock(int msec);
-       void request_display_wakeup(void);
-
-       static system_state_handler& get_instance(void);
-};
-
-#endif
diff --git a/src/sensorhub/wristup.cpp b/src/sensorhub/wristup.cpp
deleted file mode 100644 (file)
index f3a2b81..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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 <algorithm>
-#include <hal/hal-sensor-types.h>
-#include <sensor_log.h>
-
-#include "sensorhub_manager.h"
-#include "system_state.h"
-#include "wristup.h"
-
-#define WRIST_UP_NAME "WRIST_UP_SENSOR"
-#define SHUB_LIB_WRIST_UP      0
-#define WRIST_UP_PACKET_SIZE   1
-
-static const sensor_info_t sensor_info = {
-       id: SHUB_LIB_WRIST_UP,
-       name: WRIST_UP_NAME,
-       type: SENSOR_DEVICE_GESTURE_WRIST_UP,
-       event_type: (SENSOR_DEVICE_GESTURE_WRIST_UP << 16) | 0x0001,
-       model_name: "Wristup",
-       vendor: "Samsung Electronics",
-       min_range: 0,
-       max_range: 1,
-       resolution: 1,
-       min_interval: 0,
-       max_batch_count: 0,
-       wakeup_supported: true
-};
-
-wristup_sensor::wristup_sensor()
-{
-}
-
-wristup_sensor::~wristup_sensor()
-{
-       INFO("wristup_sensor is destroyed!");
-}
-
-int32_t wristup_sensor::get_id(void)
-{
-       return sensor_info.id;
-}
-
-bool wristup_sensor::enable(void)
-{
-       return false;
-}
-
-bool wristup_sensor::disable(void)
-{
-       return false;
-}
-
-int wristup_sensor::parse(const char *data, int data_len)
-{
-       return WRIST_UP_PACKET_SIZE;
-}
-
-int wristup_sensor::get_data(sensor_data_t **data, int *length)
-{
-       return -1;
-}
-
-bool wristup_sensor::set_attribute_int(int32_t attribute, int32_t value)
-{
-       return false;
-}
-
-bool wristup_sensor::set_attribute_str(int32_t attribute, char *value, int value_len)
-{
-       return false;
-}
-
-REGISTER_SENSORHUB_LIB(sensor_info, wristup_sensor)
diff --git a/src/sensorhub/wristup.h b/src/sensorhub/wristup.h
deleted file mode 100644 (file)
index d05f0b4..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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 _WRISTUP_SENSOR_H_
-#define _WRISTUP_SENSOR_H_
-
-#include "sensorhub_sensor.h"
-
-class wristup_sensor : public sensorhub_sensor {
-public:
-       wristup_sensor();
-       virtual ~wristup_sensor();
-
-       int32_t get_id(void);
-
-       bool enable(void);
-       bool disable(void);
-
-       int parse(const char *data, int data_len);
-       int get_data(sensor_data_t **data, int *length);
-
-       bool set_attribute_int(int32_t attribute, int32_t value);
-       bool set_attribute_str(int32_t attribute, char *value, int value_len);
-
-private:
-       sensorhub_data_t m_data;
-};
-
-#endif /* _WRISTUP_SENSOR_H_ */
index dfca4f9..4e516ce 100755 (executable)
@@ -24,7 +24,6 @@
 
 #include <accel/accel_device.h>
 #include <proxi/proxi_device.h>
-#include <sensorhub/sensorhub.h>
 #include "sensor_common.h"
 
 using namespace std;
@@ -117,45 +116,6 @@ public:
 
 
 
-#ifdef SENSORHUB
-
-/*
- * sensorhub device test class
- */
-class SensorHubHalTest : public testing::Test
-{
-public:
-       int ret;
-       bool sensor_supported;
-       sensor_device *sensor_handle = NULL;
-
-public:
-       virtual void SetUp()
-       {
-               sensor_supported = false;
-               sensor_handle = new sensorhub_device;
-               if (sensor_handle == NULL) {
-                       cout << "Sensorhub sensor init failed " << endl;
-                       return;
-               }
-               sensor_supported = true;
-       }
-       virtual void TearDown()
-       {
-               if(sensor_handle) {
-                         delete sensor_handle;
-                         sensor_handle = NULL;
-               }
-               sensor_supported = false;
-       }
-       /*int GetSupportedFormat(int index)
-       {
-               return 0;
-       }*/
-};
-
-#endif
-
 /**
  * @testcase           get_poll_fdP
  * @since_tizen                4.0