Fix 'isCloudAccessible' API which returned a wrong value
authorJihun Ha <jihun.ha@samsung.com>
Tue, 16 May 2017 04:00:56 +0000 (13:00 +0900)
committerUze Choi <uzchoi@samsung.com>
Tue, 16 May 2017 07:00:05 +0000 (07:00 +0000)
"rt" property is written inside "rep" property.

Change-Id: I2cf76661d9c04b32587333a5aefb4474f863d3e7
Signed-off-by: Jihun Ha <jihun.ha@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18991
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/easy-setup/mediator/richsdk/inc/ESRichCommon.h

index 20b79f1..2a29bd6 100755 (executable)
@@ -738,11 +738,24 @@ namespace OIC
                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
                 for(auto child = children.begin(); child != children.end(); ++child)
                 {
-                    for(auto rt : child->getResourceTypes())
+                    OCRepresentation rep;
+                    if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
                     {
-                        if(0 == rt.compare(OC_RSRVD_ES_RES_TYPE_COAPCLOUDCONF))
+                        rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
+                    }
+                    else
+                    {
+                        return false;
+                    }
+
+                    if(rep.hasAttribute(OC_RSRVD_RESOURCE_TYPE))
+                    {
+                        for (auto rt : rep.getValue<std::vector<std::string>>(OC_RSRVD_RESOURCE_TYPE))
                         {
-                            return true;
+                            if(0 == rt.compare(OC_RSRVD_ES_RES_TYPE_COAPCLOUDCONF))
+                            {
+                                return true;
+                            }
                         }
                     }
                 }