UsbDeviceConnection.RequestWaitAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| RequestWaitAsync() |
Runs an indefinite wait for a queued USB request to complete in a task. |
| RequestWaitAsync(Int64) |
Runs a wait for a queued USB request to complete, with a timeout, in a task. |
RequestWaitAsync()
Runs an indefinite wait for a queued USB request to complete in a task.
public System.Threading.Tasks.Task<Android.Hardware.Usb.UsbRequest?> RequestWaitAsync();
member this.RequestWaitAsync : unit -> System.Threading.Tasks.Task<Android.Hardware.Usb.UsbRequest>
Returns
A task whose result is a completed USB request, or null if an error occurred.
Remarks
This .NET method uses Run<TResult>(Func<TResult>) to call RequestWait(). It can return requests from any endpoint on this connection. Use the returned request's Endpoint and ClientData to identify the operation.
Exceptions from the wait fault the task. For requests queued with Queue(ByteBuffer, int), if a transfer exceeds the request buffer's limit, Android 8 (API level 26) and later use BufferOverflowException for applications that target API level 26 or later, and IllegalArgumentException for applications that target earlier API levels. Earlier Android versions throw IllegalArgumentException regardless of the application's target API level.
Implementation sources: .NET task wrapper generator and Android USB connection implementation.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
RequestWaitAsync(Int64)
Runs a wait for a queued USB request to complete, with a timeout, in a task.
public System.Threading.Tasks.Task<Android.Hardware.Usb.UsbRequest?> RequestWaitAsync(long timeout);
member this.RequestWaitAsync : int64 -> System.Threading.Tasks.Task<Android.Hardware.Usb.UsbRequest>
Parameters
- timeout
- Int64
The nonnegative wait timeout in milliseconds. Zero checks for a completed request without waiting; it does not mean an infinite wait.
Returns
A task whose result is a completed USB request, or null if an error occurred. If no request completes within the timeout, the task faults with TimeoutException.
Remarks
This .NET method uses Run<TResult>(Func<TResult>) to call RequestWait(Int64). The timeout applies when that call runs, not when the task is created. This overload requires Android 8 (API level 26) or later.
The result can be a request from any endpoint on this connection. Use the returned request's Endpoint and ClientData to identify the operation. A zero timeout can miss a newly queued request because Android processes requests asynchronously.
Exceptions from the wait fault the task. A negative timeout causes IllegalArgumentException. For requests queued with Queue(ByteBuffer, int), if a transfer exceeds the request buffer's limit, the wait throws BufferOverflowException.
Implementation sources: .NET task wrapper generator and Android USB connection implementation.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.