sensord: remove set/get API for the URI of sensor type 46/126546/2
authorkibak.yoon <kibak.yoon@samsung.com>
Mon, 24 Apr 2017 06:33:27 +0000 (15:33 +0900)
committerKibak Yoon <kibak.yoon@samsung.com>
Mon, 24 Apr 2017 07:16:29 +0000 (07:16 +0000)
- It doesn't necessary because it is already contained in the URI.

Change-Id: I3a360004441558a5498face4211c5512db68a1e9
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
src/server/application_sensor_handler.cpp
src/shared/sensor_info.cpp
src/shared/sensor_info.h

index 48e50bebb1f984717f21c52eb4a9080be4de65a5..10701561edda75d538ec094fd0588cbbda58178c 100644 (file)
@@ -35,8 +35,7 @@ application_sensor_handler::~application_sensor_handler()
 
 int application_sensor_handler::post(sensor_data_t *data, int len)
 {
-       std::string uri = m_info.get_type_uri();
-
+       std::string uri = m_info.get_uri();
        return notify(uri.c_str(), data, len);
 }
 
index 7ff31f4de4b46e291dbee79d0c69acd52795cd28..c2d95c36c212d729f037fb97c21600c3db8d5926 100644 (file)
@@ -30,7 +30,6 @@ using namespace sensor;
 
 sensor_info::sensor_info()
 : m_type(UNKNOWN_SENSOR)
-, m_type_uri(SENSOR_UNKNOWN_TYPE)
 , m_uri(SENSOR_UNKNOWN_NAME)
 , m_model(SENSOR_UNKNOWN_NAME)
 , m_vendor(SENSOR_UNKNOWN_NAME)
@@ -46,7 +45,6 @@ sensor_info::sensor_info()
 
 sensor_info::sensor_info(const sensor_info &info)
 : m_type(info.m_type)
-, m_type_uri(info.m_type_uri)
 , m_uri(info.m_uri)
 , m_model(info.m_model)
 , m_vendor(info.m_vendor)
@@ -63,13 +61,12 @@ sensor_info::sensor_info(const sensor_info &info)
 sensor_info::sensor_info(const sensor_info_t &info)
 {
        /* TODO: HAL should change name from single name to URI */
-       const char *type_uri = sensor::utils::get_uri((sensor_type_t)info.type);
-       std::string name(type_uri);
-       name.append("/").append(info.name);
+       const char *type = sensor::utils::get_uri((sensor_type_t)info.type);
+       std::string uri(type);
+       uri.append("/").append(info.name);
 
        set_type((sensor_type_t)info.type);
-       set_type_uri(type_uri);
-       set_uri(name.c_str());
+       set_uri(uri.c_str());
        set_model(info.model_name);
        set_vendor(info.vendor);
        set_min_range(info.min_range);
@@ -88,7 +85,6 @@ sensor_info::sensor_info(const sensor_info2_t &info)
        std::size_t found = uri.find_last_of("/\\");
 
        set_type(info.type);
-       set_type_uri(uri.substr(0, found).c_str());
        set_uri(uri.c_str());
        set_model(uri.substr(found + 1, uri.length()).c_str());
        set_vendor(info.vendor);
@@ -106,11 +102,6 @@ sensor_type_t sensor_info::get_type(void)
        return m_type;
 }
 
-std::string &sensor_info::get_type_uri(void)
-{
-       return m_type_uri;
-}
-
 std::string &sensor_info::get_uri(void)
 {
        return m_uri;
@@ -166,11 +157,6 @@ void sensor_info::set_type(sensor_type_t type)
        m_type = type;
 }
 
-void sensor_info::set_type_uri(const char *type_uri)
-{
-       m_type_uri = type_uri;
-}
-
 void sensor_info::set_uri(const char *name)
 {
        m_uri = name;
@@ -224,7 +210,6 @@ void sensor_info::set_privilege(const char *privilege)
 void sensor_info::serialize(raw_data_t &data)
 {
        put(data, m_type);
-       put(data, m_type_uri);
        put(data, m_uri);
        put(data, m_model);
        put(data, m_vendor);
@@ -246,7 +231,6 @@ void sensor_info::deserialize(const char *data, int data_len)
        it = get(it, type);
        m_type = (sensor_type_t)type;
 
-       it = get(it, m_type_uri);
        it = get(it, m_uri);
        it = get(it, m_model);
        it = get(it, m_vendor);
@@ -261,7 +245,6 @@ void sensor_info::deserialize(const char *data, int data_len)
 
 void sensor_info::show(void)
 {
-       _I("Type = %s", m_type_uri.c_str());
        _I("URI = %s", m_uri.c_str());
        _I("Model = %s", m_model.c_str());
        _I("Vendor = %s", m_vendor.c_str());
@@ -277,7 +260,6 @@ void sensor_info::show(void)
 void sensor_info::clear(void)
 {
        m_type = UNKNOWN_SENSOR;
-       m_type_uri.clear();
        m_uri.clear();
        m_model.clear();
        m_vendor.clear();
index 26119481616ec7c3ce3380f1d3c2d9993bdabe87..91b6ba8a82a394ab711964f83aba35da2b833de1 100644 (file)
@@ -39,9 +39,8 @@ public:
        sensor_info(const sensor_info_t &info);
        sensor_info(const sensor_info2_t &info);
 
-       /* TODO: it would be better to get_type() returns type(URI) */
+       /* TODO: it would be better to return type(URI) */
        sensor_type_t get_type(void);
-       std::string &get_type_uri(void);
        std::string &get_uri(void);
        std::string &get_model(void);
        std::string &get_vendor(void);
@@ -53,9 +52,7 @@ public:
        bool is_wakeup_supported(void);
        std::string &get_privilege(void);
 
-       /* TODO: it would be better to get_type() returns type(URI) */
        void set_type(sensor_type_t type);
-       void set_type_uri(const char *type_uri);
        void set_uri(const char *name);
        void set_model(const char *name);
        void set_vendor(const char *vendor);
@@ -75,7 +72,6 @@ public:
 
 private:
        sensor_type_t m_type;
-       std::string m_type_uri;
        std::string m_uri;
        std::string m_model;
        std::string m_vendor;