1 #ifndef ANDROID_HARDWARE_USB_V1_0_USB_H 2 #define ANDROID_HARDWARE_USB_V1_0_USB_H 3 4 #include <android/hardware/usb/1.0/IUsb.h> 5 #include <hidl/MQDescriptor.h> 6 #include <hidl/Status.h> 7 #include <log/log.h> 8 9 #ifdef LOG_TAG 10 #undef LOG_TAG 11 #endif 12 13 #define LOG_TAG "android.hardware.usb@1.0-service" 14 #define UEVENT_MSG_LEN 2048 15 16 namespace android { 17 namespace hardware { 18 namespace usb { 19 namespace V1_0 { 20 namespace implementation { 21 22 using ::android::hardware::usb::V1_0::IUsb; 23 using ::android::hardware::usb::V1_0::IUsbCallback; 24 using ::android::hardware::usb::V1_0::PortRole; 25 using ::android::hidl::base::V1_0::IBase; 26 using ::android::hardware::hidl_array; 27 using ::android::hardware::hidl_memory; 28 using ::android::hardware::hidl_string; 29 using ::android::hardware::hidl_vec; 30 using ::android::hardware::Return; 31 using ::android::hardware::Void; 32 using ::android::sp; 33 34 struct Usb : public IUsb { 35 Usb(); 36 Return<void> switchRole(const hidl_string& portName, const PortRole& role) override; 37 Return<void> setCallback(const sp<IUsbCallback>& callback) override; 38 Return<void> queryPortStatus() override; 39 40 sp<IUsbCallback> mCallback; 41 private: 42 pthread_t mPoll; 43 pthread_mutex_t mLock = PTHREAD_MUTEX_INITIALIZER; 44 }; 45 46 } // namespace implementation 47 } // namespace V1_0 48 } // namespace usb 49 } // namespace hardware 50 } // namespace android 51 52 #endif // ANDROID_HARDWARE_USB_V1_0_USB_H 53