Getting device model name functional was added
authori.metelytsia <i.metelytsia@samsung.com>
Wed, 24 May 2017 11:59:28 +0000 (14:59 +0300)
committeri.metelytsia <i.metelytsia@samsung.com>
Wed, 24 May 2017 11:59:28 +0000 (14:59 +0300)
device_core/iotivity_lib/IoT/IOT_Resource.cpp
device_core/iotivity_lib/IoT/IOT_Resource.h
device_core/nmdaemon/utils.cpp
device_core/nmdaemon/utils.h
device_core/utest/test_IoT.cpp

index 9b3a68e..f73f26e 100644 (file)
@@ -200,6 +200,11 @@ OCStackResult IOT_Resource::observeResource(const std::shared_ptr<OCResource> _r
     return _resource->observe(ObserveType::Observe, _query_params, _observe_handler);
 }
 
+OCStackResult IOT_Resource::cancelObserve(const std::shared_ptr<OC::OCResource> _resource)
+{
+    return _resource->cancelObserve();
+}
+
 OCStackResult IOT_Resource::post(const std::shared_ptr<OC::OCResource> _resource, const std::string& _type, const std::string& _interface, const OCRepresentation& _representation, const QueryParamsMap& _query_params)
 {
     OCStackResult res = OC_STACK_ERROR;
index 88b5f7c..72712cc 100644 (file)
@@ -67,6 +67,8 @@ public:
 
     static OCStackResult observeResource(const std::shared_ptr<OC::OCResource> _resource, const QueryParamsMap& _query_params, ObserveCallback _observe_handler);
 
+    static OCStackResult cancelObserve(const std::shared_ptr<OC::OCResource> _resource);
+
     static OCStackResult post(const std::shared_ptr<OC::OCResource> _resource, const std::string& _type, const std::string& _interface, const OCRepresentation& _representation, const QueryParamsMap& _query_params);
 
     static std::string representationToString(const OCRepresentation& _rep);
index e815f51..6df3990 100644 (file)
@@ -8,6 +8,10 @@
 #include <fstream>\r
 #include <vector>\r
 \r
+#if defined(__TIZEN__)\r
+    #include <system_info.h>\r
+#endif\r
+\r
 #include "utils.h"\r
 \r
 namespace NMD\r
@@ -78,6 +82,22 @@ bool write_log(const char* _msg, ...)
 \r
 /*******************************************************/\r
 /*******************************************************/\r
+#if defined(__TIZEN__)\r
+std::string get_device_model_name()\r
+{\r
+    char* value = nullptr;\r
+\r
+    if(system_info_get_platform_string("tizen.org/system/manufacturer", &value) != SYSTEM_INFO_ERROR_NONE)\r
+        return std::string();\r
+\r
+    std::string res(value);\r
+    free(value);\r
+    return res;\r
+}\r
+#endif\r
+\r
+/*******************************************************/\r
+/*******************************************************/\r
 static bool wl(const char* _msg, va_list _vl)\r
 {\r
     bool res = false;\r
index 628f6c6..e4edb7f 100644 (file)
@@ -28,6 +28,10 @@ bool read_config(nmdaemon_config& _config);
 void write_config(const nmdaemon_config& _config);\r
 \r
 bool write_log(const char* _msg, ...);\r
+\r
+#if defined(__TIZEN__)\r
+std::string get_device_model_name();\r
+#endif\r
 }\r
 \r
 #endif /* __UTILS_H__ */\r
index d6a0470..9ed3970 100644 (file)
@@ -197,7 +197,8 @@ TEST(test_IoT, test_IOT_PolicySender)
                     throw runtime_error("Failed to post policy");
 
             cvar.wait_for(lck, chrono::seconds(3));
-            policy_res->cancelObserve();
+
+            IOT_Resource::cancelObserve(policy_res);
         }   );
     ASSERT_TRUE(res);
 }