| 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 module device.usb; | 5 module device.usb; |
| 6 | 6 |
| 7 enum OpenDeviceError { | 7 enum OpenDeviceError { |
| 8 // Opening the device succeeded. | 8 // Opening the device succeeded. |
| 9 OK, | 9 OK, |
| 10 | 10 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 // The transfer succeeded, but the device sent more data than was requested. | 133 // The transfer succeeded, but the device sent more data than was requested. |
| 134 // This applies only to inbound transfers. | 134 // This applies only to inbound transfers. |
| 135 BABBLE, | 135 BABBLE, |
| 136 | 136 |
| 137 // The transfer succeeded, but the device sent less data than was requested. | 137 // The transfer succeeded, but the device sent less data than was requested. |
| 138 // This applies only to inbound transfers. | 138 // This applies only to inbound transfers. |
| 139 SHORT_PACKET, | 139 SHORT_PACKET, |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 struct IsochronousPacket { |
| 143 uint32 length; |
| 144 uint32 transferred_length; |
| 145 TransferStatus status; |
| 146 }; |
| 147 |
| 142 interface Device { | 148 interface Device { |
| 143 // Retrieve a DeviceInfo struct containing metadata about the device, | 149 // Retrieve a DeviceInfo struct containing metadata about the device, |
| 144 // including the set of all available device configurations. | 150 // including the set of all available device configurations. |
| 145 GetDeviceInfo() => (DeviceInfo? info); | 151 GetDeviceInfo() => (DeviceInfo? info); |
| 146 | 152 |
| 147 // Retrieves the |configuration_value| of the device's currently active | 153 // Retrieves the |configuration_value| of the device's currently active |
| 148 // configuration. Will return 0 if the device is unconfigured. | 154 // configuration. Will return 0 if the device is unconfigured. |
| 149 GetConfiguration() => (uint8 value); | 155 GetConfiguration() => (uint8 value); |
| 150 | 156 |
| 151 // Opens the device. Methods below require the device be opened first. | 157 // Opens the device. Methods below require the device be opened first. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // completed or otherwise terminated. | 237 // completed or otherwise terminated. |
| 232 GenericTransferOut(uint8 endpoint_number, array<uint8> data, uint32 timeout) | 238 GenericTransferOut(uint8 endpoint_number, array<uint8> data, uint32 timeout) |
| 233 => (TransferStatus status); | 239 => (TransferStatus status); |
| 234 | 240 |
| 235 // Initiates an inbound isochronous transfer request on a specific endpoint. | 241 // Initiates an inbound isochronous transfer request on a specific endpoint. |
| 236 // The interface to which |endpoint_number| belongs must be claimed, and the | 242 // The interface to which |endpoint_number| belongs must be claimed, and the |
| 237 // appropriate alternate setting must be set on that interface before | 243 // appropriate alternate setting must be set on that interface before |
| 238 // transfers can be initiated on the endpoint. The endpoint must be of type | 244 // transfers can be initiated on the endpoint. The endpoint must be of type |
| 239 // ISOCHRONOUS. | 245 // ISOCHRONOUS. |
| 240 // | 246 // |
| 241 // |packet_length| specifies the maximum expected number of bytes to receive | 247 // |packet_lengths| specifies the maximum expected number of bytes to receive |
| 242 // for each packet in this transfer. |num_packets| specifies the maximum total | 248 // for each packet in this transfer. |
| 243 // number of packets to receive. | |
| 244 // | 249 // |
| 245 // |timeout| specifies the request timeout in milliseconds. A timeout of 0 | 250 // |timeout| specifies the request timeout in milliseconds. A timeout of 0 |
| 246 // indicates no timeout: the request will remain pending indefinitely until | 251 // indicates no timeout: the request will remain pending indefinitely until |
| 247 // completed or otherwise terminated. | 252 // completed or otherwise terminated. |
| 248 // | 253 // |
| 249 // |packets| contains the set of packets received from the device, in order. | 254 // |data| contains the data received from the device, if any. |packets| |
| 250 // No received packet's size will exceed |packet_length|, and will be null | 255 // contains the status of each packet received from the device, in order. The |
| 251 // if |status| is neither COMPLETED, BABBLE, or SHORT_PACKET. | 256 // length of the packet indicates its position in |data| while it's |
| 257 // transferred length gives the amount of data actually received from the |
| 258 // device. |
| 252 IsochronousTransferIn(uint8 endpoint_number, | 259 IsochronousTransferIn(uint8 endpoint_number, |
| 253 uint32 num_packets, | 260 array<uint32> packet_lengths, |
| 254 uint32 packet_length, | |
| 255 uint32 timeout) | 261 uint32 timeout) |
| 256 => (TransferStatus status, array<array<uint8>>? packets); | 262 => (array<uint8>? data, array<IsochronousPacket> packets); |
| 257 | 263 |
| 258 // Initiates an outbound isochronous transfer request on a specific endpoint. | 264 // Initiates an outbound isochronous transfer request on a specific endpoint. |
| 259 // The interface to which |endpoint_number| belongs must be claimed, and the | 265 // The interface to which |endpoint_number| belongs must be claimed, and the |
| 260 // appropriate alternate setting must be set on that interface before | 266 // appropriate alternate setting must be set on that interface before |
| 261 // transfers can be initiated on the endpoint. The endpoint must be of type | 267 // transfers can be initiated on the endpoint. The endpoint must be of type |
| 262 // ISOCHRONOUS. | 268 // ISOCHRONOUS. |
| 263 // | 269 // |
| 264 // |packets| specifies the series of data packets to send to the device for | 270 // |data| specifies the bytes to send to the device. |
| 265 // this transfer. | 271 // |
| 272 // |packet_lengths| specifies how |data| should be separated into packets when |
| 273 // it is sent to the device. |
| 266 // | 274 // |
| 267 // |timeout| specifies the request timeout in milliseconds. A timeout of 0 | 275 // |timeout| specifies the request timeout in milliseconds. A timeout of 0 |
| 268 // indicates no timeout: the request will remain pending indefinitely until | 276 // indicates no timeout: the request will remain pending indefinitely until |
| 269 // completed or otherwise terminated. | 277 // completed or otherwise terminated. |
| 278 |
| 279 // |packets| contains the status of each packet sent to the device, in order. |
| 270 IsochronousTransferOut(uint8 endpoint_number, | 280 IsochronousTransferOut(uint8 endpoint_number, |
| 271 array<array<uint8>> packets, | 281 array<uint8> data, |
| 282 array<uint32> packet_lengths, |
| 272 uint32 timeout) | 283 uint32 timeout) |
| 273 => (TransferStatus status); | 284 => (array<IsochronousPacket> packets); |
| 274 }; | 285 }; |
| OLD | NEW |