Add Scene Manager remote-side interfaces
authorMinji Park <minjii.park@samsung.com>
Thu, 4 Feb 2016 13:45:21 +0000 (22:45 +0900)
committerUze Choi <uzchoi@samsung.com>
Sat, 20 Feb 2016 06:10:41 +0000 (06:10 +0000)
: send requests to local scene manager from remote side

- RemoteSceneList
 creates new scene collection in remote scene list
- RemoteSceneCollection
 add new scene in remote scene collection
- RemoteScene
 add scene action in remote scene and request for scene execution
- RemoteSceneAction
 represents certain action of each scene member

Change-Id: Id9573fb0b7d2c56d4e0e15e17ab87dec2495c56b
Signed-off-by: Minji Park <minjii.park@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/4945
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/scene-manager/include/RemoteScene.h [new file with mode: 0644]
service/scene-manager/include/RemoteSceneAction.h [new file with mode: 0644]
service/scene-manager/include/RemoteSceneCollection.h [new file with mode: 0644]
service/scene-manager/include/RemoteSceneList.h [new file with mode: 0644]

diff --git a/service/scene-manager/include/RemoteScene.h b/service/scene-manager/include/RemoteScene.h
new file mode 100644 (file)
index 0000000..545c82c
--- /dev/null
@@ -0,0 +1,91 @@
+//******************************************************************
+//
+// Copyright 2016 Samsung Electronics All Rights Reserved.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+#ifndef SM_REMOTE_SCENE_H_
+#define SM_REMOTE_SCENE_H_
+
+#include <memory>
+#include <string>
+#include <map>
+
+#include "RemoteSceneAction.h"
+#include "RCSRemoteResourceObject.h"
+#include "RCSResourceAttributes.h"
+
+namespace OIC
+{
+    namespace Service
+    {
+        class SceneCollectionResourceRequestor;
+        class SceneMemberResourceRequestor;
+        class RemoteScene
+        {
+            public:
+                typedef std::shared_ptr< RemoteScene > Ptr;
+
+                typedef std::function< void(const RemoteSceneAction::Ptr) >
+                AddNewSceneActionCallback;
+
+                typedef std::function< void(const int eCode) > RemoveSceneActionCallback;
+
+                typedef std::function< void(const int eCode) > RemoteSceneExecuteCallback;
+
+            public:
+                ~RemoteScene();
+
+                void addNewSceneAction(RCSRemoteResourceObject::Ptr pTargetResource,
+                                       const RCSResourceAttributes &attr,
+                                       AddNewSceneActionCallback);
+                void addNewSceneAction(RCSRemoteResourceObject::Ptr pTargetResource,
+                                       const std::string &key,
+                                       const RCSResourceAttributes::Value &value,
+                                       AddNewSceneActionCallback);
+
+                void removeSceneAction(RemoteSceneAction::Ptr pRemoteSceneAction,
+                                       RemoveSceneActionCallback);
+                void removeSceneAction(RCSRemoteResourceObject::Ptr pTargetResource,
+                                       RemoveSceneActionCallback);
+
+                std::vector< RemoteSceneAction::Ptr > getRemoteSceneActions() const;
+                std::vector< RemoteSceneAction::Ptr > getRemoteSceneAction
+                (RCSRemoteResourceObject::Ptr pTargetResource) const;
+
+                std::string getName() const;
+
+                void execute(RemoteSceneExecuteCallback);
+
+            private:
+                RemoteScene(const std::string &name,
+                            std::shared_ptr< SceneCollectionResourceRequestor >);
+
+                void onSceneMemberAdded(const std::string &link, const std::string &id, int eCode);
+
+            private:
+                std::string m_name;
+                std::map < std::string, std::vector< RemoteSceneAction::Ptr > >
+                m_mapRemoteSceneActions;
+
+                std::shared_ptr< SceneCollectionResourceRequestor > m_pRequestor;
+        };
+    }
+}
+
+#endif /* SM_REMOTE_SCENE_H_ */
+
diff --git a/service/scene-manager/include/RemoteSceneAction.h b/service/scene-manager/include/RemoteSceneAction.h
new file mode 100644 (file)
index 0000000..132185d
--- /dev/null
@@ -0,0 +1,69 @@
+//******************************************************************
+//
+// Copyright 2016 Samsung Electronics All Rights Reserved.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+#ifndef SM_REMOTE_SCENEACTION_H_
+#define SM_REMOTE_SCENEACTION_H_
+
+#include <memory>
+#include <string>
+
+#include "RCSRemoteResourceObject.h"
+#include "RCSResourceAttributes.h"
+
+namespace OIC
+{
+    namespace Service
+    {
+        class RemoteSceneAction
+        {
+            public:
+                typedef std::shared_ptr< RemoteSceneAction > Ptr;
+
+                typedef std::function< void(int eCode) > UpdateActionCallback;
+
+
+            public:
+                ~RemoteSceneAction();
+
+                void updateAction(const RCSResourceAttributes &attr, UpdateActionCallback);
+                void updateAction(const std::string &key,
+                                  const RCSResourceAttributes::Value &value,
+                                  UpdateActionCallback);
+
+                RCSResourceAttributes getAction() const;
+
+                RCSRemoteResourceObject::Ptr getRemoteResourceObject() const;
+
+            private:
+                RemoteSceneAction(RCSRemoteResourceObject::Ptr pResource,
+                                  const RCSResourceAttributes &attr);
+                RemoteSceneAction(RCSRemoteResourceObject::Ptr pResource,
+                                  const std::string &key,
+                                  const RCSResourceAttributes::Value &value);
+
+
+            private:
+                RCSResourceAttributes m_attributes;
+                RCSRemoteResourceObject::Ptr m_pRemoteResourceObject;
+        };
+    }
+}
+
+#endif /* SM_REMOTE_SCENEACTION_H_ */
diff --git a/service/scene-manager/include/RemoteSceneCollection.h b/service/scene-manager/include/RemoteSceneCollection.h
new file mode 100644 (file)
index 0000000..e437c3d
--- /dev/null
@@ -0,0 +1,81 @@
+//******************************************************************
+//
+// Copyright 2016 Samsung Electronics All Rights Reserved.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+#ifndef SM_REMOTE_SCENECOLLECTION_H_
+#define SM_REMOTE_SCENECOLLECTION_H_
+
+#include <memory>
+#include <functional>
+#include <string>
+#include <map>
+
+#include "RemoteScene.h"
+#include "RCSRemoteResourceObject.h"
+
+namespace OIC
+{
+    namespace Service
+    {
+        class SceneCollectionResourceRequestor;
+        class RemoteSceneCollection
+        {
+            public:
+                typedef std::shared_ptr< RemoteSceneCollection > Ptr;
+
+                typedef std::function< void(RemoteScene::Ptr, int) > AddNewSceneCallback;
+
+                typedef std::function< void(int eCode) > RemoveSceneCallback;
+
+                typedef std::function< void(int eCode) > SetNameCallback;
+
+            public:
+                ~RemoteSceneCollection();
+
+                void addNewScene(const std::string &name, AddNewSceneCallback);
+                void removeScene(const std::string &name, RemoveSceneCallback);
+
+                std::map< std::string, RemoteScene::Ptr > getRemoteScenes() const;
+                RemoteScene::Ptr getRemoteScene(const std::string &sceneName) const;
+
+                void setName(const std::string &name, SetNameCallback);
+                std::string getName() const;
+
+                std::string getId() const;
+
+            private:
+                RemoteSceneCollection(
+                    std::shared_ptr< SceneCollectionResourceRequestor > pRequestor,
+                    std::string id, std::string name);
+
+                void onSceneAddedRemoved(const int &reqType, const std::string &name, int eCode,
+                                         AddNewSceneCallback);
+
+            private:
+                std::string m_id;
+                std::string m_name;
+                std::map< std::string, RemoteScene::Ptr > m_mapRemoteScenes;
+
+                std::shared_ptr< SceneCollectionResourceRequestor > m_pRequestor;
+        };
+    }
+}
+
+#endif /* SM_REMOTE_SCENECOLLECTION_H_ */
+
diff --git a/service/scene-manager/include/RemoteSceneList.h b/service/scene-manager/include/RemoteSceneList.h
new file mode 100644 (file)
index 0000000..a581155
--- /dev/null
@@ -0,0 +1,79 @@
+//******************************************************************
+//
+// Copyright 2016 Samsung Electronics All Rights Reserved.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+#ifndef SM_REMOTE_SCENELIST_H_
+#define SM_REMOTE_SCENELIST_H_
+
+#include <memory>
+#include <functional>
+
+#include "RemoteSceneCollection.h"
+#include "RCSRemoteResourceObject.h"
+
+namespace OIC
+{
+    namespace Service
+    {
+        class SceneListResourceRequestor;
+        class RemoteSceneList
+        {
+            public:
+                typedef std::shared_ptr< RemoteSceneList > Ptr;
+
+                typedef std::function< void(RemoteSceneList::Ptr, int) > CreateInstanceCallback;
+
+                typedef std::function< void(RemoteSceneCollection::Ptr, int) >
+                AddNewSceneCollectionCallback;
+
+                typedef std::function< void(int eCode) > SetNameCallback;
+
+            public:
+                ~RemoteSceneList();
+
+                static void createInstance
+                (RCSRemoteResourceObject::Ptr pSceneListResource, CreateInstanceCallback);
+
+                void addNewSceneCollection(AddNewSceneCollectionCallback);
+                void removeSceneCollection(RemoteSceneCollection::Ptr);
+
+                std::vector< RemoteSceneCollection::Ptr > getRemoteSceneCollections() const;
+
+                void setName(const std::string &name, SetNameCallback);
+                std::string getName() const;
+
+            private:
+                RemoteSceneList(std::shared_ptr< SceneListResourceRequestor > pRequestor,
+                                const std::string &name);
+
+                void onSceneCollectionCreated
+                (const std::string &link, const std::string &id, const std::string &name,
+                 AddNewSceneCollectionCallback);
+
+            private:
+                std::string m_name;
+                std::vector< RemoteSceneCollection::Ptr > m_remoteSceneCollections;
+
+                std::shared_ptr< SceneListResourceRequestor > m_pRequestor;
+        };
+    }
+}
+
+#endif /* SM_REMOTE_SCENELIST_H_ */
+