1 /* 2 * Copyright (c) 2025 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 UDMF_NOTIFIER_STUB_H 17 #define UDMF_NOTIFIER_STUB_H 18 19 #include <functional> 20 #include <iremote_stub.h> 21 #include "iudmf_notifier.h" 22 #include "unified_data.h" 23 24 namespace OHOS { 25 namespace UDMF { 26 27 class UdmfNotifierStub : public IRemoteStub<IUdmfNotifier> { 28 public: 29 int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 30 }; 31 32 class UdmfNotifierClient : public UdmfNotifierStub { 33 public: 34 explicit UdmfNotifierClient(LoadHandler loadHandler_); 35 virtual ~UdmfNotifierClient() = default; 36 37 void HandleDelayObserver(const std::string &key, const DataLoadInfo &dataLoadInfo) override; 38 39 private: 40 LoadHandler loadHandler_; 41 }; 42 43 class DelayDataCallbackStub : public IRemoteStub<IDelayDataCallback> { 44 public: 45 int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 46 }; 47 48 class DelayDataCallbackClient : public DelayDataCallbackStub { 49 public: 50 using DataCallback = std::function<void(const std::string &udKey, const UnifiedData &unifiedData)>; 51 52 explicit DelayDataCallbackClient(DataCallback dataCallback); 53 virtual ~DelayDataCallbackClient() = default; 54 void DelayDataCallback(const std::string &key, const UnifiedData &data) override; 55 56 private: 57 DataCallback dataCallback_; 58 }; 59 60 61 } // namespace UDMF 62 } // namespace OHOS 63 #endif // UDMF_NOTIFIER_STUB_H