From: hs81.go Date: Thu, 1 Sep 2016 06:20:22 +0000 (+0900) Subject: sensord: change an input value name of set_attribute function X-Git-Tag: accepted/tizen/3.0/ivi/20161011.062327^2~4^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a73a1e0cb299ad881d878313637df1ab31a5ae59;p=platform%2Fcore%2Fsystem%2Fsensord.git sensord: change an input value name of set_attribute function because a name is not clear which is 'value_len' in set_attribute function so 'value_len' is changed to 'len'. Change-Id: I19caa23268e451653139c2b5f5c73af22edffe95 Signed-off-by: hs81.go --- diff --git a/src/client/client.cpp b/src/client/client.cpp index b01b607..0f69a1d 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -194,10 +194,10 @@ bool restore_attributes(int client_id, sensor_id_t sensor, command_channel *cmd_ for (auto it = info.attributes_str.begin(); it != info.attributes_str.end(); ++it) { int attribute = it->first; const char *value = it->second->get(); - int value_len = it->second->size(); - if (!cmd_channel->cmd_set_attribute_str(attribute, value, value_len)) { + int len = it->second->size(); + if (!cmd_channel->cmd_set_attribute_str(attribute, value, len)) { _E("Failed to send cmd_set_attribute_str(%d, %d, %s) for %s", - client_id, value_len, value, get_client_name()); + client_id, len, value, get_client_name()); return false; } } diff --git a/src/client/command_channel.cpp b/src/client/command_channel.cpp index 39c3d4d..319c960 100644 --- a/src/client/command_channel.cpp +++ b/src/client/command_channel.cpp @@ -639,24 +639,24 @@ bool command_channel::cmd_set_attribute_int(int attribute, int value) return true; } -bool command_channel::cmd_set_attribute_str(int attribute, const char* value, int value_len) +bool command_channel::cmd_set_attribute_str(int attribute, const char* value, int len) { cpacket *packet; cmd_set_attribute_str_t *cmd_set_attribute_str; cmd_done_t *cmd_done; - packet = new(std::nothrow) cpacket(sizeof(cmd_set_attribute_str_t) + value_len); + packet = new(std::nothrow) cpacket(sizeof(cmd_set_attribute_str_t) + len); retvm_if(!packet, false, "Failed to allocate memory"); packet->set_cmd(CMD_SET_ATTRIBUTE_STR); cmd_set_attribute_str = (cmd_set_attribute_str_t*)packet->data(); cmd_set_attribute_str->attribute = attribute; - cmd_set_attribute_str->value_len = value_len; - memcpy(cmd_set_attribute_str->value, value, value_len); + cmd_set_attribute_str->len = len; + memcpy(cmd_set_attribute_str->value, value, len); _I("%s send cmd_set_attribute_str(client_id=%d, attribute = %#x, value_len = %d, value = %#x)", - get_client_name(), m_client_id, attribute, value_len, value); + get_client_name(), m_client_id, attribute, len, value); if (!command_handler(packet, (void **)&cmd_done)) { _E("%s failed to send/receive command with client_id [%d]", diff --git a/src/client/command_channel.h b/src/client/command_channel.h index 2dd3589..0a9cbc4 100644 --- a/src/client/command_channel.h +++ b/src/client/command_channel.h @@ -48,7 +48,7 @@ public: bool cmd_unset_batch(void); bool cmd_get_data(unsigned int type, sensor_data_t *values); bool cmd_set_attribute_int(int attribute, int value); - bool cmd_set_attribute_str(int attribute, const char *value, int value_len); + bool cmd_set_attribute_str(int attribute, const char *value, int len); bool cmd_flush(void); private: diff --git a/src/client/sensor_internal.h b/src/client/sensor_internal.h index 3cc6641..47452d4 100644 --- a/src/client/sensor_internal.h +++ b/src/client/sensor_internal.h @@ -349,7 +349,7 @@ int sensord_set_attribute_int(int handle, int attribute, int value); * @retval -EINVAL Invalid parameter * @retval -EPERM Operation not permitted */ -int sensord_set_attribute_str(int handle, int attribute, const char *value, int value_len); +int sensord_set_attribute_str(int handle, int attribute, const char *value, int len); /** * @brief Send data to sensorhub diff --git a/src/hal/sensor_hal.h b/src/hal/sensor_hal.h index e557687..d90053c 100644 --- a/src/hal/sensor_hal.h +++ b/src/hal/sensor_hal.h @@ -62,7 +62,7 @@ public: { return true; } - virtual bool set_attribute_str(uint32_t id, int32_t attribute, char *value, int value_len) + virtual bool set_attribute_str(uint32_t id, int32_t attribute, char *value, int len) { return true; } diff --git a/src/server/command_worker.cpp b/src/server/command_worker.cpp index f3fd9e9..d978481 100644 --- a/src/server/command_worker.cpp +++ b/src/server/command_worker.cpp @@ -786,7 +786,7 @@ bool command_worker::cmd_set_attribute_str(void *payload) goto out; } - ret_value = m_module->add_attribute(m_client_id, cmd->attribute, cmd->value, cmd->value_len); + ret_value = m_module->add_attribute(m_client_id, cmd->attribute, cmd->value, cmd->len); out: if (!send_cmd_done(ret_value)) diff --git a/src/server/physical_sensor.cpp b/src/server/physical_sensor.cpp index 96cb7f0..fc16b7b 100644 --- a/src/server/physical_sensor.cpp +++ b/src/server/physical_sensor.cpp @@ -165,14 +165,14 @@ int physical_sensor::set_attribute(int32_t attribute, int32_t value) return OP_SUCCESS; } -int physical_sensor::set_attribute(int32_t attribute, char *value, int value_len) +int physical_sensor::set_attribute(int32_t attribute, char *value, int len) { AUTOLOCK(m_mutex); if (!m_sensor_device) return OP_ERROR; - if (!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, len)) return OP_ERROR; return OP_SUCCESS; diff --git a/src/server/physical_sensor.h b/src/server/physical_sensor.h index 3db1791..1264931 100644 --- a/src/server/physical_sensor.h +++ b/src/server/physical_sensor.h @@ -55,7 +55,7 @@ protected: virtual bool on_start(void); virtual bool on_stop(void); virtual int set_attribute(int32_t attribute, int32_t value); - virtual int set_attribute(int32_t attribute, char *value, int value_len); + virtual int set_attribute(int32_t attribute, char *value, int len); virtual bool set_interval(unsigned long interval); virtual bool set_batch_latency(unsigned long latency); virtual bool get_sensor_info(sensor_info &info); diff --git a/src/shared/command_common.h b/src/shared/command_common.h index 2afb3bd..47c47b1 100644 --- a/src/shared/command_common.h +++ b/src/shared/command_common.h @@ -132,7 +132,7 @@ typedef struct { typedef struct { int attribute; - int value_len; + int len; char value[0]; } cmd_set_attribute_str_t;