Skip to main content

Configuration Class

Namespace: GHIElectronics.TinyCLR.Devices.UsbHost.Descriptors · Assembly: GHIElectronics.TinyCLR.Devices.UsbHost

Configuration descriptor.

public class Configuration : BaseDescriptor

Constructors

Configuration(byte[] buffer)

public Configuration(byte[] buffer) : this(buffer, 0)

Constructs a new descriptor.

ParameterTypeDescription
bufferbyte[]The buffer with which to populate the descriptor.

Configuration(byte[] buffer, int offset)

public Configuration(byte[] buffer, int offset) : this()

Constructs a new descriptor.

ParameterTypeDescription
bufferbyte[]The buffer with which to populate the descriptor.
offsetintThe offset into the buffer at which to start.

Configuration()

protected Configuration() : base(DescriptorType.Configuration, Configuration.LENGTH)

Constructs a new descriptor.

Properties

TotalLength

public ushort TotalLength { get; set; }

Total length of the the data returned in bytes.

NumberOfInterfaces

public byte NumberOfInterfaces { get; set; }

The number of interfaces.

Value

public byte Value { get; set; }

The value to be used as an argument to select this configuration.

Index

public byte Index { get; set; }

The configuration string descriptor index.

Attributes

public byte Attributes { get; set; }

A bitmap representing the attributes of the device.

MaxPower

public byte MaxPower { get; set; }

The maximum power consumption in 2mA units.

AuxiliaryDescriptors

public Auxiliary[] AuxiliaryDescriptors { get; set; }

Child auxiliary descriptors.

Interfaces

public Interface[] Interfaces { get; set; }

Child interface descriptors.

Methods

FillChildren(byte[] bytes, int offset)

public void FillChildren(byte[] bytes, int offset)

Walks a config-descriptor blob from offset to the end and fills Interfaces, the nested endpoints, and AuxiliaryDescriptors.

ParameterTypeDescription
bytesbyte[]The full configuration-descriptor blob (length = TotalLength).
offsetintByte offset to start parsing children — typically LENGTH when the blob starts with the configuration header.

Fields

LENGTH

public const byte LENGTH

The length of the descriptor in bytes.