1 //******************************************************************
3 // Copyright 2016 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #ifndef SM_REMOTE_SCENECOLLECTION_H_
22 #define SM_REMOTE_SCENECOLLECTION_H_
27 #include <unordered_map>
30 #include "RemoteScene.h"
31 #include "RCSRemoteResourceObject.h"
38 class SceneCollectionResourceRequestor;
40 class RemoteSceneCollection
43 typedef std::shared_ptr< RemoteSceneCollection > Ptr;
45 typedef std::function< void(RemoteScene::Ptr, int eCode) >
48 typedef std::function< void(int eCode) > RemoveSceneCallback;
50 typedef std::function< void(int eCode) > SetNameCallback;
53 ~RemoteSceneCollection() = default;
55 void addNewScene(const std::string &name, AddNewSceneCallback);
56 void removeScene(RemoteScene::Ptr, RemoveSceneCallback);
58 std::unordered_map< std::string, RemoteScene::Ptr > getRemoteScenes() const;
59 RemoteScene::Ptr getRemoteScene(const std::string &sceneName) const;
61 void setName(const std::string &name, SetNameCallback);
62 std::string getName() const;
64 std::string getId() const;
67 RemoteSceneCollection(
68 std::shared_ptr< SceneCollectionResourceRequestor >,
69 const std::string &id, const std::string &name);
71 void addExistingRemoteScenes(const std::vector< std::string > &);
73 void initializeRemoteScenes(const std::vector< RCSResourceAttributes > &,
76 RemoteScene::Ptr createRemoteSceneInstance(const std::string &);
78 void onSceneAddedRemoved(int, const std::string &name, int,
79 const AddNewSceneCallback &, const RemoveSceneCallback &);
81 void onNameSet(int, const std::string &, const SetNameCallback &);
86 mutable std::mutex m_sceneLock;
87 std::unordered_map< std::string, RemoteScene::Ptr > m_remoteScenes;
88 std::shared_ptr< SceneCollectionResourceRequestor > m_requestor;
90 friend class RemoteSceneList;
96 #endif /* SM_REMOTE_SCENECOLLECTION_H_ */