|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface for a USB interface.
This object actually represents a specific 'alternate' setting for a USB interface. Interfaces must have at least one alternate setting, and one and only one setting is active per interface. All settings share the same interface number. If this interface setting is not active, it cannot be claimed or released; the active interface setting should be used for claiming and releasing ownership of the interface; also no action may be taken on any parts of this interface setting, if the setting is not active. Any attempt to perform action on objects belonging to an inactive interface setting will throw a UsbNotActiveException.
Method Summary | |
void |
claim()
Claim this interface. |
void |
claim(UsbInterfacePolicy policy)
Claim this interface using a UsbInterfacePolicy. |
boolean |
containsSetting(byte number)
If the specified alternate setting exists. |
boolean |
containsUsbEndpoint(byte address)
If the specified UsbEndpoint is contained in this UsbInterface. |
UsbInterface |
getActiveSetting()
Get the active alternate setting. |
byte |
getActiveSettingNumber()
Get the number of the active alternate setting. |
java.lang.String |
getInterfaceString()
Get the interface String. |
int |
getNumSettings()
Get the number of alternate settings for this interface. |
UsbInterface |
getSetting(byte number)
Get the specified alternate setting. |
java.util.List |
getSettings()
Get all alternate settings for this interface. |
UsbConfiguration |
getUsbConfiguration()
Get the parent UsbConfiguration that this UsbInterface belongs to. |
UsbEndpoint |
getUsbEndpoint(byte address)
Get a specific UsbEndpoint. |
java.util.List |
getUsbEndpoints()
Get all endpoints for this interface setting. |
UsbInterfaceDescriptor |
getUsbInterfaceDescriptor()
Get the interface descriptor. |
boolean |
isActive()
If this interface alternate setting is active. |
boolean |
isClaimed()
If this interface is claimed. |
void |
release()
Release this interface. |
Method Detail |
public void claim() throws UsbClaimException, UsbException, UsbNotActiveException, UsbDisconnectedException
This will attempt whatever claiming the native implementation provides, if any. If the interface is already claimed, or the native claim fails, this will fail.
This must be done before opening and/or using any UsbPipes.
UsbClaimException
- If the interface is already claimed.
UsbException
- If the interface could not be claimed.
UsbNotActiveException
- If this interface setting is not
active
.
UsbDisconnectedException
- If this interface (device) has been disconnected.public void claim(UsbInterfacePolicy policy) throws UsbClaimException, UsbException, UsbNotActiveException, UsbDisconnectedException
This will attempt whatever claiming the native implementation provides,
if any. If the native claim fails, this will fail. If the interface
is already claimed, this may fail depending on the value of the
UsbInterfacePolicy.forceClaim()
.
policy
- The UsbInterfacePolicy to use.
UsbClaimException
- If the interface is already claimed.
UsbException
- If the interface could not be claimed.
UsbNotActiveException
- If this interface setting is not
active
.
UsbDisconnectedException
- If this interface (device) has been disconnected.public void release() throws UsbClaimException, UsbException, UsbNotActiveException, UsbDisconnectedException
This will only succeed if the interface has been properly claimed. If the native release fails, this will fail.
This should be done after the interface is no longer being used. All pipes must be closed before this can be released.
UsbClaimException
- If the interface is not claimed.
UsbException
- If the interface could not be released.
UsbNotActiveException
- If this interface setting is not
active
.
UsbDisconnectedException
- If this interface (device) has been disconnected.public boolean isClaimed()
This will return true if claimed in Java. This may, depending on implementation, return true if claimed natively (outside of Java)
If this UsbInterface is not active
, this will
return if the active alternate setting is active.
public boolean isActive()
The interface itself is active if and only if its parent
configuration is active
.
If the interface itself is not active, none of its alternate settings
are active.
public int getNumSettings()
public byte getActiveSettingNumber() throws UsbNotActiveException
UsbNotActiveException
- If the interface (and parent config) is not
active
.public UsbInterface getActiveSetting() throws UsbNotActiveException
UsbNotActiveException
- If this interface (and parent config) is not
active
.public UsbInterface getSetting(byte number)
If the specified setting does not exist, this returns null.
public boolean containsSetting(byte number)
number
- The alternate setting number.
public java.util.List getSettings()
This returns all alternate settings, including this one.
public java.util.List getUsbEndpoints()
public UsbEndpoint getUsbEndpoint(byte address)
If this does not contain the specified endpoint, this returns null.
address
- The address of the UsbEndpoint to get.
public boolean containsUsbEndpoint(byte address)
address
- The endpoint address.
public UsbConfiguration getUsbConfiguration()
public UsbInterfaceDescriptor getUsbInterfaceDescriptor()
The descriptor may be cached.
public java.lang.String getInterfaceString() throws UsbException, java.io.UnsupportedEncodingException, UsbDisconnectedException
This is a convienence method. The String may be cached. If the device does not support strings or does not define the interface string, this returns null.
UsbException
- If there was an error getting the UsbStringDescriptor.
java.io.UnsupportedEncodingException
- If the string encoding is not supported.
UsbDisconnectedException
- If this interface (device) has been disconnected.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |