IoTivity C++ SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Scene.h
Go to the documentation of this file.
1 //******************************************************************
2 //
3 // Copyright 2016 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
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
10 //
11 // http://www.apache.org/licenses/LICENSE-2.0
12 //
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.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20 
21 #ifndef SM_SCENE_H_
22 #define SM_SCENE_H_
23 
24 #include "SceneAction.h"
25 
26 #include <vector>
27 
28 namespace OIC
29 {
30  namespace Service
31  {
32 
33  class SceneCollectionResource;
34 
43  class Scene
44  {
45  public:
46  typedef std::shared_ptr< Scene > Ptr;
47 
53  typedef std::function< void(int) > ExecuteCallback;
54 
55  private:
56  Scene(const Scene&) = default;
57  Scene(const std::string&, std::shared_ptr<SceneCollectionResource>);
58  friend class SceneCollection;
59 
60  public:
61 
79  const RCSRemoteResourceObject::Ptr& pRCSRemoteResourceObject,
80  std::string key, RCSResourceAttributes::Value value);
81 
98  const RCSRemoteResourceObject::Ptr& pRCSRemoteResourceObject,
100 
112  const RCSRemoteResourceObject::Ptr& pRCSRemoteResourceObject) const;
113 
120  std::vector<SceneAction::Ptr> getSceneActions() const ;
121 
127  std::string getName() const;
128 
134  void execute(ExecuteCallback cb);
135 
136  private:
137  std::string m_name;
138  std::shared_ptr< SceneCollectionResource > m_sceneCollectionResource;
139 
140  };
141  } /* namespace Service */
142 } /* namespace OIC */
143 
144 #endif /* SM_SCENE_H_ */
145 
std::shared_ptr< SceneAction > Ptr
Definition: SceneAction.h:46
std::function< void(int) > ExecuteCallback
Typedef for callback of execute APIs.
Definition: Scene.h:53
SceneCollection class is an interface class to manage SceneCollection resource.
Definition: SceneCollection.h:42
Scene class is an interface class to manage scenes provided by SceneCollection resource.
Definition: Scene.h:43
Value holds a value among various types at a time.
Definition: RCSResourceAttributes.h:432
std::string getName() const
Gets Scene's name provided SceneCollection resource.
void execute(ExecuteCallback cb)
Requests executing Scene to SceneCollection resource.
std::shared_ptr< RCSRemoteResourceObject > Ptr
Definition: RCSRemoteResourceObject.h:175
SceneAction::Ptr addNewSceneAction(const RCSRemoteResourceObject::Ptr &pRCSRemoteResourceObject, std::string key, RCSResourceAttributes::Value value)
Adds new SceneAction instance to the Scene instance.
This represents the attributes for a resource.
Definition: RCSResourceAttributes.h:195
std::vector< SceneAction::Ptr > getSceneActions() const
Gets all SceneActions include current Scene.
std::shared_ptr< Scene > Ptr
Definition: Scene.h:46
SceneAction::Ptr getSceneAction(const RCSRemoteResourceObject::Ptr &pRCSRemoteResourceObject) const
Gets SceneAction using discovered resource.