Language

UsbDeviceConnection.ControlTransferAsync Method

Definition

Overloads

Name Description
ControlTransferAsync(UsbAddressing, Int32, Int32, Int32, Byte[], Int32, Int32)

Runs a control transfer on the device's endpoint zero in a task.

ControlTransferAsync(UsbAddressing, Int32, Int32, Int32, Byte[], Int32, Int32, Int32)

Runs a control transfer from the given buffer offset on the device's endpoint zero in a task.

ControlTransferAsync(UsbAddressing, Int32, Int32, Int32, Byte[], Int32, Int32)

Runs a control transfer on the device's endpoint zero in a task.

public System.Threading.Tasks.Task<int> ControlTransferAsync(Android.Hardware.Usb.UsbAddressing requestType, int request, int value, int index, byte[]? buffer, int length, int timeout);
member this.ControlTransferAsync : Android.Hardware.Usb.UsbAddressing * int * int * int * byte[] * int * int -> System.Threading.Tasks.Task<int>

Parameters

requestType
UsbAddressing

The USB request type, which includes the transfer direction.

request
Int32

The USB request ID.

value
Int32

The value field of the USB control request.

index
Int32

The index field of the USB control request.

buffer
Byte[]

The buffer for the data portion of the request, starting at index zero, or null for a request without data.

length
Int32

The number of bytes to send or receive. Must be nonnegative and no greater than the buffer length, or zero when buffer is null.

timeout
Int32

The transfer timeout in milliseconds.

Returns

A task whose result is the number of bytes transferred, including zero, on success, or a negative value on failure.

Remarks

This .NET method uses Run<TResult>(Func<TResult>) to call ControlTransfer(UsbAddressing, Int32, Int32, Int32, Byte[], Int32, Int32). Keep the connection open and do not read or change the buffer until the task completes. The direction bit in requestType selects a read from or write to the device.

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

ControlTransferAsync(UsbAddressing, Int32, Int32, Int32, Byte[], Int32, Int32, Int32)

Runs a control transfer from the given buffer offset on the device's endpoint zero in a task.

public System.Threading.Tasks.Task<int> ControlTransferAsync(Android.Hardware.Usb.UsbAddressing requestType, int request, int value, int index, byte[]? buffer, int offset, int length, int timeout);
member this.ControlTransferAsync : Android.Hardware.Usb.UsbAddressing * int * int * int * byte[] * int * int * int -> System.Threading.Tasks.Task<int>

Parameters

requestType
UsbAddressing

The USB request type, which includes the transfer direction.

request
Int32

The USB request ID.

value
Int32

The value field of the USB control request.

index
Int32

The index field of the USB control request.

buffer
Byte[]

The buffer for the data portion of the request, or null for a request without data.

offset
Int32

The nonnegative index of the first byte to send or receive in buffer. Must be zero when buffer is null.

length
Int32

The number of bytes to send or receive. Must be nonnegative, and the range starting at offset must fit within the buffer. Must be zero when buffer is null.

timeout
Int32

The transfer timeout in milliseconds.

Returns

A task whose result is the number of bytes transferred, including zero, on success, or a negative value on failure.

Remarks

This .NET method uses Run<TResult>(Func<TResult>) to call ControlTransfer(UsbAddressing, Int32, Int32, Int32, Byte[], Int32, Int32, Int32). Keep the connection open and do not read or change the buffer until the task completes. The direction bit in requestType selects a read from or write to the device.

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