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_SCENELIST_RESOURCE_REQUESTOR_H_
22 #define SM_SCENELIST_RESOURCE_REQUESTOR_H_
24 #include "SceneCommons.h"
25 #include "RCSRemoteResourceObject.h"
26 #include "RCSRepresentation.h"
27 #include "RemoteSceneUtils.h"
34 class SceneListResourceRequestor
35 : public std::enable_shared_from_this< SceneListResourceRequestor >
38 typedef std::shared_ptr< SceneListResourceRequestor > Ptr;
39 typedef std::weak_ptr< SceneListResourceRequestor > wPtr;
41 typedef std::function<
42 void(const std::string &link, const std::string &id,
43 const std::string &name, int eCode) >
44 InternalCreateSceneCollectionCallback;
46 typedef std::function < void(int eCode) > InternalSetNameCallback;
49 SceneListResourceRequestor(RCSRemoteResourceObject::Ptr listResource);
50 ~SceneListResourceRequestor() = default;
52 void requestSceneCollectionCreation(
53 const std::string &name, InternalCreateSceneCollectionCallback);
55 void requestSetName(const std::string &, InternalSetNameCallback);
57 void requestGet(const std::string &, RCSRemoteResourceObject::GetCallback);
59 RCSRemoteResourceObject::Ptr getRemoteResourceObject() const;
62 static void onSceneCollectionCreated(
63 const RCSRepresentation &, int eCode,
64 const std::string &name, const InternalCreateSceneCollectionCallback &,
65 SceneListResourceRequestor::wPtr);
67 void onSceneCollectionCreated_impl(
68 const RCSRepresentation &, int eCode,
69 const std::string &name, const InternalCreateSceneCollectionCallback &);
71 static void onNameSet(const RCSRepresentation &, int eCode, const std::string &,
72 const InternalSetNameCallback &, SceneListResourceRequestor::wPtr);
74 void onNameSet_impl(const RCSRepresentation &, int eCode, const std::string &,
75 const InternalSetNameCallback &);
78 RCSRemoteResourceObject::Ptr m_sceneListResource;
84 #endif /* SM_SCENELIST_RESOURCE_REQUESTOR_H_ */