[IOT-1420] Solve that if, rt properties ommited
authorJihun Ha <jihun.ha@samsung.com>
Wed, 12 Oct 2016 10:29:56 +0000 (19:29 +0900)
committerUze Choi <uzchoi@samsung.com>
Thu, 13 Oct 2016 04:27:21 +0000 (04:27 +0000)
- add rt, if attributes to SceneListResource

Change-Id: I07017fbfb99755d182676e5a946fde505e121e66
Signed-off-by: ChaJiWon <jw_wonny.cha@samsung.com>
Signed-off-by: Jihun Ha <jihun.ha@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/13105
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
(cherry picked from commit 3b06e2bd1f6db4bae9189dc974632df4caa77239)
Reviewed-on: https://gerrit.iotivity.org/gerrit/13189

service/resource-encapsulation/src/serverBuilder/src/InterfaceHandler.cpp [changed mode: 0644->0755]
service/scene-manager/sampleapp/linux/sceneclient.cpp
service/scene-manager/src/SceneCollectionResource.cpp [changed mode: 0644->0755]
service/scene-manager/src/SceneCollectionResource.h [changed mode: 0644->0755]
service/scene-manager/src/SceneCommons.h
service/scene-manager/src/SceneListResource.cpp [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index ea50568..bf59e69
@@ -90,6 +90,9 @@ namespace
     {
         RCSRepresentation rcsRep;
 
+        RCSResourceObject::LockGuard lock{ resource, RCSResourceObject::AutoNotifyPolicy::NEVER };
+        rcsRep.setAttributes(resource.getAttributes());
+
         for (const auto& bound : resource.getBoundResources())
         {
             rcsRep.addChild(toRepresentation(*bound));
index 696003d..546c1db 100755 (executable)
@@ -52,7 +52,7 @@ Run g_currentRun;
 
 const std::string scene_name = "Night mode";
 const std::string relativetUri = OC_RSRVD_WELL_KNOWN_URI;
-const std::vector<std::string> resourceTypes{ "oic.wk.scenelist", "core.light", "core.fan" };
+const std::vector<std::string> resourceTypes{ "oic.wk.sceneList", "core.light", "core.fan" };
 
 std::mutex g_mtx;
 std::mutex g_discoverymtx;
@@ -505,7 +505,7 @@ void onResourceDiscovered(std::shared_ptr<RCSRemoteResourceObject> foundResource
     std::cout << "\t\tResource Host : " << hostAddress << std::endl;
 
     // if the found resource is a scene list resource
-    if (std::find(vecRTs.begin(), vecRTs.end(), "oic.wk.scenelist") != vecRTs.end())
+    if (std::find(vecRTs.begin(), vecRTs.end(), "oic.wk.sceneList") != vecRTs.end())
         g_foundListResource = foundResource;
 
     // if the found resource is a light resource
index f404bc1..1958757 100755 (executable)
@@ -57,9 +57,9 @@ namespace OIC
         const std::string SCENE_KEY_URI = "uri";
         const std::string SCENE_KEY_CHILD = "child";
 
-        const std::string SCENE_LIST_RT = "oic.wk.scenelist";
-        const std::string SCENE_MEMBER_RT = "oic.wk.scenemember";
-        const std::string SCENE_COLLECTION_RT = "oic.wk.scenecollection";
+        const std::string SCENE_LIST_RT = "oic.wk.sceneList";
+        const std::string SCENE_MEMBER_RT = "oic.wk.sceneMember";
+        const std::string SCENE_COLLECTION_RT = "oic.wk.sceneCollection";
 
         const std::string COAP_TAG = "coap://";
         const std::string SCENE_LIST_URI = "/SceneListResURI";
old mode 100644 (file)
new mode 100755 (executable)
index cf2d4ff..060dd66
@@ -169,8 +169,8 @@ namespace OIC
         RCSGetResponse SceneListResource::SceneListRequestHandler::onGetRequest(
                 const RCSRequest & request, RCSResourceAttributes & /*attributes*/)
         {
-
-            if(request.getInterface() != OC::DEFAULT_INTERFACE)
+            if(request.getInterface() != OC::DEFAULT_INTERFACE &&
+                !request.getInterface().empty())
             {
                 return RCSGetResponse::defaultAction();
             }
@@ -190,6 +190,18 @@ namespace OIC
                 retAttr[SCENE_KEY_CHILD] = childrenAttrs;
             }
 
+            if (!retAttr.contains("if"))
+            {
+                std::vector<std::string> ifs = { BASELINE_IF, OC::BATCH_INTERFACE, LINK_BATCH };
+                retAttr["if"] = ifs;
+            }
+
+            if (!retAttr.contains("rt"))
+            {
+                std::vector<std::string> rt = { SCENE_LIST_RT };
+                retAttr["rt"] = rt;
+            }
+
             return RCSGetResponse::create(retAttr);
         }