| 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 DEVICE_USB_USB_DEVICE_HANDLE_IMPL_H_ | 5 #ifndef DEVICE_USB_USB_DEVICE_HANDLE_IMPL_H_ |
| 6 #define DEVICE_USB_USB_DEVICE_HANDLE_IMPL_H_ | 6 #define DEVICE_USB_USB_DEVICE_HANDLE_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 typedef libusb_device_handle* PlatformUsbDeviceHandle; | 29 typedef libusb_device_handle* PlatformUsbDeviceHandle; |
| 30 typedef libusb_iso_packet_descriptor* PlatformUsbIsoPacketDescriptor; | 30 typedef libusb_iso_packet_descriptor* PlatformUsbIsoPacketDescriptor; |
| 31 typedef libusb_transfer* PlatformUsbTransferHandle; | 31 typedef libusb_transfer* PlatformUsbTransferHandle; |
| 32 | 32 |
| 33 // UsbDeviceHandle class provides basic I/O related functionalities. | 33 // UsbDeviceHandle class provides basic I/O related functionalities. |
| 34 class UsbDeviceHandleImpl : public UsbDeviceHandle { | 34 class UsbDeviceHandleImpl : public UsbDeviceHandle { |
| 35 public: | 35 public: |
| 36 virtual scoped_refptr<UsbDevice> GetDevice() const OVERRIDE; | 36 virtual scoped_refptr<UsbDevice> GetDevice() const OVERRIDE; |
| 37 virtual void Close() OVERRIDE; | 37 virtual void Close() OVERRIDE; |
| 38 virtual bool ClaimInterface(const int interface_number) OVERRIDE; | 38 virtual bool ClaimInterface(int interface_number) OVERRIDE; |
| 39 virtual bool ReleaseInterface(const int interface_number) OVERRIDE; | 39 virtual bool ReleaseInterface(int interface_number) OVERRIDE; |
| 40 virtual bool SetInterfaceAlternateSetting( | 40 virtual bool SetInterfaceAlternateSetting(int interface_number, |
| 41 const int interface_number, | 41 int alternate_setting) OVERRIDE; |
| 42 const int alternate_setting) OVERRIDE; | |
| 43 virtual bool ResetDevice() OVERRIDE; | 42 virtual bool ResetDevice() OVERRIDE; |
| 44 virtual bool GetManufacturer(base::string16* manufacturer) OVERRIDE; | 43 virtual bool GetManufacturer(base::string16* manufacturer) OVERRIDE; |
| 45 virtual bool GetProduct(base::string16* product) OVERRIDE; | 44 virtual bool GetProduct(base::string16* product) OVERRIDE; |
| 46 virtual bool GetSerial(base::string16* serial) OVERRIDE; | 45 virtual bool GetSerial(base::string16* serial) OVERRIDE; |
| 47 virtual void ControlTransfer(const UsbEndpointDirection direction, | 46 virtual void ControlTransfer(UsbEndpointDirection direction, |
| 48 const TransferRequestType request_type, | 47 TransferRequestType request_type, |
| 49 const TransferRecipient recipient, | 48 TransferRecipient recipient, |
| 50 const uint8 request, | 49 uint8 request, |
| 51 const uint16 value, | 50 uint16 value, |
| 52 const uint16 index, | 51 uint16 index, |
| 53 net::IOBuffer* buffer, | 52 net::IOBuffer* buffer, |
| 54 const size_t length, | 53 size_t length, |
| 55 const unsigned int timeout, | 54 unsigned int timeout, |
| 56 const UsbTransferCallback& callback) OVERRIDE; | 55 const UsbTransferCallback& callback) OVERRIDE; |
| 57 | 56 |
| 58 virtual void BulkTransfer(const UsbEndpointDirection direction, | 57 virtual void BulkTransfer(UsbEndpointDirection direction, |
| 59 const uint8 endpoint, | 58 uint8 endpoint, |
| 60 net::IOBuffer* buffer, | 59 net::IOBuffer* buffer, |
| 61 const size_t length, | 60 size_t length, |
| 62 const unsigned int timeout, | 61 unsigned int timeout, |
| 63 const UsbTransferCallback& callback) OVERRIDE; | 62 const UsbTransferCallback& callback) OVERRIDE; |
| 64 | 63 |
| 65 virtual void InterruptTransfer(const UsbEndpointDirection direction, | 64 virtual void InterruptTransfer(UsbEndpointDirection direction, |
| 66 const uint8 endpoint, | 65 uint8 endpoint, |
| 67 net::IOBuffer* buffer, | 66 net::IOBuffer* buffer, |
| 68 const size_t length, | 67 size_t length, |
| 69 const unsigned int timeout, | 68 unsigned int timeout, |
| 70 const UsbTransferCallback& callback) OVERRIDE; | 69 const UsbTransferCallback& callback) OVERRIDE; |
| 71 | 70 |
| 72 virtual void IsochronousTransfer( | 71 virtual void IsochronousTransfer( |
| 73 const UsbEndpointDirection direction, | 72 UsbEndpointDirection direction, |
| 74 const uint8 endpoint, | 73 uint8 endpoint, |
| 75 net::IOBuffer* buffer, | 74 net::IOBuffer* buffer, |
| 76 const size_t length, | 75 size_t length, |
| 77 const unsigned int packets, | 76 unsigned int packets, |
| 78 const unsigned int packet_length, | 77 unsigned int packet_length, |
| 79 const unsigned int timeout, | 78 unsigned int timeout, |
| 80 const UsbTransferCallback& callback) OVERRIDE; | 79 const UsbTransferCallback& callback) OVERRIDE; |
| 81 | 80 |
| 82 PlatformUsbDeviceHandle handle() const { return handle_; } | 81 PlatformUsbDeviceHandle handle() const { return handle_; } |
| 83 | 82 |
| 84 protected: | 83 protected: |
| 85 friend class UsbDeviceImpl; | 84 friend class UsbDeviceImpl; |
| 86 | 85 |
| 87 // This constructor is called by UsbDevice. | 86 // This constructor is called by UsbDevice. |
| 88 UsbDeviceHandleImpl(scoped_refptr<UsbContext> context, | 87 UsbDeviceHandleImpl(scoped_refptr<UsbContext> context, |
| 89 UsbDeviceImpl* device, | 88 UsbDeviceImpl* device, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 163 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 165 | 164 |
| 166 base::ThreadChecker thread_checker_; | 165 base::ThreadChecker thread_checker_; |
| 167 | 166 |
| 168 DISALLOW_COPY_AND_ASSIGN(UsbDeviceHandleImpl); | 167 DISALLOW_COPY_AND_ASSIGN(UsbDeviceHandleImpl); |
| 169 }; | 168 }; |
| 170 | 169 |
| 171 } // namespace device | 170 } // namespace device |
| 172 | 171 |
| 173 #endif // DEVICE_USB_USB_DEVICE_HANDLE_IMPL_H_ | 172 #endif // DEVICE_USB_USB_DEVICE_HANDLE_IMPL_H_ |
| OLD | NEW |