sensord: change an input value name of set_attribute function 88/89188/1
authorhs81.go <hs81.go@samsung.com>
Thu, 1 Sep 2016 06:20:22 +0000 (15:20 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Thu, 22 Sep 2016 13:09:38 +0000 (22:09 +0900)
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 <hs81.go@samsung.com>
src/client/client.cpp
src/client/command_channel.cpp
src/client/command_channel.h
src/client/sensor_internal.h
src/hal/sensor_hal.h
src/server/command_worker.cpp
src/server/physical_sensor.cpp
src/server/physical_sensor.h
src/shared/command_common.h

index b01b607..0f69a1d 100644 (file)
@@ -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;
                        }
                }
index 39c3d4d..319c960 100644 (file)
@@ -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]",
index 2dd3589..0a9cbc4 100644 (file)
@@ -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:
index 3cc6641..47452d4 100644 (file)
@@ -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
index e557687..d90053c 100644 (file)
@@ -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;
        }
index f3fd9e9..d978481 100644 (file)
@@ -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))
index 96cb7f0..fc16b7b 100644 (file)
@@ -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;
index 3db1791..1264931 100644 (file)
@@ -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);
index 2afb3bd..47c47b1 100644 (file)
@@ -132,7 +132,7 @@ typedef struct  {
 
 typedef struct  {
        int attribute;
-       int value_len;
+       int len;
        char value[0];
 } cmd_set_attribute_str_t;