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_
26 #include "RCSRemoteResourceObject.h"
27 #include "RCSResourceObject.h"
28 #include "RequestObject.h"
35 void OIC_HOSTING_LOG(LogLevel level, const char * format, ...);
40 typedef std::shared_ptr<RCSResourceObject> ResourceObjectPtr;
41 typedef std::shared_ptr<RCSRemoteResourceObject> RemoteObjectPtr;
42 typedef std::shared_ptr<RequestObject> RequestObjectPtr;
43 typedef std::shared_ptr<PrimitiveResource> PrimiteveResourcePtr;
46 typedef std::shared_ptr<HostingObject> Ptr;
47 typedef std::function<void(ResourceState)> BrokerCallback;
48 typedef std::function<void(const RCSResourceAttributes &)> CacheCallback;
49 typedef std::function<void()> DestroyedCallback;
51 typedef std::function<
52 RCSSetResponse(const RCSRequest&, RCSResourceAttributes&)> SetRequestHandler;
58 void initializeHostingObject(RemoteObjectPtr rResource, DestroyedCallback destroyCB);
60 RemoteObjectPtr getRemoteResource() const;
63 RemoteObjectPtr remoteObject;
64 ResourceObjectPtr mirroredServer;
66 ResourceState remoteState;
68 BrokerCallback pStateChangedCB;
69 CacheCallback pDataUpdateCB;
70 DestroyedCallback pDestroyCB;
72 SetRequestHandler pSetRequestHandler;
74 ResourceObjectPtr createMirroredServer(RemoteObjectPtr rObject);
76 void stateChangedCB(ResourceState state, RemoteObjectPtr rObject);
77 void dataChangedCB(const RCSResourceAttributes & attributes, RemoteObjectPtr rObject);
79 RCSSetResponse setRequestHandler(
80 const RCSRequest & request, RCSResourceAttributes & attributes);
82 void destroyHostingObject();
86 } /* namespace Service */
89 #endif /* RH_HOSTINGOBJECT_H_ */