112636162Sopenharmony_ci/* 212636162Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 312636162Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 412636162Sopenharmony_ci * you may not use this file except in compliance with the License. 512636162Sopenharmony_ci * You may obtain a copy of the License at 612636162Sopenharmony_ci * 712636162Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 812636162Sopenharmony_ci * 912636162Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1012636162Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1112636162Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1212636162Sopenharmony_ci * See the License for the specific language governing permissions and 1312636162Sopenharmony_ci * limitations under the License. 1412636162Sopenharmony_ci */ 1512636162Sopenharmony_ci 1612636162Sopenharmony_ci#ifndef DRIVER_EXTENSION_MANAGER_CLIENT_H 1712636162Sopenharmony_ci#define DRIVER_EXTENSION_MANAGER_CLIENT_H 1812636162Sopenharmony_ci#include <singleton.h> 1912636162Sopenharmony_ci 2012636162Sopenharmony_ci#include "driver_ext_mgr_types.h" 2112636162Sopenharmony_ci#include "idriver_ext_mgr.h" 2212636162Sopenharmony_ci 2312636162Sopenharmony_cinamespace OHOS { 2412636162Sopenharmony_cinamespace ExternalDeviceManager { 2512636162Sopenharmony_ciclass DriverExtMgrClient final : public DelayedRefSingleton<DriverExtMgrClient> { 2612636162Sopenharmony_ci DECLARE_DELAYED_REF_SINGLETON(DriverExtMgrClient) 2712636162Sopenharmony_ci 2812636162Sopenharmony_cipublic: 2912636162Sopenharmony_ci DISALLOW_COPY_AND_MOVE(DriverExtMgrClient); 3012636162Sopenharmony_ci UsbErrCode QueryDevice(uint32_t busType, std::vector<std::shared_ptr<DeviceData>> &devices); 3112636162Sopenharmony_ci UsbErrCode BindDevice(uint64_t deviceId, const sptr<IDriverExtMgrCallback> &connectCallback); 3212636162Sopenharmony_ci UsbErrCode UnBindDevice(uint64_t deviceId); 3312636162Sopenharmony_ci UsbErrCode QueryDeviceInfo(std::vector<std::shared_ptr<DeviceInfoData>> &deviceInfos); 3412636162Sopenharmony_ci UsbErrCode QueryDeviceInfo(const uint64_t deviceId, std::vector<std::shared_ptr<DeviceInfoData>> &deviceInfos); 3512636162Sopenharmony_ci UsbErrCode QueryDriverInfo(std::vector<std::shared_ptr<DriverInfoData>> &driverInfos); 3612636162Sopenharmony_ci UsbErrCode QueryDriverInfo(const std::string &driverUid, std::vector<std::shared_ptr<DriverInfoData>> &driverInfos); 3712636162Sopenharmony_ci 3812636162Sopenharmony_ciprivate: 3912636162Sopenharmony_ci UsbErrCode Connect(); 4012636162Sopenharmony_ci void DisConnect(const wptr<IRemoteObject> &remote); 4112636162Sopenharmony_ci 4212636162Sopenharmony_ci class DriverExtMgrDeathRecipient : public IRemoteObject::DeathRecipient { 4312636162Sopenharmony_ci public: 4412636162Sopenharmony_ci DriverExtMgrDeathRecipient() = default; 4512636162Sopenharmony_ci ~DriverExtMgrDeathRecipient() = default; 4612636162Sopenharmony_ci void OnRemoteDied(const wptr<IRemoteObject> &remote); 4712636162Sopenharmony_ci 4812636162Sopenharmony_ci private: 4912636162Sopenharmony_ci DISALLOW_COPY_AND_MOVE(DriverExtMgrDeathRecipient); 5012636162Sopenharmony_ci }; 5112636162Sopenharmony_ci 5212636162Sopenharmony_ci std::mutex mutex_; 5312636162Sopenharmony_ci sptr<IDriverExtMgr> proxy_ {nullptr}; 5412636162Sopenharmony_ci sptr<IRemoteObject::DeathRecipient> deathRecipient_ {nullptr}; 5512636162Sopenharmony_ci}; 5612636162Sopenharmony_ci} // namespace ExternalDeviceManager 5712636162Sopenharmony_ci} // namespace OHOS 5812636162Sopenharmony_ci#endif // DRIVER_EXTENSION_MANAGER_CLIENT_H