Top Description Methods
javax.usb

public Interface UsbConfiguration

Imports
java.io.UnsupportedEncodingException, java.util.*

Interface for a USB configuration.

This represents a configuration of a USB device. The device may have multiple configurations, and must have at least one configuration; only one configuration (if any) can be currently active. If the device is in an unconfigured state none of its configurations are active. If this configuration is not active, its device model (UsbInterfaces, UsbEndpoints, and UsbPipes) may be browsed, but no action can be taken.

See the USB 1.1 specification sec 9.6.2 for more information on USB device configurations.

Authors
Dan Streetman, E. Michael Maximilien

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

If this configuration contains the specified UsbInterface.
containsUsbInterface
(byte
The interface number.
number
)

If the specified UsbInterface is contained in this UsbConfiguration.

public String

Returns:

The configuration String, or null.
getConfigurationString
()

Get the configuration String.

public UsbConfigurationDescriptor

Returns:

The configuration descriptor.
getUsbConfigurationDescriptor
()

Get the configuration descriptor.

public UsbDevice

Returns:

the UsbDevice that this UsbConfiguration belongs to.
getUsbDevice
()

Get the parent UsbDevice that this UsbConfiguration belongs to.

public UsbInterface

Returns:

The specified UsbInterface, or null.
getUsbInterface
(byte
The number of the interface to get.
number
)

Get the UsbInterface with the specified interface number.

public List<E>

Returns:

All UsbInterfaces for this configuration.
getUsbInterfaces
()

Get all UsbInterfaces for this configuration.

public boolean

Returns:

if this UsbConfiguration is active.
isActive
()

If this UsbConfiguration is active.

Method Detail

containsUsbInterfaceback to summary
public boolean containsUsbInterface(byte number)

If the specified UsbInterface is contained in this UsbConfiguration.

Parameters
number:byte

The interface number.

Returns:boolean

If this configuration contains the specified UsbInterface.

getConfigurationStringback to summary
public String getConfigurationString() throws UsbException, UnsupportedEncodingException, UsbDisconnectedException

Get the configuration String.

This is a convienence method. The String may be cached. If the device does not support strings or does not define the configuration string, this returns null.

Returns:String

The configuration String, or null.

Exceptions
UsbException:
If there was an error getting the UsbStringDescriptor.
UnsupportedEncodingException:
If the string encoding is not supported.
UsbDisconnectedException:
If the device has been disconnected.
getUsbConfigurationDescriptorback to summary
public UsbConfigurationDescriptor getUsbConfigurationDescriptor()

Get the configuration descriptor.

The descriptor may be cached.

Returns:UsbConfigurationDescriptor

The configuration descriptor.

getUsbDeviceback to summary
public UsbDevice getUsbDevice()

Get the parent UsbDevice that this UsbConfiguration belongs to.

Returns:UsbDevice

the UsbDevice that this UsbConfiguration belongs to.

getUsbInterfaceback to summary
public UsbInterface getUsbInterface(byte number)

Get the UsbInterface with the specified interface number.

The returned interface setting will be the current active alternate setting if this configuration (and thus the contained interface) is active. If this configuration is not active, the returned interface setting will be an implementation-dependent alternate setting. To get a specific alternate setting, use UsbInterface.getSetting(byte number).

If the specified UsbInterface does not exist, this returns null.

Parameters
number:byte

The number of the interface to get.

Returns:UsbInterface

The specified UsbInterface, or null.

getUsbInterfacesback to summary
public List<E> getUsbInterfaces()

Get all UsbInterfaces for this configuration.

The returned UsbInterface settings depend on whether this configuration (and by association its contained interfaces) is active or not:

  • If this configuration is active, all UsbInterfaces will be the active alternate setting for that interface.
  • If this configuration is not active, no contained interfaces are active, so they have no active alternate settings. The UsbInterfaces will then be an implementation-dependent alternate setting UsbInterface for each iterface. To get a specific alternate setting, use UsbInterface.getSetting(byte number).
Returns:List<E>

All UsbInterfaces for this configuration.

isActiveback to summary
public boolean isActive()

If this UsbConfiguration is active.

Returns:boolean

if this UsbConfiguration is active.