Change "get_attribute" to get the value directly in HAL 67/268367/1 accepted/tizen/6.5/unified/20211223.131303 submit/tizen_6.5/20211222.080028
authortaemin.yeom <taemin.yeom@samsung.com>
Fri, 17 Dec 2021 10:22:46 +0000 (19:22 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Wed, 22 Dec 2021 01:16:00 +0000 (01:16 +0000)
Change-Id: Ia013be56ba7bcd1feffcf24cd44d06ffffbfdfd3
Signed-off-by: taemin.yeom <taemin.yeom@samsung.com>
(cherry picked from commit df2a76fd31b02912ddb4abdb22ea183967c1d734)

src/server/physical_sensor_handler.cpp
src/server/physical_sensor_handler.h

index d32efe8..6808c6b 100644 (file)
@@ -314,6 +314,28 @@ int physical_sensor_handler::set_attribute(sensor_observer *ob, int32_t attr, co
        return (ret ? OP_SUCCESS : OP_ERROR);
 }
 
+int physical_sensor_handler::get_attribute(int32_t attr, int32_t *value)
+{
+       retv_if(!m_device, -EINVAL);
+
+       bool ret = false;
+       int policy = OP_DEFAULT;
+
+       ret = m_device->get_attribute_int(m_hal_id, attr, value);
+       return (ret ? OP_SUCCESS : OP_ERROR);
+}
+
+int physical_sensor_handler::get_attribute(int32_t attr, char **value, int *len)
+{
+       retv_if(!m_device, -EINVAL);
+
+       bool ret = false;
+       int policy = OP_DEFAULT;
+
+       ret = m_device->get_attribute_str(m_hal_id, attr, value, len);
+       return (ret ? OP_SUCCESS : OP_ERROR);
+}
+
 int physical_sensor_handler::flush(sensor_observer *ob)
 {
        retv_if(!m_device, -EINVAL);
index 0fca0fe..6743604 100644 (file)
@@ -57,6 +57,8 @@ public:
        int delete_batch_latency(sensor_observer *ob);
        int set_attribute(sensor_observer *ob, int32_t attr, int32_t value);
        int set_attribute(sensor_observer *ob, int32_t attr, const char *value, int len);
+       int get_attribute(int32_t attr, int32_t *value);
+       int get_attribute(int32_t attr, char **value, int *len);
        int flush(sensor_observer *ob);
        int get_data(sensor_data_t **data, int *len);