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