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