1 //******************************************************************
3 // Copyright 2015 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 RH_HOSTINGOBJECT_H_
22 #define RH_HOSTINGOBJECT_H_
24 #include "ResourceClient.h"
25 #include "ResourceObject.h"
26 #include "RequestObject.h"
27 #include "ResourceBroker.h"
28 #include "ResourceCacheManager.h"
29 #include "PrimitiveResource.h"
39 typedef std::shared_ptr<ResourceObject> ResourceObjectPtr;
40 typedef std::shared_ptr<RemoteResourceObject> RemoteObjectPtr;
41 typedef std::shared_ptr<RequestObject> RequestObjectPtr;
42 typedef std::shared_ptr<PrimitiveResource> PrimiteveResourcePtr;
44 typedef std::function<void(ResourceState)> BrokerCallback;
45 typedef std::function<void(const ResourceAttributes &)> CacheCallback;
46 typedef std::function<void()> DestroyedCallback;
48 typedef std::function<
49 RCSSetResponse(const RCSRequest&, ResourceAttributes&)> SetRequestHandler;
53 ~HostingObject() = default;
55 void initializeHostingObject(RemoteObjectPtr rResource, DestroyedCallback destroyCB);
57 RemoteObjectPtr getRemoteResource() const;
60 RemoteObjectPtr remoteObject;
61 ResourceObjectPtr mirroredServer;
63 ResourceState remoteState;
65 BrokerCallback pStateChangedCB;
66 CacheCallback pDataUpdateCB;
67 DestroyedCallback pDestroyCB;
69 SetRequestHandler pSetRequestHandler;
71 ResourceObjectPtr createMirroredServer(RemoteObjectPtr rObject);
73 void stateChangedCB(ResourceState state, RemoteObjectPtr rObject);
74 void dataChangedCB(const ResourceAttributes & attributes, RemoteObjectPtr rObject);
76 RCSSetResponse setRequestHandler(
77 const RCSRequest & request, ResourceAttributes & attributes);
79 void destroyHostingObject();
83 } /* namespace Service */
86 #endif /* RH_HOSTINGOBJECT_H_ */