usb.core
Class Configuration

java.lang.Object
  |
  +--usb.core.Descriptor
        |
        +--usb.core.Configuration
All Implemented Interfaces:
java.io.Serializable

public final class Configuration
extends Descriptor

Provides access to a USB configuration supported by a device, and to the interfaces associated with that configuration. Some devices do not expose their interface configuration when they're operational, so their interface descriptions may not be available.

Configurations provide a coarse granularity mechanism to select device functionality. For example, one configuration of a telephone might support use of the headset, while another might be a conference call setup. Such configurations may affect device power consumption levels, and hence the ability to work using power supplied from the hub to which they are connected. Not all devices need, or support, multiple configurations. consumption of USB bandwidth.

Most fields of this descriptor are specified in section 9.6.2 of the USB 1.1 specification.

See Also:
Serialized Form

Field Summary
static byte ATTR_REMOTE_WAKEUP
          If this bit is set in an attribute mask, this configuration supports remote wakeup (which must be separately enabled).
static byte ATTR_SELF_POWERED
          If this bit is set in an attribute mask, this configuration provides some of its own power in addition to drawing the amount of power described by getMaxPower().
 
Fields inherited from class usb.core.Descriptor
CLASS_APP_SPECIFIC, CLASS_AUDIO, CLASS_COMM, CLASS_DATA, CLASS_HID, CLASS_HUB, CLASS_MASS_STORAGE, CLASS_PRINTER, CLASS_VENDOR_SPECIFIC, TYPE_CONFIGURATION, TYPE_DEVICE, TYPE_DEVICE_QUALIFIER, TYPE_ENDPOINT, TYPE_HID, TYPE_HUB, TYPE_INTERFACE, TYPE_INTERFACE_POWER, TYPE_OTHER_SPEED, TYPE_PHYSICAL, TYPE_REPORT, TYPE_STRING
 
Constructor Summary
Configuration(Device device, byte[] descriptor)
           
 
Method Summary
 Configuration clone(Device d)
           
 int getAttributes()
          Returns attributes of this configuration.
 java.lang.String getConfiguration(int language)
          Returns a string describing this configuration, in the specified language; or null if no such string is available.
 int getConfigurationValue()
          Value passed in a setConfiguration() request to select this configuration.
 Device getDevice()
          Returns the device with which the configuration is associated
 Interface getInterface(int index, int alt)
          Returns the specified interface from this configuration, or null if the device won't provide it.
 int getMaxPower()
          Returns the maximum amount of power used in this configuration, in units of 2mA.
 int getNumInterfaces()
          Returns the number of interfaces exposed in this configuration.
 int getTotalLength()
          Returns the total length of the descriptor for this configuration, including descriptors for interfaces, their endpoints, and other associated elements.
 
Methods inherited from class usb.core.Descriptor
getBCD, getClassName, getDescriptorType, getDescriptorTypeName, getLength, getU16, getU32, getU8, nextDescriptor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR_SELF_POWERED

public static final byte ATTR_SELF_POWERED
If this bit is set in an attribute mask, this configuration provides some of its own power in addition to drawing the amount of power described by getMaxPower().

See Also:
Constant Field Values

ATTR_REMOTE_WAKEUP

public static final byte ATTR_REMOTE_WAKEUP
If this bit is set in an attribute mask, this configuration supports remote wakeup (which must be separately enabled).

See Also:
Constant Field Values
Constructor Detail

Configuration

public Configuration(Device device,
                     byte[] descriptor)
Method Detail

clone

public Configuration clone(Device d)

getTotalLength

public int getTotalLength()
Returns the total length of the descriptor for this configuration, including descriptors for interfaces, their endpoints, and other associated elements. That full descriptor may not be available when the device is operational; some devices won't expose it.


getNumInterfaces

public int getNumInterfaces()
Returns the number of interfaces exposed in this configuration.


getConfigurationValue

public int getConfigurationValue()
Value passed in a setConfiguration() request to select this configuration.


getConfiguration

public java.lang.String getConfiguration(int language)
Returns a string describing this configuration, in the specified language; or null if no such string is available.


getAttributes

public int getAttributes()
Returns attributes of this configuration. These are specified in table 9.8 of the USB 1.1 specification, and expose whether the device can be self powered, and whether it support remote wakeup. Use the ATTR_* constants in this class.


getMaxPower

public int getMaxPower()
Returns the maximum amount of power used in this configuration, in units of 2mA.


getDevice

public Device getDevice()
Returns the device with which the configuration is associated

Specified by:
getDevice in class Descriptor

getInterface

public Interface getInterface(int index,
                              int alt)
                       throws java.io.IOException
Returns the specified interface from this configuration, or null if the device won't provide it. Some devices won't return their full descriptor set when they're operational, and most don't expose interface or endpoint descriptors except as part of their configuration.

java.io.IOException