OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 WebUSBDevice_h | 5 #ifndef WebUSBDevice_h |
6 #define WebUSBDevice_h | 6 #define WebUSBDevice_h |
7 | 7 |
8 #include "public/platform/WebCallbacks.h" | 8 #include "public/platform/WebCallbacks.h" |
9 #include "public/platform/WebPassOwnPtr.h" | 9 #include "public/platform/WebPassOwnPtr.h" |
10 #include "public/platform/WebVector.h" | 10 #include "public/platform/WebVector.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 struct WebUSBDeviceInfo; | 14 struct WebUSBDeviceInfo; |
15 struct WebUSBError; | 15 struct WebUSBError; |
16 struct WebUSBTransferInfo; | 16 struct WebUSBTransferInfo; |
17 | 17 |
18 using WebUSBDeviceOpenCallbacks = WebCallbacks<void, const WebUSBError&>; | 18 using WebUSBDeviceOpenCallbacks = WebCallbacks<void, const WebUSBError&>; |
19 using WebUSBDeviceCloseCallbacks = WebCallbacks<void, const WebUSBError&>; | 19 using WebUSBDeviceCloseCallbacks = WebCallbacks<void, const WebUSBError&>; |
20 using WebUSBDeviceGetConfigurationCallbacks = WebCallbacks<uint8_t, const WebUSB
Error&>; | 20 using WebUSBDeviceGetConfigurationCallbacks = WebCallbacks<uint8_t, const WebUSB
Error&>; |
21 using WebUSBDeviceSetConfigurationCallbacks = WebCallbacks<void, const WebUSBErr
or&>; | 21 using WebUSBDeviceSetConfigurationCallbacks = WebCallbacks<void, const WebUSBErr
or&>; |
22 using WebUSBDeviceClaimInterfaceCallbacks = WebCallbacks<void, const WebUSBError
&>; | 22 using WebUSBDeviceClaimInterfaceCallbacks = WebCallbacks<void, const WebUSBError
&>; |
23 using WebUSBDeviceReleaseInterfaceCallbacks = WebCallbacks<void, const WebUSBErr
or&>; | 23 using WebUSBDeviceReleaseInterfaceCallbacks = WebCallbacks<void, const WebUSBErr
or&>; |
24 using WebUSBDeviceResetCallbacks = WebCallbacks<void, const WebUSBError&>; | 24 using WebUSBDeviceResetCallbacks = WebCallbacks<void, const WebUSBError&>; |
25 using WebUSBDeviceSetInterfaceAlternateSettingCallbacks = WebCallbacks<void, con
st WebUSBError&>; | 25 using WebUSBDeviceSetInterfaceAlternateSettingCallbacks = WebCallbacks<void, con
st WebUSBError&>; |
26 using WebUSBDeviceClearHaltCallbacks = WebCallbacks<void, const WebUSBError&>; | 26 using WebUSBDeviceClearHaltCallbacks = WebCallbacks<void, const WebUSBError&>; |
27 using WebUSBDeviceTransferCallbacks = WebCallbacks<WebPassOwnPtr<WebUSBTransferI
nfo>, const WebUSBError&>; | 27 using WebUSBDeviceTransferCallbacks = WebCallbacks<WebPassOwnPtr<WebUSBTransferI
nfo>, const WebUSBError&>; |
28 | 28 |
29 // TODO(rockot): Eliminate these aliases once they're no longer used outside of | |
30 // Blink code. | |
31 using WebUSBDeviceControlTransferCallbacks = WebUSBDeviceTransferCallbacks; | |
32 using WebUSBDeviceBulkTransferCallbacks = WebUSBDeviceTransferCallbacks; | |
33 using WebUSBDeviceInterruptTransferCallbacks = WebUSBDeviceTransferCallbacks; | |
34 | |
35 class WebUSBDevice { | 29 class WebUSBDevice { |
36 public: | 30 public: |
37 enum class TransferDirection { | 31 enum class TransferDirection { |
38 In, | 32 In, |
39 Out, | 33 Out, |
40 }; | 34 }; |
41 | 35 |
42 enum class RequestType { | 36 enum class RequestType { |
43 Standard, | 37 Standard, |
44 Class, | 38 Class, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 85 |
92 // Sets the alternate setting of an interface. | 86 // Sets the alternate setting of an interface. |
93 // Ownership of the WebUSBDeviceSetInterfaceAlternateSettingCallbacks is tra
nsferred to the client. | 87 // Ownership of the WebUSBDeviceSetInterfaceAlternateSettingCallbacks is tra
nsferred to the client. |
94 virtual void setInterface(uint8_t interfaceNumber, uint8_t alternateSetting,
WebUSBDeviceSetInterfaceAlternateSettingCallbacks*) = 0; | 88 virtual void setInterface(uint8_t interfaceNumber, uint8_t alternateSetting,
WebUSBDeviceSetInterfaceAlternateSettingCallbacks*) = 0; |
95 | 89 |
96 // Clears the halt condition on a specific endpoint. | 90 // Clears the halt condition on a specific endpoint. |
97 // Ownership of the WebUSBDeviceClearHaltCallbacks is transferred to the cli
ent. | 91 // Ownership of the WebUSBDeviceClearHaltCallbacks is transferred to the cli
ent. |
98 virtual void clearHalt(uint8_t endpointNumber, WebUSBDeviceClearHaltCallback
s*) = 0; | 92 virtual void clearHalt(uint8_t endpointNumber, WebUSBDeviceClearHaltCallback
s*) = 0; |
99 | 93 |
100 // Initiates a control transfer. | 94 // Initiates a control transfer. |
101 // Ownership of the WebUSBDeviceControlTransferCallbacks is transferred to t
he client. | 95 // Ownership of the WebUSBDeviceTransferCallbacks is transferred to the clie
nt. |
102 virtual void controlTransfer(const ControlTransferParameters&, uint8_t* data
, size_t dataSize, unsigned timeout, WebUSBDeviceControlTransferCallbacks*) = 0; | 96 virtual void controlTransfer(const ControlTransferParameters&, uint8_t* data
, size_t dataSize, unsigned timeout, WebUSBDeviceTransferCallbacks*) = 0; |
103 | 97 |
104 // Initiates a bulk or interrupt transfer. | 98 // Initiates a bulk or interrupt transfer. |
105 // Ownership of the WebUSBDeviceBulkTransferCallbacks is transferred to the
client. | 99 // Ownership of the WebUSBDeviceTransferCallbacks is transferred to the clie
nt. |
106 virtual void transfer(TransferDirection, uint8_t endpointNumber, uint8_t* da
ta, size_t dataSize, unsigned timeout, WebUSBDeviceBulkTransferCallbacks*) = 0; | 100 virtual void transfer(TransferDirection, uint8_t endpointNumber, uint8_t* da
ta, size_t dataSize, unsigned timeout, WebUSBDeviceTransferCallbacks*) = 0; |
| 101 |
| 102 // Initiates an isochronous transfer. |
| 103 // Ownership of the WebUSBDeviceTransferCallbacks is transferred to the clie
nt. |
| 104 virtual void isochronousTransfer(TransferDirection, uint8_t endpointNumber,
uint8_t* data, size_t dataSize, WebVector<unsigned> packetLengths, unsigned time
out, WebUSBDeviceTransferCallbacks*) = 0; |
107 | 105 |
108 // Resets the device. | 106 // Resets the device. |
109 // Ownership of the WebUSBDeviceResetCallbacks is transferred to the client. | 107 // Ownership of the WebUSBDeviceResetCallbacks is transferred to the client. |
110 virtual void reset(WebUSBDeviceResetCallbacks*) = 0; | 108 virtual void reset(WebUSBDeviceResetCallbacks*) = 0; |
111 }; | 109 }; |
112 | 110 |
113 } // namespace blink | 111 } // namespace blink |
114 | 112 |
115 #endif // WebUSBDevice_h | 113 #endif // WebUSBDevice_h |
OLD | NEW |