| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef DEVICE_USB_USB_INTERFACE_H_ | |
| 6 #define DEVICE_USB_USB_INTERFACE_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 | |
| 10 namespace device { | |
| 11 | |
| 12 enum UsbTransferType { | |
| 13 USB_TRANSFER_CONTROL = 0, | |
| 14 USB_TRANSFER_ISOCHRONOUS, | |
| 15 USB_TRANSFER_BULK, | |
| 16 USB_TRANSFER_INTERRUPT, | |
| 17 }; | |
| 18 | |
| 19 enum UsbEndpointDirection { | |
| 20 USB_DIRECTION_INBOUND = 0, | |
| 21 USB_DIRECTION_OUTBOUND, | |
| 22 }; | |
| 23 | |
| 24 enum UsbSynchronizationType { | |
| 25 USB_SYNCHRONIZATION_NONE = 0, | |
| 26 USB_SYNCHRONIZATION_ASYNCHRONOUS, | |
| 27 USB_SYNCHRONIZATION_ADAPTIVE, | |
| 28 USB_SYNCHRONIZATION_SYNCHRONOUS, | |
| 29 }; | |
| 30 | |
| 31 enum UsbUsageType { | |
| 32 USB_USAGE_DATA = 0, | |
| 33 USB_USAGE_FEEDBACK, | |
| 34 USB_USAGE_EXPLICIT_FEEDBACK | |
| 35 }; | |
| 36 | |
| 37 class UsbEndpointDescriptor | |
| 38 : public base::RefCounted<const UsbEndpointDescriptor> { | |
| 39 public: | |
| 40 virtual int GetAddress() const = 0; | |
| 41 virtual UsbEndpointDirection GetDirection() const = 0; | |
| 42 virtual int GetMaximumPacketSize() const = 0; | |
| 43 virtual UsbSynchronizationType GetSynchronizationType() const = 0; | |
| 44 virtual UsbTransferType GetTransferType() const = 0; | |
| 45 virtual UsbUsageType GetUsageType() const = 0; | |
| 46 virtual int GetPollingInterval() const = 0; | |
| 47 | |
| 48 protected: | |
| 49 friend class base::RefCounted<const UsbEndpointDescriptor>; | |
| 50 | |
| 51 UsbEndpointDescriptor() {}; | |
| 52 virtual ~UsbEndpointDescriptor() {}; | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(UsbEndpointDescriptor); | |
| 55 }; | |
| 56 | |
| 57 class UsbInterfaceAltSettingDescriptor | |
| 58 : public base::RefCounted<const UsbInterfaceAltSettingDescriptor> { | |
| 59 public: | |
| 60 virtual size_t GetNumEndpoints() const = 0; | |
| 61 virtual scoped_refptr<const UsbEndpointDescriptor> GetEndpoint( | |
| 62 size_t index) const = 0; | |
| 63 | |
| 64 virtual int GetInterfaceNumber() const = 0; | |
| 65 virtual int GetAlternateSetting() const = 0; | |
| 66 virtual int GetInterfaceClass() const = 0; | |
| 67 virtual int GetInterfaceSubclass() const = 0; | |
| 68 virtual int GetInterfaceProtocol() const = 0; | |
| 69 | |
| 70 protected: | |
| 71 friend class base::RefCounted<const UsbInterfaceAltSettingDescriptor>; | |
| 72 | |
| 73 UsbInterfaceAltSettingDescriptor() {}; | |
| 74 virtual ~UsbInterfaceAltSettingDescriptor() {}; | |
| 75 | |
| 76 DISALLOW_COPY_AND_ASSIGN(UsbInterfaceAltSettingDescriptor); | |
| 77 }; | |
| 78 | |
| 79 class UsbInterfaceDescriptor | |
| 80 : public base::RefCounted<const UsbInterfaceDescriptor> { | |
| 81 public: | |
| 82 virtual size_t GetNumAltSettings() const = 0; | |
| 83 virtual scoped_refptr<const UsbInterfaceAltSettingDescriptor> GetAltSetting( | |
| 84 size_t index) const = 0; | |
| 85 | |
| 86 protected: | |
| 87 friend class base::RefCounted<const UsbInterfaceDescriptor>; | |
| 88 | |
| 89 UsbInterfaceDescriptor() {}; | |
| 90 virtual ~UsbInterfaceDescriptor() {}; | |
| 91 | |
| 92 DISALLOW_COPY_AND_ASSIGN(UsbInterfaceDescriptor); | |
| 93 }; | |
| 94 | |
| 95 class UsbConfigDescriptor : public base::RefCounted<UsbConfigDescriptor> { | |
| 96 public: | |
| 97 virtual size_t GetNumInterfaces() const = 0; | |
| 98 virtual scoped_refptr<const UsbInterfaceDescriptor> GetInterface( | |
| 99 size_t index) const = 0; | |
| 100 | |
| 101 protected: | |
| 102 friend class base::RefCounted<UsbConfigDescriptor>; | |
| 103 | |
| 104 UsbConfigDescriptor() {}; | |
| 105 virtual ~UsbConfigDescriptor() {}; | |
| 106 | |
| 107 DISALLOW_COPY_AND_ASSIGN(UsbConfigDescriptor); | |
| 108 }; | |
| 109 | |
| 110 } // namespace device | |
| 111 | |
| 112 #endif // DEVICE_USB_USB_INTERFACE_H_ | |
| OLD | NEW |