Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // TODO(gdk): The string-style enumerations are temporary, and will be removed | 5 // TODO(gdk): The string-style enumerations are temporary, and will be removed |
| 6 // once full enumeration support is added. Also, the array-of-longs are | 6 // once full enumeration support is added. Also, the array-of-longs are |
| 7 // temporary and will be removed once there is full ArrayBuffer support. | 7 // temporary and will be removed once there is full ArrayBuffer support. |
|
miket_OOO
2012/06/18 16:30:14
This last sentence is now obsolete.
Garret Kelly
2012/06/18 18:21:26
Good catch. Done.
| |
| 8 | 8 |
| 9 [nodoc] namespace experimental.usb { | 9 [nodoc] namespace experimental.usb { |
| 10 | 10 |
| 11 // A Device encapsulates everything that is needed to communicate with a USB | 11 // A Device encapsulates everything that is needed to communicate with a USB |
| 12 // device. They are returned by findDevice calls and have all of their | 12 // device. They are returned by findDevice calls and have all of their |
| 13 // fields populated before being returned. | 13 // fields populated before being returned. |
| 14 dictionary Device { | 14 dictionary Device { |
| 15 long handle; | 15 long handle; |
| 16 long vendorId; | 16 long vendorId; |
| 17 long productId; | 17 long productId; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 35 long value; | 35 long value; |
| 36 long index; | 36 long index; |
| 37 | 37 |
| 38 // If this transfer is an input transfer, then this field must be set to | 38 // If this transfer is an input transfer, then this field must be set to |
| 39 // indicate the expected data length. If this is an output transfer, then | 39 // indicate the expected data length. If this is an output transfer, then |
| 40 // this field is ignored. | 40 // this field is ignored. |
| 41 long? length; | 41 long? length; |
| 42 | 42 |
| 43 // The data payload carried by this transfer. If this is an output tranfer | 43 // The data payload carried by this transfer. If this is an output tranfer |
| 44 // then this field must be set. | 44 // then this field must be set. |
| 45 long[]? data; | 45 ArrayBuffer? data; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 // GenericTransferInfo is used by both bulk and interrupt transfers to | 48 // GenericTransferInfo is used by both bulk and interrupt transfers to |
| 49 // specify the parameters of the transfer. | 49 // specify the parameters of the transfer. |
| 50 dictionary GenericTransferInfo { | 50 dictionary GenericTransferInfo { |
| 51 // The direction of this transfer. Must be one of in or out. | 51 // The direction of this transfer. Must be one of in or out. |
| 52 DOMString direction; | 52 DOMString direction; |
| 53 | 53 |
| 54 long endpoint; | 54 long endpoint; |
| 55 | 55 |
| 56 // If this is an input transfer then this field indicates the size of the | 56 // If this is an input transfer then this field indicates the size of the |
| 57 // input buffer. If this is an output transfer then this field is ignored. | 57 // input buffer. If this is an output transfer then this field is ignored. |
| 58 long? length; | 58 long? length; |
| 59 | 59 |
| 60 // If this is an output transfer then this field must be populated. | 60 // If this is an output transfer then this field must be populated. |
| 61 // Otherwise, it will be ignored. | 61 // Otherwise, it will be ignored. |
| 62 long[]? data; | 62 ArrayBuffer? data; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 // IsochronousTransferInfo describes a single multi-packet isochronous | 65 // IsochronousTransferInfo describes a single multi-packet isochronous |
| 66 // transfer. | 66 // transfer. |
| 67 dictionary IsochronousTransferInfo { | 67 dictionary IsochronousTransferInfo { |
| 68 // All of the normal transfer parameters are encapsulated in the | 68 // All of the normal transfer parameters are encapsulated in the |
| 69 // transferInfo parameters. Note that the data specified in this parameter | 69 // transferInfo parameters. Note that the data specified in this parameter |
| 70 // block is split along packetLength boundaries to form the individual | 70 // block is split along packetLength boundaries to form the individual |
| 71 // packets of the transfer. | 71 // packets of the transfer. |
| 72 GenericTransferInfo transferInfo; | 72 GenericTransferInfo transferInfo; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 85 // A string indicating the type of the event. Currently will only contain | 85 // A string indicating the type of the event. Currently will only contain |
| 86 // the value 'transferResult'. | 86 // the value 'transferResult'. |
| 87 DOMString type; | 87 DOMString type; |
| 88 | 88 |
| 89 // A value of 0 indicates that the transfer was a success. Other values | 89 // A value of 0 indicates that the transfer was a success. Other values |
| 90 // indicate failure. | 90 // indicate failure. |
| 91 long? resultCode; | 91 long? resultCode; |
| 92 | 92 |
| 93 // If the transfer was an input transfer then this field will contain all | 93 // If the transfer was an input transfer then this field will contain all |
| 94 // of the input data requested. | 94 // of the input data requested. |
| 95 long[]? data; | 95 ArrayBuffer? data; |
| 96 | 96 |
| 97 // The following fields are used for internal event routing and can be | 97 // The following fields are used for internal event routing and can be |
| 98 // ignored. | 98 // ignored. |
| 99 [nodoc] boolean isFinalEvent; | 99 [nodoc] boolean isFinalEvent; |
| 100 [nodoc] long srcId; | 100 [nodoc] long srcId; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 callback OnEventCallback = void (UsbEvent event); | 103 callback OnEventCallback = void (UsbEvent event); |
| 104 | 104 |
| 105 dictionary DeviceOptions { | 105 dictionary DeviceOptions { |
| 106 // The schema generator does not support dictionaries with only events. | |
| 107 // Ignore this field. | |
| 108 [nodoc] long? dummyValue; | |
| 109 | |
| 110 // Invoked by the extension API whenever an event occurs for the device(s) | 106 // Invoked by the extension API whenever an event occurs for the device(s) |
| 111 // that this DeviceOptions is associated with. | 107 // that this DeviceOptions is associated with. |
| 112 OnEventCallback? onEvent; | 108 OnEventCallback? onEvent; |
| 113 }; | 109 }; |
| 114 | 110 |
| 115 callback FindDeviceCallback = void (optional Device device); | 111 callback FindDeviceCallback = void (optional Device device); |
| 116 callback TransferCallback = void (); | 112 callback TransferCallback = void (); |
| 117 | 113 |
| 118 interface Functions { | 114 interface Functions { |
| 119 // Finds the first instance of the USB device specified by the vendorId/ | 115 // Finds the first instance of the USB device specified by the vendorId/ |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 static void isochronousTransfer(Device device, | 158 static void isochronousTransfer(Device device, |
| 163 IsochronousTransferInfo transferInfo, | 159 IsochronousTransferInfo transferInfo, |
| 164 optional TransferCallback callback); | 160 optional TransferCallback callback); |
| 165 }; | 161 }; |
| 166 | 162 |
| 167 interface Events { | 163 interface Events { |
| 168 static void onEvent(UsbEvent event); | 164 static void onEvent(UsbEvent event); |
| 169 }; | 165 }; |
| 170 | 166 |
| 171 }; | 167 }; |
| OLD | NEW |