sensor-hal: rename sensor_handle_t to sensor_info_t 03/59403/2
authorkibak.yoon <kibak.yoon@samsung.com>
Mon, 15 Feb 2016 09:49:45 +0000 (18:49 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Mon, 15 Feb 2016 09:57:03 +0000 (18:57 +0900)
Change-Id: I6df3bd8701794d5964d8330ac219d4abe7c47bc7
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
src/accel/accel.cpp
src/accel/accel.h
src/proxi/proxi.cpp
src/proxi/proxi.h
src/sensorhub/sensorhub.cpp
src/sensorhub/sensorhub.h
src/sensorhub/sensorhub_manager.cpp
src/sensorhub/sensorhub_manager.h
src/sensorhub/sensorhub_sensor.h
src/sensorhub/wristup.cpp
src/sensorhub/wristup.h

index f01b7fe..6466c24 100644 (file)
@@ -42,7 +42,7 @@
 
 #define SENSORHUB_ACCELEROMETER_ENABLE_BIT 0
 
-static const sensor_handle_t handle = {
+static const sensor_info_t sensor_info = {
        id: 0x1,
        name: "Accelerometer",
        type: SENSOR_DEVICE_ACCELEROMETER,
@@ -111,9 +111,9 @@ int accel_device::get_poll_fd()
        return m_node_handle;
 }
 
-int accel_device::get_sensors(const sensor_handle_t **sensors)
+int accel_device::get_sensors(const sensor_info_t **sensors)
 {
-       *sensors = &handle;
+       *sensors = &sensor_info;
 
        return 1;
 }
@@ -245,7 +245,7 @@ int accel_device::read_fd(uint32_t **ids)
        }
 
        event_ids.clear();
-       event_ids.push_back(handle.id);
+       event_ids.push_back(sensor_info.id);
 
        *ids = &event_ids[0];
 
index b5259ce..3ec31d5 100644 (file)
@@ -28,7 +28,7 @@ public:
        virtual ~accel_device();
 
        int get_poll_fd(void);
-       int get_sensors(const sensor_handle_t **sensors);
+       int get_sensors(const sensor_info_t **sensors);
 
        bool enable(uint32_t id);
        bool disable(uint32_t id);
index 6ee63eb..226cdad 100644 (file)
@@ -35,7 +35,7 @@
 
 #define SENSORHUB_PROXIMITY_ENABLE_BIT 7
 
-static const sensor_handle_t handle = {
+static const sensor_info_t sensor_info = {
        id: 0x1,
        name: "Proximity Sensor",
        type: SENSOR_DEVICE_PROXIMITY,
@@ -100,9 +100,9 @@ int proxi_device::get_poll_fd()
        return m_node_handle;
 }
 
-int proxi_device::get_sensors(const sensor_handle_t **sensors)
+int proxi_device::get_sensors(const sensor_info_t **sensors)
 {
-       *sensors = &handle;
+       *sensors = &sensor_info;
 
        return 1;
 }
@@ -176,7 +176,7 @@ int proxi_device::read_fd(uint32_t **ids)
        }
 
        event_ids.clear();
-       event_ids.push_back(handle.id);
+       event_ids.push_back(sensor_info.id);
 
        *ids = &event_ids[0];
 
index 488cf27..47da309 100644 (file)
@@ -29,7 +29,7 @@ public:
        virtual ~proxi_device();
 
        int get_poll_fd(void);
-       int get_sensors(const sensor_handle_t **sensors);
+       int get_sensors(const sensor_info_t **sensors);
 
        bool enable(uint32_t id);
        bool disable(uint32_t id);
index 4e2faeb..f9b335d 100644 (file)
@@ -52,7 +52,7 @@ int sensorhub_device::get_poll_fd(void)
        return controller->get_poll_fd();
 }
 
-int sensorhub_device::get_sensors(const sensor_handle_t **sensors)
+int sensorhub_device::get_sensors(const sensor_info_t **sensors)
 {
        int size;
        size = manager->get_sensors(sensors);
index 02dadb6..3a5bbcc 100644 (file)
@@ -30,7 +30,7 @@ public:
        virtual ~sensorhub_device();
 
        int get_poll_fd(void);
-       int get_sensors(const sensor_handle_t **sensors);
+       int get_sensors(const sensor_info_t **sensors);
 
        bool enable(uint32_t id);
        bool disable(uint32_t id);
index fd39330..8620739 100644 (file)
@@ -29,7 +29,7 @@ sensorhub_manager::~sensorhub_manager()
                delete it.second;
 
        m_id_sensors.clear();
-       m_handles.clear();
+       m_infos.clear();
 }
 
 sensorhub_manager& sensorhub_manager::get_instance() {
@@ -37,10 +37,10 @@ sensorhub_manager& sensorhub_manager::get_instance() {
        return instance;
 }
 
-bool sensorhub_manager::add_sensor(sensor_handle_t handle, sensorhub_sensor *sensor)
+bool sensorhub_manager::add_sensor(sensor_info_t info, sensorhub_sensor *sensor)
 {
-       m_handles.push_back(handle);
-       m_id_sensors[handle.id] = sensor;
+       m_infos.push_back(info);
+       m_id_sensors[info.id] = sensor;
 
        return true;
 }
@@ -58,17 +58,17 @@ sensorhub_sensor *sensorhub_manager::get_sensor(uint32_t id)
        return m_id_sensors[id];
 }
 
