Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: device/usb/usb_device_handle.h

Issue 1658953003: Revert of Update device/usb and its Mojo interface for variable size ISO packets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/usb/mock_usb_device_handle.h ('k') | device/usb/usb_device_handle_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_H_ 5 #ifndef DEVICE_USB_USB_DEVICE_HANDLE_H_
6 #define DEVICE_USB_USB_DEVICE_HANDLE_H_ 6 #define DEVICE_USB_USB_DEVICE_HANDLE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 22 matching lines...) Expand all
33 USB_TRANSFER_CANCELLED, 33 USB_TRANSFER_CANCELLED,
34 USB_TRANSFER_STALLED, 34 USB_TRANSFER_STALLED,
35 USB_TRANSFER_DISCONNECT, 35 USB_TRANSFER_DISCONNECT,
36 USB_TRANSFER_OVERFLOW, 36 USB_TRANSFER_OVERFLOW,
37 USB_TRANSFER_LENGTH_SHORT, 37 USB_TRANSFER_LENGTH_SHORT,
38 }; 38 };
39 39
40 // UsbDeviceHandle class provides basic I/O related functionalities. 40 // UsbDeviceHandle class provides basic I/O related functionalities.
41 class UsbDeviceHandle : public base::RefCountedThreadSafe<UsbDeviceHandle> { 41 class UsbDeviceHandle : public base::RefCountedThreadSafe<UsbDeviceHandle> {
42 public: 42 public:
43 struct IsochronousPacket {
44 uint32_t length;
45 uint32_t transferred_length;
46 UsbTransferStatus status;
47 };
48
49 using ResultCallback = base::Callback<void(bool)>; 43 using ResultCallback = base::Callback<void(bool)>;
50 using TransferCallback = base::Callback< 44 using TransferCallback = base::Callback<
51 void(UsbTransferStatus, scoped_refptr<net::IOBuffer>, size_t)>; 45 void(UsbTransferStatus, scoped_refptr<net::IOBuffer>, size_t)>;
52 using IsochronousTransferCallback =
53 base::Callback<void(scoped_refptr<net::IOBuffer>,
54 const std::vector<IsochronousPacket>& packets)>;
55 46
56 enum TransferRequestType { STANDARD, CLASS, VENDOR, RESERVED }; 47 enum TransferRequestType { STANDARD, CLASS, VENDOR, RESERVED };
57 enum TransferRecipient { DEVICE, INTERFACE, ENDPOINT, OTHER }; 48 enum TransferRecipient { DEVICE, INTERFACE, ENDPOINT, OTHER };
58 49
59 virtual scoped_refptr<UsbDevice> GetDevice() const = 0; 50 virtual scoped_refptr<UsbDevice> GetDevice() const = 0;
60 51
61 // Notifies UsbDevice to drop the reference of this object; cancels all the 52 // Notifies UsbDevice to drop the reference of this object; cancels all the
62 // flying transfers. 53 // flying transfers.
63 // It is possible that the object has no other reference after this call. So 54 // It is possible that the object has no other reference after this call. So
64 // if it is called using a raw pointer, it could be invalidated. 55 // if it is called using a raw pointer, it could be invalidated.
(...skipping 18 matching lines...) Expand all
83 TransferRequestType request_type, 74 TransferRequestType request_type,
84 TransferRecipient recipient, 75 TransferRecipient recipient,
85 uint8_t request, 76 uint8_t request,
86 uint16_t value, 77 uint16_t value,
87 uint16_t index, 78 uint16_t index,
88 scoped_refptr<net::IOBuffer> buffer, 79 scoped_refptr<net::IOBuffer> buffer,
89 size_t length, 80 size_t length,
90 unsigned int timeout, 81 unsigned int timeout,
91 const TransferCallback& callback) = 0; 82 const TransferCallback& callback) = 0;
92 83
93 virtual void IsochronousTransferIn( 84 virtual void IsochronousTransfer(UsbEndpointDirection direction,
94 uint8_t endpoint_number, 85 uint8_t endpoint,
95 const std::vector<uint32_t>& packet_lengths, 86 scoped_refptr<net::IOBuffer> buffer,
96 unsigned int timeout, 87 size_t length,
97 const IsochronousTransferCallback& callback) = 0; 88 unsigned int packets,
98 89 unsigned int packet_length,
99 virtual void IsochronousTransferOut( 90 unsigned int timeout,
100 uint8_t endpoint_number, 91 const TransferCallback& callback) = 0;
101 scoped_refptr<net::IOBuffer> buffer,
102 const std::vector<uint32_t>& packet_lengths,
103 unsigned int timeout,
104 const IsochronousTransferCallback& callback) = 0;
105 92
106 virtual void GenericTransfer(UsbEndpointDirection direction, 93 virtual void GenericTransfer(UsbEndpointDirection direction,
107 uint8_t endpoint_number, 94 uint8_t endpoint,
108 scoped_refptr<net::IOBuffer> buffer, 95 scoped_refptr<net::IOBuffer> buffer,
109 size_t length, 96 size_t length,
110 unsigned int timeout, 97 unsigned int timeout,
111 const TransferCallback& callback) = 0; 98 const TransferCallback& callback) = 0;
112 99
113 // Gets the interface containing |endpoint_address|. Returns false if no 100 // Gets the interface containing |endpoint_address|. Returns false if no
114 // claimed interface contains that endpoint. 101 // claimed interface contains that endpoint.
115 virtual bool FindInterfaceByEndpoint(uint8_t endpoint_address, 102 virtual bool FindInterfaceByEndpoint(uint8_t endpoint_address,
116 uint8_t* interface_number) = 0; 103 uint8_t* interface_number) = 0;
117 104
118 protected: 105 protected:
119 friend class base::RefCountedThreadSafe<UsbDeviceHandle>; 106 friend class base::RefCountedThreadSafe<UsbDeviceHandle>;
120 107
121 UsbDeviceHandle(); 108 UsbDeviceHandle();
122 109
123 virtual ~UsbDeviceHandle(); 110 virtual ~UsbDeviceHandle();
124 111
125 private:
126 DISALLOW_COPY_AND_ASSIGN(UsbDeviceHandle); 112 DISALLOW_COPY_AND_ASSIGN(UsbDeviceHandle);
127 }; 113 };
128 114
129 } // namespace device 115 } // namespace device
130 116
131 #endif // DEVICE_USB_USB_DEVICE_HANDLE_H_ 117 #endif // DEVICE_USB_USB_DEVICE_HANDLE_H_
OLDNEW
« no previous file with comments | « device/usb/mock_usb_device_handle.h ('k') | device/usb/usb_device_handle_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698