[IOT-1665] Fix bug for invalid input of constructResourceObject() in RE layer.
authorKIM JungYong <jyong2.kim@samsung.com>
Mon, 12 Dec 2016 12:51:46 +0000 (21:51 +0900)
committerUze Choi <uzchoi@samsung.com>
Wed, 14 Dec 2016 08:47:25 +0000 (08:47 +0000)
When RCSRemoteResourceObject::toOCResource() method called,
inside RE layer, constructResourceObject() was called
with invalid parameter on OCConnectityType.
So, it is due to mismatch with response type and request type.
the above result, ocstack layer couldn't parse payload.

In this patch, fixed parameter for OCConnectityType is modified valid type.

Change-Id: Ic924d9a892227377406e2b3ecfe666c41f1f0b04
Signed-off-by: KIM JungYong <jyong2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/15507
Reviewed-by: jihwan seo <jihwan.seo@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
(cherry picked from commit 51c33d5fc29083cfe17667f5cc33e4e82cd0a0f5)
Reviewed-on: https://gerrit.iotivity.org/gerrit/15535

service/resource-encapsulation/src/common/primitiveResource/include/PrimitiveResource.h
service/resource-encapsulation/src/common/primitiveResource/include/PrimitiveResourceImpl.h
service/resource-encapsulation/src/common/primitiveResource/unittests/PrimitiveResourceTest.cpp
service/resource-encapsulation/src/resourceClient/RCSRemoteResourceObject.cpp

index 8ba772b..59409ea 100644 (file)
@@ -91,6 +91,7 @@ namespace OIC
             virtual std::string getHost() const = 0;
             virtual std::vector< std::string > getTypes() const = 0;
             virtual std::vector< std::string > getInterfaces() const = 0;
+            virtual OCConnectivityType getConnectivityType() const = 0;
 
             virtual bool isObservable() const = 0;
 
index b531b34..778a62a 100644 (file)
@@ -211,6 +211,11 @@ namespace OIC
                 return invokeOC(m_baseResource, &BaseResource::getResourceInterfaces);
             }
 
+            OCConnectivityType getConnectivityType() const
+            {
+                return invokeOC(m_baseResource, &BaseResource::connectivityType);
+            }
+
             bool isObservable() const
             {
                 return invokeOC(m_baseResource, &BaseResource::isObservable);
index b1aa1a0..dcf5c3c 100644 (file)
@@ -54,6 +54,7 @@ public:
     virtual std::string host() const = 0;
     virtual std::vector<std::string> getResourceTypes() const = 0;
     virtual std::vector<std::string> getResourceInterfaces() const = 0;
+    virtual OCConnectivityType connectivityType() const = 0;
 
     virtual bool isObservable() const = 0;
 };
index e909261..2f73a00 100644 (file)
@@ -211,7 +211,7 @@ namespace OIC
 
             OC::OCResource::Ptr ocResource = OC::OCPlatform::constructResourceObject(rcsResource->getAddress(),
                 rcsResource->getUri(),
-                CT_DEFAULT,
+                rcsResource->m_primitiveResource->getConnectivityType(),
                 rcsResource->isObservable(),
                 rcsResource->getTypes(),
                 rcsResource->getInterfaces());