sensord: rename sensor_handle_t to sensor_info_t 08/59408/1
authorkibak.yoon <kibak.yoon@samsung.com>
Mon, 15 Feb 2016 09:50:42 +0000 (18:50 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Mon, 15 Feb 2016 10:04:14 +0000 (19:04 +0900)
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
Change-Id: I276dcdee7cbe8011e572194c573d036dfaea8433

src/hal/sensor_hal.h
src/server/physical_sensor.cpp
src/server/physical_sensor.h
src/server/sensor_loader.cpp
src/server/sensor_loader.h

index ded1a90..9ae5c62 100644 (file)
@@ -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;
index b230e1c..e7c3516 100644 (file)
@@ -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<sensor_type_t>(m_handle->type);
+       return static_cast<sensor_type_t>(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;
 }
index 7722929..33378f6 100644 (file)
@@ -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;
 
index 4117970..cc7b533 100644 (file)
@@ -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<sensor_device *>(_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<typename _sensor>
 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<physical_sensor *>(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_base> 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;
 }
index d10d216..9585105 100644 (file)
@@ -38,7 +38,7 @@
 class sensor_base;
 
 typedef std::multimap<sensor_type_t, std::shared_ptr<sensor_base>> sensor_map_t;
-typedef std::map<const sensor_handle_t *, sensor_device *> sensor_device_map_t;
+typedef std::map<const sensor_info_t *, sensor_device *> sensor_device_map_t;
 
 class sensor_loader {
 private: