Package ch.ntb.usb

# Class Usb_Device_Descriptor

java.lang.Object
ch.ntb.usb.Usb_Descriptor
ch.ntb.usb.Usb_Device_Descriptor

public class Usb_Device_Descriptor extends Usb_Descriptor
Represents the descriptor of a USB device.
A USB device can only have one device descriptor. It specifies some basic, yet important information about the device.
The length of the device descriptor is `Usb_Descriptor.USB_DT_DEVICE_SIZE` and the type is `Usb_Descriptor.USB_DT_DEVICE`.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`USB_CLASS_AUDIO`
Device and/or interface class codes.
`static final int`
`USB_CLASS_COMM`
Device and/or interface class codes.
`static final int`
`USB_CLASS_DATA`
Device and/or interface class codes.
`static final int`
`USB_CLASS_HID`
Device and/or interface class codes.
`static final int`
`USB_CLASS_HUB`
Device and/or interface class codes.
`static final int`
`USB_CLASS_MASS_STORAGE`
Device and/or interface class codes.
`static final int`
`USB_CLASS_PER_INTERFACE`
Device and/or interface class codes.
`static final int`
`USB_CLASS_PRINTER`
Device and/or interface class codes.
`static final int`
`USB_CLASS_VENDOR_SPEC`
Device and/or interface class codes.

### Fields inherited from class ch.ntb.usb.Usb_Descriptor

`USB_DT_CONFIG, USB_DT_CONFIG_SIZE, USB_DT_DEVICE, USB_DT_DEVICE_SIZE, USB_DT_ENDPOINT, USB_DT_ENDPOINT_AUDIO_SIZE, USB_DT_ENDPOINT_SIZE, USB_DT_HID, USB_DT_HUB, USB_DT_HUB_NONVAR_SIZE, USB_DT_INTERFACE, USB_DT_INTERFACE_SIZE, USB_DT_PHYSICAL, USB_DT_REPORT, USB_DT_STRING`

## Constructor Summary

Constructors
Constructor
Description
`Usb_Device_Descriptor()`

## Method Summary

Modifier and Type
Method
Description
`short`
`getBcdDevice()`
Returns the device release number.
Assigned by the manufacturer of the device.
`short`
`getBcdUSB()`
Returns the USB specification number to which the device complies to.
This field reports the highest version of USB the device supports.
`byte`
`getBDeviceClass()`
Returns the class code (Assigned by www.usb.org)
If equal to zero, each interface specifies it's own class code.
`byte`
`getBDeviceProtocol()`
Returns the protocol code (Assigned by www.usb.org)
`byte`
`getBDeviceSubClass()`
Returns the subclass code (Assigned by www.usb.org)
`byte`
`getBMaxPacketSize0()`
Returns the maximum packet size for endpoint zero.
Valid sizes are 8, 16, 32, 64.
`byte`
`getBNumConfigurations()`
Returns the number of possible configurations supported at its current speed.
`short`
`getIdProduct()`
Returns the product ID (Assigned by www.usb.org)
`short`
`getIdVendor()`
Returns the Vendor ID (Assigned by www.usb.org)
`byte`
`getIManufacturer()`
Returns the index of the manufacturer string descriptor.
If this value is 0, no string descriptor is used.
`byte`
`getIProduct()`
Returns the index of the product string descriptor.
If this value is 0, no string descriptor is used.
`byte`
`getISerialNumber()`
Returns the index of serial number string descriptor.
If this value is 0, no string descriptor is used.
`String`
`toString()`

### Methods inherited from class ch.ntb.usb.Usb_Descriptor

`getBDescriptorType, getBLength`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### USB_CLASS_PER_INTERFACE

public static final int USB_CLASS_PER_INTERFACE
Device and/or interface class codes.

See Also:
  - Constant Field Values

### USB_CLASS_AUDIO

public static final int USB_CLASS_AUDIO
Device and/or interface class codes.

See Also:
  - Constant Field Values

### USB_CLASS_COMM

public static final int USB_CLASS_COMM
Device and/or interface class codes.

See Also:
  - Constant Field Values

### USB_CLASS_HID

public static final int USB_CLASS_HID
Device and/or interface class codes.

See Also:
  - Constant Field Values

### USB_CLASS_PRINTER

public static final int USB_CLASS_PRINTER
Device and/or interface class codes.

See Also:
  - Constant Field Values

### USB_CLASS_MASS_STORAGE

public static final int USB_CLASS_MASS_STORAGE
Device and/or interface class codes.

See Also:
  - Constant Field Values

### USB_CLASS_HUB

public static final int USB_CLASS_HUB
Device and/or interface class codes.

See Also:
  - Constant Field Values

### USB_CLASS_DATA

public static final int USB_CLASS_DATA
Device and/or interface class codes.

See Also:
  - Constant Field Values

### USB_CLASS_VENDOR_SPEC

public static final int USB_CLASS_VENDOR_SPEC
Device and/or interface class codes.

See Also:
  - Constant Field Values

## Constructor Details

### Usb_Device_Descriptor

public Usb_Device_Descriptor()

## Method Details

### getBcdDevice

public short getBcdDevice()
Returns the device release number.
Assigned by the manufacturer of the device.

Returns:
  the device release number

### getBcdUSB

public short getBcdUSB()
Returns the USB specification number to which the device complies to.
This field reports the highest version of USB the device supports. The value is in binary coded decimal with a format of 0xJJMN where JJ is the major version number, M is the minor version number and N is the sub minor version number.
Examples: USB 2.0 is reported as 0x0200, USB 1.1 as 0x0110 and USB 1.0 as 0x100

Returns:
  the USB specification number to which the device complies to

### getBDeviceClass

public byte getBDeviceClass()
Returns the class code (Assigned by www.usb.org)
If equal to zero, each interface specifies it's own class code. If equal to 0xFF, the class code is vendor specified. Otherwise the field is a valid class code.

Returns:
  the class code

### getBDeviceProtocol

public byte getBDeviceProtocol()
Returns the protocol code (Assigned by www.usb.org)

Returns:
  the protocol code

### getBDeviceSubClass

public byte getBDeviceSubClass()
Returns the subclass code (Assigned by www.usb.org)

Returns:
  the subclass code

### getBMaxPacketSize0

public byte getBMaxPacketSize0()
Returns the maximum packet size for endpoint zero.
Valid sizes are 8, 16, 32, 64.

Returns:
  the maximum packet size for endpoint zero

### getBNumConfigurations

public byte getBNumConfigurations()
Returns the number of possible configurations supported at its current speed.

Returns:
  the number of possible configurations supported at its current speed

### getIdProduct

public short getIdProduct()
Returns the product ID (Assigned by www.usb.org)

Returns:
  the product ID

### getIdVendor

public short getIdVendor()
Returns the Vendor ID (Assigned by www.usb.org)

Returns:
  the Vendor ID

### getIManufacturer

public byte getIManufacturer()
Returns the index of the manufacturer string descriptor.
If this value is 0, no string descriptor is used.

Returns:
  the index of the manufacturer string descriptor

### getIProduct

public byte getIProduct()
Returns the index of the product string descriptor.
If this value is 0, no string descriptor is used.

Returns:
  the index of the product string descriptor

### getISerialNumber

public byte getISerialNumber()
Returns the index of serial number string descriptor.
If this value is 0, no string descriptor is used.

Returns:
  the index of serial number string descriptor

### toString

public String toString()

Overrides:
  `toString` in class `Object`