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

Side by Side Diff: public/platform/modules/webusb/WebUSBDevice.h

Issue 1315683002: WebUSB bindings part 6 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: remote USBTransferStatus.idl Created 5 years, 3 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 | « Source/modules/webusb/USBOutTransferResult.idl ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 WebUSBDeviceSetConfigurationCallbacks = WebCallbacks<void, const WebUSBErr or&>; 20 using WebUSBDeviceSetConfigurationCallbacks = WebCallbacks<void, const WebUSBErr or&>;
21 using WebUSBDeviceClaimInterfaceCallbacks = WebCallbacks<void, const WebUSBError &>; 21 using WebUSBDeviceClaimInterfaceCallbacks = WebCallbacks<void, const WebUSBError &>;
22 using WebUSBDeviceReleaseInterfaceCallbacks = WebCallbacks<void, const WebUSBErr or&>; 22 using WebUSBDeviceReleaseInterfaceCallbacks = WebCallbacks<void, const WebUSBErr or&>;
23 using WebUSBDeviceResetCallbacks = WebCallbacks<void, const WebUSBError&>; 23 using WebUSBDeviceResetCallbacks = WebCallbacks<void, const WebUSBError&>;
24 using WebUSBDeviceSetInterfaceAlternateSettingCallbacks = WebCallbacks<void, con st WebUSBError&>; 24 using WebUSBDeviceSetInterfaceAlternateSettingCallbacks = WebCallbacks<void, con st WebUSBError&>;
25 using WebUSBDeviceClearHaltCallbacks = WebCallbacks<void, const WebUSBError&>; 25 using WebUSBDeviceClearHaltCallbacks = WebCallbacks<void, const WebUSBError&>;
26 using WebUSBDeviceControlTransferCallbacks = WebCallbacks<WebPassOwnPtr<WebUSBTr ansferInfo>, const WebUSBError&>; 26 using WebUSBDeviceTransferCallbacks = WebCallbacks<WebPassOwnPtr<WebUSBTransferI nfo>, const WebUSBError&>;
27 using WebUSBDeviceBulkTransferCallbacks = WebCallbacks<WebPassOwnPtr<WebUSBTrans ferInfo>, const WebUSBError&>; 27
28 using WebUSBDeviceInterruptTransferCallbacks = WebCallbacks<WebPassOwnPtr<WebUSB TransferInfo>, const WebUSBError&>; 28 // TODO(rockot): Eliminate these aliases once they're no longer used outside of
29 // Blink code.
30 using WebUSBDeviceControlTransferCallbacks = WebUSBDeviceTransferCallbacks;
31 using WebUSBDeviceBulkTransferCallbacks = WebUSBDeviceTransferCallbacks;
32 using WebUSBDeviceInterruptTransferCallbacks = WebUSBDeviceTransferCallbacks;
29 33
30 class WebUSBDevice { 34 class WebUSBDevice {
31 public: 35 public:
32 enum class TransferDirection { 36 enum class TransferDirection {
33 In, 37 In,
34 Out, 38 Out,
35 }; 39 };
36 40
37 enum class RequestType { 41 enum class RequestType {
38 Standard, 42 Standard,
39 Class, 43 Class,
40 Vendor, 44 Vendor,
41 }; 45 };
42 46
43 enum RequestRecipient { 47 enum class RequestRecipient {
44 Device, 48 Device,
45 Interface, 49 Interface,
46 Endpoint, 50 Endpoint,
47 Other, 51 Other,
48 }; 52 };
49 53
50 struct ControlTransferParameters { 54 struct ControlTransferParameters {
51 TransferDirection direction; 55 TransferDirection direction;
52 RequestType type; 56 RequestType type;
53 RequestRecipient recipient; 57 RequestRecipient recipient;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 virtual void transfer(TransferDirection, uint8_t endpointNumber, uint8_t* da ta, size_t dataSize, unsigned timeout, WebUSBDeviceBulkTransferCallbacks*) = 0; 101 virtual void transfer(TransferDirection, uint8_t endpointNumber, uint8_t* da ta, size_t dataSize, unsigned timeout, WebUSBDeviceBulkTransferCallbacks*) = 0;
98 102
99 // Resets the device. 103 // Resets the device.
100 // Ownership of the WebUSBDeviceResetCallbacks is transferred to the client. 104 // Ownership of the WebUSBDeviceResetCallbacks is transferred to the client.
101 virtual void reset(WebUSBDeviceResetCallbacks*) = 0; 105 virtual void reset(WebUSBDeviceResetCallbacks*) = 0;
102 }; 106 };
103 107
104 } // namespace blink 108 } // namespace blink
105 109
106 #endif // WebUSBDevice_h 110 #endif // WebUSBDevice_h
OLDNEW
« no previous file with comments | « Source/modules/webusb/USBOutTransferResult.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698