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 REMOTERESOURCEINFO_H_
22 #define REMOTERESOURCEINFO_H_
26 #include "RCSRemoteResourceObject.h"
32 class RemoteResourceUnit
41 typedef std::shared_ptr<RemoteResourceUnit> Ptr;
42 typedef std::function<void(UPDATE_MSG,
43 RCSRemoteResourceObject::Ptr)> UpdatedCBFromServer;
46 ~RemoteResourceUnit();
49 mutable std::mutex m_mutex;
50 RCSRemoteResourceObject::Ptr remoteObject;
52 UpdatedCBFromServer pUpdatedCB;
53 RCSRemoteResourceObject::StateChangedCallback pStateChangedCB;
54 RCSRemoteResourceObject::CacheUpdatedCallback pCacheUpdateCB;
56 void stateChangedCB(ResourceState changedState) const;
57 void cacheUpdateCB(const RCSResourceAttributes & updatedAtt, int) const;
60 static RemoteResourceUnit::Ptr createRemoteResourceInfo(
61 RCSRemoteResourceObject::Ptr ptr, UpdatedCBFromServer updatedCB);
62 static RemoteResourceUnit::Ptr createRemoteResourceInfoWithStateCB(
63 RCSRemoteResourceObject::Ptr ptr, UpdatedCBFromServer updatedCB,
64 RCSRemoteResourceObject::StateChangedCallback stateCB);
65 static RemoteResourceUnit::Ptr createRemoteResourceInfoWithCacheCB(
66 RCSRemoteResourceObject::Ptr ptr, UpdatedCBFromServer updatedCB,
67 RCSRemoteResourceObject::CacheUpdatedCallback cacheCB);
69 RCSRemoteResourceObject::Ptr getRemoteResourceObject() const;
70 std::string getRemoteResourceUri() const;
72 void startCaching() const;
73 void startMonitoring() const;
78 #endif // REMOTERESOURCEINFO_H_