sensord: fix the bug that set_attribute returns bool 61/59961/2
authorkibak.yoon <kibak.yoon@samsung.com>
Sat, 20 Feb 2016 10:10:00 +0000 (19:10 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Sat, 20 Feb 2016 11:04:45 +0000 (20:04 +0900)
Change-Id: I63e0683bcd2fbb0f207522ec4003b05081eb5fe5
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
src/server/physical_sensor.cpp

index e7c3516..0096e8e 100644 (file)
@@ -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)