Skip to main content

RawDevice Class

Namespace: GHIElectronics.TinyCLR.Devices.UsbClient · Assembly: GHIElectronics.TinyCLR.Devices.UsbClient

Represent a USB device.

public class RawDevice

Constructors

RawDevice(UsbClientController usbClientController, UsbClientSetting usbClientSetting)

public RawDevice(UsbClientController usbClientController, UsbClientSetting usbClientSetting)

Creates a new raw device.

ParameterTypeDescription
usbClientControllerUsbClientControllerUsbClient controller.
usbClientSettingUsbClientSettingUsbClient setting

Properties

MaxEndpoint

public static int MaxEndpoint { get; }

The maximum number of endpoints.

MaxStreams

public static int MaxStreams { get; }

The maximum number of streams.

VendorId

public ushort VendorId { get; }

The vendor id of the device.

ProductId

public ushort ProductId { get; }

The product id of the device.

BcdUsb

public ushort BcdUsb { get; }

The version of the device.

BcdDevice

public ushort BcdDevice { get; }

The version of the device.

MaximumPower

public ushort MaximumPower { get; }

The maximum power the device might need.

Manufacturer

public string Manufacturer { get; }

The manufacturer of the device.

Product

public string Product { get; }

The product name.

SerialNumber

public string SerialNumber { get; }

The serial number of the device.

DeviceState

public DeviceState DeviceState { get; }

No description available.

Methods

ReserveNewEndpoint()

public int ReserveNewEndpoint()

Gets the next available endpoint.

Returns int — The endpoint number.

ReserveNewEndpoint(int endpoint)

public void ReserveNewEndpoint(int endpoint)

Reserves the given endpoint.

ParameterTypeDescription
endpointintThe specific endpoint number to reserve.

AddDescriptor(Configuration.Descriptor descriptor)

public void AddDescriptor(Configuration.Descriptor descriptor)

Adds a descriptor to the device.

ParameterTypeDescription
descriptorConfiguration.DescriptorThe descriptor to add.

AddInterface(Configuration.UsbInterface usbInterface, string interfaceString)

public byte AddInterface(Configuration.UsbInterface usbInterface, string interfaceString)

Adds an interface to the device.

ParameterTypeDescription
usbInterfaceConfiguration.UsbInterfaceThe interface.
interfaceStringstringThe interface name.

Returns byte — The assigned interface index.

Enable()

public virtual void Enable()

Re-enables interrupts after a matching Disable. (inherited)

Disable()

public virtual void Disable()

Disables interrupts on the current core. Always pair with Enable. (inherited)

Dispose()

public void Dispose()

Releases buffered memory (the unmanaged firmware/application buffers). (inherited)

CreateStream(int writeEndpoint, int readEndpoint)

public RawStream CreateStream(int writeEndpoint, int readEndpoint)

Creates a steam for reading and writing to the device.

ParameterTypeDescription
writeEndpointintThe write endpoint. Use RawStream.NullEndpoint if not available.
readEndpointintThe read endpoint. Use RawStream.NullEndpoint if not available.

Returns RawStream — The new stream.

SetInterfaceMap(byte interfaceIndex, byte data1, byte data2, byte data3)

public void SetInterfaceMap(byte interfaceIndex, byte data1, byte data2, byte data3)

No description available.

ParameterTypeDescription
interfaceIndexbyte
data1byte
data2byte
data3byte

CreateStream(int index, RawDevice parent)

protected virtual RawStream CreateStream(int index, RawDevice parent)

Creates a new instance of the stream type for this device type.

ParameterTypeDescription
indexintThe index of the stream
parentRawDeviceThe owning raw device.

Returns RawStream — The new stream.

Events

DeviceStateChanged

public event DeviceStateChangedEventHandler DeviceStateChanged

No description available.

Fields

MAX_POWER

public const ushort MAX_POWER

No description available.

GHI_VID

public const ushort GHI_VID

No description available.