Add doxygen comments for scene-manager
[iotivity.git] / service / scene-manager / src / SceneMemberResourceRequestor.h
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_SCENEMEMBER_RESOURCE_REQUESTOR_H_
22 #define SM_SCENEMEMBER_RESOURCE_REQUESTOR_H_
23
24 #include "SceneCommons.h"
25 #include "RCSRemoteResourceObject.h"
26
27 /** OIC namespace */
28 namespace OIC
29 {
30     /** service namespace */
31     namespace Service
32     {
33
34         class SceneMemberResourceRequestor
35             : public std::enable_shared_from_this< SceneMemberResourceRequestor >
36         {
37             public:
38                 typedef std::shared_ptr< SceneMemberResourceRequestor > Ptr;
39                 typedef std::weak_ptr< SceneMemberResourceRequestor > wPtr;
40
41                 typedef std::function < void(int eCode) > InternalAddSceneActionCallback;
42
43             public:
44                 /**
45                  * constructor
46                  * @param memberResource   member resource
47                  * @param id               member id
48                  */
49                 SceneMemberResourceRequestor(RCSRemoteResourceObject::Ptr memberResource,
50                                              const std::string &id);
51                 ~SceneMemberResourceRequestor() = default;
52
53                 /**
54                  * This method is for scene action creation request
55                  * @param sceneName  name of the scene
56                  * @param attr       resource attributes
57                  * @param InternalAddSceneActionCallback  callback for scene action
58                  */
59                 void requestSceneActionCreation(const std::string &sceneName,
60                                                 const RCSResourceAttributes &attr,
61                                                 InternalAddSceneActionCallback);
62
63                 /** This method is for get request */
64                 void requestGet(const std::string &, RCSRemoteResourceObject::GetCallback);
65                 /** This method is for set remote resource object */
66                 void setRemoteResourceObject(RCSRemoteResourceObject::Ptr);
67                 /** This method is for get remote resource object */
68                 RCSRemoteResourceObject::Ptr getRemoteResourceObject() const;
69
70             private:
71                 static void onSceneActionCreated(
72                     const RCSResourceAttributes &, int eCode,
73                     const std::string &sceneName, const RCSResourceAttributes &requestedAttrs,
74                     const InternalAddSceneActionCallback &, SceneMemberResourceRequestor::wPtr);
75
76                 void onSceneActionCreated_impl(
77                     const RCSResourceAttributes &, int eCode,
78                     const std::string &sceneName, const RCSResourceAttributes &requestedAttrs,
79                     const InternalAddSceneActionCallback &);
80
81             private:
82                 std::string m_id;
83                 RCSRemoteResourceObject::Ptr m_remoteResource;
84                 RCSRemoteResourceObject::Ptr m_sceneMemberResource;
85         };
86
87     }
88 }
89
90 #endif /* SM_SCENEMEMBER_RESOURCE_REQUESTOR_H_ */
91