-Add error handling when there is no data
-Change to clear sensor data cache after getting cache data
Change-Id: I5967fe57298e7f90b9493a0f9e56eaec8778efbf
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
(cherry picked from commit
192f18f3930bff141444a68af32239f62c1b0bb7)
m_cmd_channel->send_sync(msg);
m_cmd_channel->read_sync(reply);
+ if (reply.header()->err < 0) {
+ return OP_ERROR;
+ }
+
reply.disclose((char *)&buf, sizeof(buf));
int size = sizeof(sensor_data_t);
- if (buf.len > size || buf.len < 0) {
+ if (buf.len > size || buf.len <= 0) {
data->accuracy = -1;
data->value_count = 0;
- /* TODO: it should return OP_ERROR */
- return OP_SUCCESS;
+ return OP_ERROR;
}
memcpy(data, &buf.data, buf.len);
*len = size;
*data = (sensor_data_t *)temp;
+ m_sensor_data_cache.clear();
return 0;
}