IoTivity C++ SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RemoteSceneAction.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_REMOTE_SCENEACTION_H_
22 #define SM_REMOTE_SCENEACTION_H_
23 
24 #include <memory>
25 #include <string>
26 #include <mutex>
27 
29 
30 namespace OIC
31 {
32  namespace Service
33  {
34 
35  class SceneMemberResourceRequestor;
36 
37  /*
38  * @class RemoteSceneAction
39  *
40  * @brief RemoteSceneAction class indicates a unit of actions when a scene is executed.
41  * RemoteSceneAction instance is initialized with 3 essential parameters:
42  * a target resource, target attribute key, and its target value.
43  * And this class also provides APIs to update a target attribute information if one wants.
44  * Note that, adding a new RemoteSceneAction is done by sending a CoAP request to update a
45  * SceneMember resource's attribute.
46  */
48  {
49  public:
50  typedef std::shared_ptr< RemoteSceneAction > Ptr;
51 
63  typedef std::function< void(int eCode) > ResetExecutionParameterCallback;
64 
65  public:
66  ~RemoteSceneAction() = default;
67 
81  void resetExecutionParameter(const std::string &key,
83 
98 
105 
112 
113  private:
114  RemoteSceneAction(std::shared_ptr< SceneMemberResourceRequestor >,
115  const std::string &sceneName, const RCSResourceAttributes &);
116  RemoteSceneAction(std::shared_ptr< SceneMemberResourceRequestor >,
117  const std::string &sceneName,
118  const std::string &key, const RCSResourceAttributes::Value &);
119 
120  void onExecutionParameterSet(int, const RCSResourceAttributes &,
122 
123  private:
124  std::string m_sceneName;
125  mutable std::mutex m_attributeLock;
126  RCSResourceAttributes m_attributes;
127  std::shared_ptr< SceneMemberResourceRequestor > m_requestor;
128 
129  friend class RemoteScene;
130  };
131 
132  }
133 }
134 
135 #endif /* SM_REMOTE_SCENEACTION_H_ */
RCSResourceAttributes getExecutionParameter() const
Returns an execution parameter of the SceneAction.
std::function< void(int eCode) > ResetExecutionParameterCallback
Callback definition to be invoked when a response of resetExecutionParameter is received.
Definition: RemoteSceneAction.h:63
Definition: RemoteScene.h:48
Value holds a value among various types at a time.
Definition: RCSResourceAttributes.h:432
std::shared_ptr< RCSRemoteResourceObject > Ptr
Definition: RCSRemoteResourceObject.h:175
std::shared_ptr< RemoteSceneAction > Ptr
Definition: RemoteSceneAction.h:50
This represents the attributes for a resource.
Definition: RCSResourceAttributes.h:195
RCSRemoteResourceObject::Ptr getRemoteResourceObject() const
Returns a target remote resource object of the RemoteSceneAction instance.
void resetExecutionParameter(const std::string &key, const RCSResourceAttributes::Value &value, ResetExecutionParameterCallback cb)
Requests to reset the RemoteSceneAction parameters like a target attribute key and its value...
Definition: RemoteSceneAction.h:47
This file contains the declaration of classes and its members related to RCSRemoteResourceObject.