1 /* 2 * Copyright (c) 2023 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 USB_BUS_EXTENSION_H 17 #define USB_BUS_EXTENSION_H 18 #include <iproxy_broker.h> 19 #include <iremote_object.h> 20 21 #include "ibus_extension.h" 22 #include "usb_dev_subscriber.h" 23 #include "usb_device_info.h" 24 #include "v1_0/iusb_interface.h" 25 26 namespace OHOS { 27 namespace ExternalDeviceManager { 28 using namespace std; 29 using namespace OHOS::HDI::Usb::V1_0; 30 class UsbBusExtension : public IBusExtension { 31 public: 32 UsbBusExtension(); 33 ~UsbBusExtension(); 34 int32_t SetDevChangeCallback(shared_ptr<IDevChangeCallback> callback) override; 35 bool MatchDriver(const DriverInfo &driver, const DeviceInfo &device) override; 36 shared_ptr<DriverInfoExt> ParseDriverInfo(const vector<Metadata> &metadata) override; 37 shared_ptr<DriverInfoExt> GetNewDriverInfoExtObject() override; 38 void SetUsbInferface(sptr<IUsbInterface> iusb); 39 40 private: 41 class UsbdDeathRecipient : public IRemoteObject::DeathRecipient { 42 public: 43 void OnRemoteDied(const wptr<IRemoteObject> &object) override; 44 }; 45 sptr<UsbDevSubscriber> subScriber_ = nullptr; 46 sptr<IUsbInterface> usbInterface_ = nullptr; // in usb HDI; 47 vector<uint16_t> ParseCommaStrToVectorUint16(const string &str); 48 sptr<IRemoteObject::DeathRecipient> recipient_; 49 }; 50 } 51 } 52 #endif