-int sensorhub_manager::get_sensors(const sensor_handle_t **sensors)
+int sensorhub_manager::get_sensors(const sensor_info_t **sensors)
 {
        int size;
 
-       if (m_handles.empty()) {
+       if (m_infos.empty()) {
                *sensors = 0;
                return 0;
        }
 
-       size = m_handles.size();
-       *sensors = &m_handles[0];
+       size = m_infos.size();
+       *sensors = &m_infos[0];
 
        return size;
 }
index 9737120..8d3a38f 100644 (file)
@@ -25,8 +25,8 @@
 #include "sensorhub_controller.h"
 #include "sensorhub_sensor.h"
 
-#define REGISTER_SENSORHUB_LIB(handle, sensor_class) \
-       static sensor_initializer<sensor_class> initializer((handle)); \
+#define REGISTER_SENSORHUB_LIB(info, sensor_class) \
+       static sensor_initializer<sensor_class> initializer((info)); \
 
 class sensorhub_manager {
 public:
@@ -34,28 +34,28 @@ public:
        virtual ~sensorhub_manager();
 
        sensorhub_sensor *get_sensor(uint32_t id);
-       int get_sensors(const sensor_handle_t **sensors);
+       int get_sensors(const sensor_info_t **sensors);
 
        void set_controller(sensorhub_controller *controller);
-       bool add_sensor(sensor_handle_t handle, sensorhub_sensor *sensor);
+       bool add_sensor(sensor_info_t info, sensorhub_sensor *sensor);
 private:
        sensorhub_manager();
 
        std::map<char, sensorhub_sensor *> m_id_sensors;
-       std::vector<sensor_handle_t> m_handles;
+       std::vector<sensor_info_t> m_infos;
 };
 
 template <typename T>
 class sensor_initializer {
 public:
-       sensor_initializer(sensor_handle_t handle)
+       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(handle, sensor);
+               sensorhub_manager::get_instance().add_sensor(info, sensor);
        }
        ~sensor_initializer() {}
 };
index aa500b5..552a792 100644 (file)
@@ -23,7 +23,7 @@ public:
        sensorhub_sensor() {}
        virtual ~sensorhub_sensor() {}
 
-       virtual int16_t get_id(void) = 0;
+       virtual int32_t get_id(void) = 0;
 
        virtual bool enable(void) = 0;
        virtual bool disable(void) = 0;
index 9a994d5..346f807 100644 (file)
@@ -27,7 +27,7 @@
 #define SHUB_LIB_WRIST_UP      0
 #define WRIST_UP_PACKET_SIZE   1
 
-static const sensor_handle_t handle = {
+static const sensor_info_t sensor_info = {
        id: SHUB_LIB_WRIST_UP,
        name: WRIST_UP_NAME,
        type: SENSOR_DEVICE_GESTURE_WRIST_UP,
@@ -51,9 +51,9 @@ wristup_sensor::~wristup_sensor()
        INFO("wristup_sensor is destroyed!");
 }
 
-int16_t wristup_sensor::get_id(void)
+int32_t wristup_sensor::get_id(void)
 {
-       return handle.id;
+       return sensor_info.id;
 }
 
 bool wristup_sensor::enable(void)
@@ -86,4 +86,4 @@ bool wristup_sensor::set_attribute_str(int32_t attribute, char *value, int value
        return false;
 }
 
-REGISTER_SENSORHUB_LIB(handle, wristup_sensor)
+REGISTER_SENSORHUB_LIB(sensor_info, wristup_sensor)
index 42dbdc5..d05f0b4 100644 (file)
@@ -25,7 +25,7 @@ public:
        wristup_sensor();
        virtual ~wristup_sensor();
 
-       int16_t get_id(void);
+       int32_t get_id(void);
 
        bool enable(void);
        bool disable(void);