Skip to main content

UsbClientControllerApiWrapper Class

NuGet: GHIElectronics.TinyCLR.Devices.UsbClient
Assembly: GHIElectronics.TinyCLR.Devices.UsbClient
Namespace: GHIElectronics.TinyCLR.Devices.UsbClient.Provider

The native implementation of a USB client controller provider.

public class UsbClientControllerApiWrapper : IUsbClientControllerProvider

Constructors

UsbClientControllerApiWrapper(NativeApi api)

public UsbClientControllerApiWrapper(NativeApi api)

Creates a new provider for the given native API.

Properties

Api

public NativeApi Api { get; }

The native API backing this provider.

DeviceState

public DeviceState DeviceState { get; }

The current state of the device. (inherited)

WriteBufferSize

public extern int WriteBufferSize { get; set; }

The size of the write buffer. (inherited)

ReadBufferSize

public extern int ReadBufferSize { get; set; }

The size of the read buffer. (inherited)

Methods

Dispose()

public void Dispose()

Disposes the provider.

Dispose(bool disposing)

protected virtual void Dispose(bool disposing)

Disposes the provider.

BytesToRead(int streamIndex)

public int BytesToRead(int streamIndex)

The number of bytes available to read on the given stream. (inherited)

Returns int

BytesToWrite(int streamIndex)

public int BytesToWrite(int streamIndex)

The number of bytes that are in the process of being written on the given stream. (inherited)

Returns int

Enable()

public extern void Enable()

Enables the device. (inherited)

Disable()

public extern void Disable()

Disables the device. (inherited)

SetActiveSetting(UsbClientSetting setting)

public extern void SetActiveSetting(UsbClientSetting setting)

Sets the active device setting. (inherited)

Read(int streamIndex, byte[] data, int offset, int count)

public extern int Read(int streamIndex, byte[] data, int offset, int count)

Reads data from the given stream. (inherited)

Returns int

Write(int streamIndex, byte[] data, int offset, int count)

public extern int Write(int streamIndex, byte[] data, int offset, int count)

Writes data to the given stream. (inherited)

Returns int

Flush(int streamIndex)

public extern void Flush(int streamIndex)

Flushes the write buffer of the given stream. (inherited)

ClearReadBuffer(int streamIndex)

public extern void ClearReadBuffer(int streamIndex)

Clears the read buffer of the given stream. (inherited)

ClearWriteBuffer(int streamIndex)

public extern void ClearWriteBuffer(int streamIndex)

Clears the write buffer of the given stream. (inherited)

GetControlPacketSize()

public extern int GetControlPacketSize()

Gets the maximum control packet size. (inherited)

Returns int

GetEndpointMap()

public extern ushort GetEndpointMap()

Gets a bitmap of the reserved endpoints. (inherited)

Returns ushort

SetDeviceDescriptor(Configuration.DeviceDescriptor[] deviceDescriptor)

public extern void SetDeviceDescriptor(Configuration.DeviceDescriptor[] deviceDescriptor)

Sets the device descriptor. (inherited)

SetConfigurationDescriptor(Configuration.ConfigurationDescriptor[] configurationDescriptor)

public extern void SetConfigurationDescriptor(Configuration.ConfigurationDescriptor[] configurationDescriptor)

Sets the configuration descriptor. (inherited)

SetStringDescriptor(Configuration.StringDescriptor[] stringDescriptor, uint index)

public extern void SetStringDescriptor(Configuration.StringDescriptor[] stringDescriptor, uint index)

Sets the string descriptor at the given index. (inherited)

SetGenericDescriptor(Configuration.GenericDescriptor[] genericDescriptor)

public extern void SetGenericDescriptor(Configuration.GenericDescriptor[] genericDescriptor)

Sets the generic descriptor. (inherited)

Events

DataReceived

public event DataReceivedEventHandler DataReceived

Raised when data is received from the host.

DeviceStateChanged

public event DeviceStateChangedEventHandler DeviceStateChanged

Raised when the device state changes.