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 OHOS_DM_IPC_CLIENT_PROXY_H 17 #define OHOS_DM_IPC_CLIENT_PROXY_H 18 19 #include <cstdint> 20 #include <memory> 21 22 #include "ipc_client.h" 23 namespace OHOS::DistributedHardware { class IpcReq; } 24 namespace OHOS::DistributedHardware { class IpcRsp; } 25 26 namespace OHOS { 27 namespace DistributedHardware { 28 class IpcClientProxy : public IpcClient { 29 DECLARE_IPC_INTERFACE(IpcClientProxy); 30 31 public: IpcClientProxy(std::shared_ptr<IpcClient> ipcClientManager)32 explicit IpcClientProxy(std::shared_ptr<IpcClient> ipcClientManager) : ipcClientManager_(ipcClientManager) {}; 33 34 public: 35 /** 36 * @tc.name: IpcClientProxy::Init 37 * @tc.desc: ipc client initialization 38 * @tc.type: FUNC 39 */ 40 virtual int32_t Init(const std::string &pkgName); 41 /** 42 * @tc.name: IpcClientProxy::UnInit 43 * @tc.desc: ipc client deinitialization 44 * @tc.type: FUNC 45 */ 46 virtual int32_t UnInit(const std::string &pkgName); 47 /** 48 * @tc.name: IpcClientProxy::SendRequest 49 * @tc.desc: ipc client Send Request 50 * @tc.type: FUNC 51 */ 52 virtual int32_t SendRequest(int32_t cmdCode, std::shared_ptr<IpcReq> req, std::shared_ptr<IpcRsp> rsp); 53 virtual int32_t OnDmServiceDied(); 54 private: 55 std::shared_ptr<IpcClient> ipcClientManager_ { nullptr }; 56 }; 57 } // namespace DistributedHardware 58 } // namespace OHOS 59 #endif // OHOS_DM_IPC_CLIENT_PROXY_H 60