javax.usb
Interface UsbConfiguration


public interface UsbConfiguration

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.

Author:
Dan Streetman, E. Michael Maximilien

Method Summary
 boolean containsUsbInterface(byte number)
          If the specified UsbInterface is contained in this UsbConfiguration.
 java.lang.String getConfigurationString()
          Get the configuration String.
 UsbConfigurationDescriptor getUsbConfigurationDescriptor()
          Get the configuration descriptor.
 UsbDevice getUsbDevice()
          Get the parent UsbDevice that this UsbConfiguration belongs to.
 UsbInterface getUsbInterface(byte number)
          Get the UsbInterface with the specified interface number.
 java.util.List getUsbInterfaces()
          Get all UsbInterfaces for this configuration.
 boolean isActive()
          If this UsbConfiguration is active.
 

Method Detail

isActive

public boolean isActive()
If this UsbConfiguration is active.

Returns:
if this UsbConfiguration is active.

getUsbInterfaces

public java.util.List 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:

Returns:
All UsbInterfaces for this configuration.

getUsbInterface

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 - The number of the interface to get.
Returns:
The specified UsbInterface, or null.

containsUsbInterface

public boolean containsUsbInterface(byte number)
If the specified UsbInterface is contained in this UsbConfiguration.

Parameters:
number - The interface number.
Returns:
If this configuration contains the specified UsbInterface.

getUsbDevice

public UsbDevice getUsbDevice()
Get the parent UsbDevice that this UsbConfiguration belongs to.

Returns:
the UsbDevice that this UsbConfiguration belongs to.

getUsbConfigurationDescriptor

public UsbConfigurationDescriptor getUsbConfigurationDescriptor()
Get the configuration descriptor.

The descriptor may be cached.

Returns:
The configuration descriptor.

getConfigurationString

public java.lang.String getConfigurationString()
                                        throws UsbException,
                                               java.io.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:
The configuration String, or null.
Throws:
UsbException - If there was an error getting the UsbStringDescriptor.
java.io.UnsupportedEncodingException - If the string encoding is not supported.
UsbDisconnectedException - If the device has been disconnected.


Copyright © 2009 Eurotech Inc. All rights reserved.