OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "device/usb/usb_device_handle.h" | 5 #include "device/usb/usb_device_handle.h" |
6 | 6 |
7 namespace device { | 7 namespace device { |
8 | 8 |
9 // This class implements a fake USB device handle that will handle control | 9 // This class implements a fake USB device handle that will handle control |
10 // requests by responding with data out of the provided buffer. The format of | 10 // requests by responding with data out of the provided buffer. The format of |
(...skipping 19 matching lines...) Expand all Loading... |
30 void ClaimInterface(int interface_number, | 30 void ClaimInterface(int interface_number, |
31 const ResultCallback& callback) override; | 31 const ResultCallback& callback) override; |
32 void ReleaseInterface(int interface_number, | 32 void ReleaseInterface(int interface_number, |
33 const ResultCallback& callback) override; | 33 const ResultCallback& callback) override; |
34 void SetInterfaceAlternateSetting(int interface_number, | 34 void SetInterfaceAlternateSetting(int interface_number, |
35 int alternate_setting, | 35 int alternate_setting, |
36 const ResultCallback& callback) override; | 36 const ResultCallback& callback) override; |
37 void ResetDevice(const ResultCallback& callback) override; | 37 void ResetDevice(const ResultCallback& callback) override; |
38 void ClearHalt(uint8_t endpoint, const ResultCallback& callback) override; | 38 void ClearHalt(uint8_t endpoint, const ResultCallback& callback) override; |
39 | 39 |
40 void ControlTransfer(UsbEndpointDirection direction, | 40 void ControlTransfer(UsbTransferDirection direction, |
41 TransferRequestType request_type, | 41 UsbControlTransferType request_type, |
42 TransferRecipient recipient, | 42 UsbControlTransferRecipient recipient, |
43 uint8_t request, | 43 uint8_t request, |
44 uint16_t value, | 44 uint16_t value, |
45 uint16_t index, | 45 uint16_t index, |
46 scoped_refptr<net::IOBuffer> buffer, | 46 scoped_refptr<net::IOBuffer> buffer, |
47 size_t length, | 47 size_t length, |
48 unsigned int timeout, | 48 unsigned int timeout, |
49 const TransferCallback& callback) override; | 49 const TransferCallback& callback) override; |
50 | 50 |
51 void IsochronousTransferIn( | 51 void IsochronousTransferIn( |
52 uint8_t endpoint, | 52 uint8_t endpoint, |
53 const std::vector<uint32_t>& packet_lengths, | 53 const std::vector<uint32_t>& packet_lengths, |
54 unsigned int timeout, | 54 unsigned int timeout, |
55 const IsochronousTransferCallback& callback) override; | 55 const IsochronousTransferCallback& callback) override; |
56 | 56 |
57 void IsochronousTransferOut( | 57 void IsochronousTransferOut( |
58 uint8_t endpoint, | 58 uint8_t endpoint, |
59 scoped_refptr<net::IOBuffer> buffer, | 59 scoped_refptr<net::IOBuffer> buffer, |
60 const std::vector<uint32_t>& packet_lengths, | 60 const std::vector<uint32_t>& packet_lengths, |
61 unsigned int timeout, | 61 unsigned int timeout, |
62 const IsochronousTransferCallback& callback) override; | 62 const IsochronousTransferCallback& callback) override; |
63 | 63 |
64 void GenericTransfer(UsbEndpointDirection direction, | 64 void GenericTransfer(UsbTransferDirection direction, |
65 uint8_t endpoint_number, | 65 uint8_t endpoint_number, |
66 scoped_refptr<net::IOBuffer> buffer, | 66 scoped_refptr<net::IOBuffer> buffer, |
67 size_t length, | 67 size_t length, |
68 unsigned int timeout, | 68 unsigned int timeout, |
69 const TransferCallback& callback) override; | 69 const TransferCallback& callback) override; |
70 const UsbInterfaceDescriptor* FindInterfaceByEndpoint( | 70 const UsbInterfaceDescriptor* FindInterfaceByEndpoint( |
71 uint8_t endpoint_address) override; | 71 uint8_t endpoint_address) override; |
72 | 72 |
73 private: | 73 private: |
74 ~FakeUsbDeviceHandle() override; | 74 ~FakeUsbDeviceHandle() override; |
75 | 75 |
76 const uint8_t* const data_; | 76 const uint8_t* const data_; |
77 const size_t size_; | 77 const size_t size_; |
78 size_t position_; | 78 size_t position_; |
79 }; | 79 }; |
80 | 80 |
81 } // namespace device | 81 } // namespace device |
OLD | NEW |