|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--usb.core.Descriptor
This is a base class for entities with USB typed descriptors. It encapsulates raw descriptor data (byte arrays) and provides parsed access to that data. It is intended to be subclassed; subclasses will know how to parse the data after the first two bytes that this base class parses.
Descriptors are discussed in sections 9.5 and 9.6 of the USB 1.1 specification.
Field Summary | |
static byte |
CLASS_APP_SPECIFIC
Identifier for application-specific interfaces. |
static byte |
CLASS_AUDIO
Identifier for audio class interfaces. |
static byte |
CLASS_COMM
Identifier for communications control class interfaces. |
static byte |
CLASS_DATA
Identifier for communications data class interfaces. |
static byte |
CLASS_HID
Identifier for Human Interaction Device (HID) class interfaces. |
static byte |
CLASS_HUB
Identifier for hub class interfaces. |
static byte |
CLASS_MASS_STORAGE
Identifier for mass storage class interfaces. |
static byte |
CLASS_PRINTER
Identifier for printer class interfaces. |
static byte |
CLASS_VENDOR_SPECIFIC
Identifier for vendor-specific interfaces. |
static byte |
TYPE_CONFIGURATION
Indicates a configuration descriptor |
static byte |
TYPE_DEVICE
Indicates a device descriptor |
static byte |
TYPE_DEVICE_QUALIFIER
Indicates a USB 2.0 "device qualifier" |
static byte |
TYPE_ENDPOINT
Indicates an endpoint descriptor |
static byte |
TYPE_HID
Indicates a hid class descriptor |
static byte |
TYPE_HUB
Indicates a hub class descriptor |
static byte |
TYPE_INTERFACE
Indicates an interface descriptor |
static byte |
TYPE_INTERFACE_POWER
Indicates interface power consumption |
static byte |
TYPE_OTHER_SPEED
Indicates a USB 2.0 "other speed configuration" |
static byte |
TYPE_PHYSICAL
|
static byte |
TYPE_REPORT
|
static byte |
TYPE_STRING
Indicates a string descriptor |
Constructor Summary | |
protected |
Descriptor()
Used when deserializing. |
protected |
Descriptor(byte[] raw)
Creates and initializes a descriptor |
Method Summary | |
java.lang.String |
getBCD(int offset)
Returns the two byte BCD string at the specified offset. |
static java.lang.String |
getClassName(int klass,
java.lang.String zeroValue)
Returns the name corresponding to an interface class code. |
int |
getDescriptorType()
Returns the descriptor type. |
java.lang.String |
getDescriptorTypeName()
Returns a name for the type of descriptor (such as "device") |
abstract Device |
getDevice()
Returns the device with which this USB object is associated. |
int |
getLength()
Returns the length of the descriptor. |
int |
getU16(int index)
Returns a sixteen bit unsigned integer value, as encoded in the descriptor at the specified byte offset. |
int |
getU32(int index)
Returns a thirty-two bit integer value, as encoded in the descriptor at the specified byte offset. |
int |
getU8(int index)
Returns an eight bit unsigned integer value, as encoded in the descriptor at the specified byte offset. |
Descriptor |
nextDescriptor()
Provides successive access to all the descriptors in a block such a complete configuration descriptor. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final byte TYPE_DEVICE
public static final byte TYPE_CONFIGURATION
public static final byte TYPE_STRING
public static final byte TYPE_INTERFACE
public static final byte TYPE_ENDPOINT
public static final byte TYPE_DEVICE_QUALIFIER
public static final byte TYPE_OTHER_SPEED
public static final byte TYPE_INTERFACE_POWER
public static final byte TYPE_HID
public static final byte TYPE_REPORT
public static final byte TYPE_PHYSICAL
public static final byte TYPE_HUB
public static final byte CLASS_AUDIO
public static final byte CLASS_COMM
public static final byte CLASS_HID
public static final byte CLASS_PRINTER
public static final byte CLASS_MASS_STORAGE
public static final byte CLASS_HUB
public static final byte CLASS_DATA
public static final byte CLASS_APP_SPECIFIC
public static final byte CLASS_VENDOR_SPECIFIC
Constructor Detail |
protected Descriptor()
protected Descriptor(byte[] raw)
Method Detail |
public abstract Device getDevice()
public final int getLength()
public final int getDescriptorType()
public java.lang.String getDescriptorTypeName()
public static java.lang.String getClassName(int klass, java.lang.String zeroValue)
public final int getU8(int index)
public final int getU16(int index)
public final int getU32(int index)
public java.lang.String getBCD(int offset)
public final Descriptor nextDescriptor()
Interface
and Endpoint
descriptor objects. Then
if you use this method and see that the type of the resulting
descriptor is neither TYPE_INTERFACE nor TYPE_ENDPOINT, you will
know that you have some other kind of descriptor, such as a
device-specific one.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |