1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef DISTRIBUTEDDATAMGR_OBJECT_CALLBACK_PROXY_H 17 #define DISTRIBUTEDDATAMGR_OBJECT_CALLBACK_PROXY_H 18 #include <iremote_broker.h> 19 #include <iremote_proxy.h> 20 #include "object_callback.h" 21 22 namespace OHOS { 23 namespace DistributedObject { 24 class ObjectSaveCallbackProxyBroker : public IObjectSaveCallback, public IRemoteBroker { 25 public: 26 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.DistributedObject.IObjectSaveCallback"); 27 }; 28 29 class ObjectSaveCallbackProxy : public IRemoteProxy<ObjectSaveCallbackProxyBroker> { 30 public: 31 explicit ObjectSaveCallbackProxy(const sptr<IRemoteObject> &impl); 32 ~ObjectSaveCallbackProxy() = default; 33 void Completed(const std::map<std::string, int32_t> &results) override; 34 35 private: 36 static inline BrokerDelegator<ObjectSaveCallbackProxy> delegator_; 37 }; 38 39 class ObjectRevokeSaveCallbackProxyBroker : public IObjectRevokeSaveCallback, public IRemoteBroker { 40 public: 41 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.DistributedObject.IObjectRevokeSaveCallback"); 42 }; 43 44 class ObjectRevokeSaveCallbackProxy : public IRemoteProxy<ObjectRevokeSaveCallbackProxyBroker> { 45 public: 46 explicit ObjectRevokeSaveCallbackProxy(const sptr<IRemoteObject> &impl); 47 ~ObjectRevokeSaveCallbackProxy() = default; 48 void Completed(int32_t status) override; 49 50 private: 51 static inline BrokerDelegator<ObjectRevokeSaveCallbackProxy> delegator_; 52 }; 53 54 class ObjectRetrieveCallbackProxyBroker : public IObjectRetrieveCallback, public IRemoteBroker { 55 public: 56 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.DistributedObject.IObjectRetrieveCallback"); 57 }; 58 59 class ObjectRetrieveCallbackProxy : public IRemoteProxy<ObjectRetrieveCallbackProxyBroker> { 60 public: 61 explicit ObjectRetrieveCallbackProxy(const sptr<IRemoteObject> &impl); 62 ~ObjectRetrieveCallbackProxy() = default; 63 void Completed(const std::map<std::string, std::vector<uint8_t>> &results, bool allReady) override; 64 65 private: 66 static inline BrokerDelegator<ObjectRetrieveCallbackProxy> delegator_; 67 }; 68 69 class ObjectChangeCallbackProxyBroker : public IObjectChangeCallback, public IRemoteBroker { 70 public: 71 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.DistributedObject.IObjectChangeCallback"); 72 }; 73 74 class ObjectChangeCallbackProxy : public IRemoteProxy<ObjectChangeCallbackProxyBroker> { 75 public: 76 explicit ObjectChangeCallbackProxy(const sptr<IRemoteObject> &impl); 77 ~ObjectChangeCallbackProxy() = default; 78 void Completed(const std::map<std::string, std::vector<uint8_t>> &results, bool allReady) override; 79 80 private: 81 static inline BrokerDelegator<ObjectChangeCallbackProxy> delegator_; 82 }; 83 } // namespace DistributedObject 84 } // namespace OHOS 85 #endif // DISTRIBUTEDDATAMGR_OBJECT_CALLBACK_PROXY_H 86