|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.jusb.UsbDeviceImp
public class UsbDeviceImp
UsbDevice platform-independent implementation.
This must be set up before use and/or connection to the topology tree.
setter
.setter
.
If not set, it defaults to a DefaultUsbDeviceOsImp
.setter
.added
.set
, if this device is configured
.connect
method.
If the connect method is not used, there are additional steps:
Field Summary | |
---|---|
static java.lang.String |
CREATE_SHORT_PACKET_EXCEPTION_POLICY_KEY
|
static java.lang.String |
DCP_QUEUE_POLICY_KEY
|
Constructor Summary | |
---|---|
UsbDeviceImp()
Constructor. |
|
UsbDeviceImp(UsbDeviceDescriptor desc)
Constructor. |
|
UsbDeviceImp(UsbDeviceDescriptor desc,
UsbDeviceOsImp device)
Constructor. |
|
UsbDeviceImp(UsbDeviceOsImp device)
Constructor. |
Method Summary | |
---|---|
void |
addUsbConfigurationImp(UsbConfigurationImp configuration)
|
void |
addUsbDeviceListener(UsbDeviceListener listener)
Add a UsbDeviceListener to this UsbDevice. |
void |
asyncSubmit(java.util.List list)
Submit a List of UsbControlIrps asynchronously to the Default Control Pipe. |
void |
asyncSubmit(UsbControlIrp irp)
Submit a UsbControlIrp asynchronously to the Default Control Pipe. |
void |
connect(UsbHubImp hub,
byte portNumber)
Connect to the parent UsbHubImp. |
boolean |
containsUsbConfiguration(byte number)
If this UsbDevice contains the specified UsbConfiguration. |
UsbControlIrp |
createUsbControlIrp(byte bmRequestType,
byte bRequest,
short wValue,
short wIndex)
Create a UsbControlIrp. |
void |
disconnect()
Disconnect UsbDeviceImp. |
UsbConfiguration |
getActiveUsbConfiguration()
Get the active UsbConfiguration. |
UsbConfigurationImp |
getActiveUsbConfigurationImp()
|
byte |
getActiveUsbConfigurationNumber()
Get the number of the active UsbConfiguration. |
UsbStringDescriptor |
getCachedUsbStringDescriptor(byte index)
Get a cached UsbStringDescriptor. |
java.lang.String |
getManufacturerString()
Get the manufacturer String. |
UsbPort |
getParentUsbPort()
Get the UsbPort on the parent UsbHub that this device is connected to. |
UsbPortImp |
getParentUsbPortImp()
|
java.lang.String |
getProductString()
Get the product String. |
java.lang.String |
getSerialNumberString()
Get the serial number String. |
java.lang.Object |
getSpeed()
Get the speed of the device. |
java.lang.String |
getString(byte index)
Get the String from the specified string descriptor. |
UsbConfiguration |
getUsbConfiguration(byte number)
Get the specified UsbConfiguration. |
UsbConfigurationImp |
getUsbConfigurationImp(byte number)
|
java.util.List |
getUsbConfigurations()
Get all UsbConfigurations for this device. |
UsbDeviceDescriptor |
getUsbDeviceDescriptor()
Get the device descriptor. |
UsbDeviceOsImp |
getUsbDeviceOsImp()
|
UsbStringDescriptor |
getUsbStringDescriptor(byte index)
Get the specified string descriptor. |
boolean |
isConfigured()
If this UsbDevice is configured. |
boolean |
isUsbHub()
If this is a UsbHub. |
void |
removeUsbDeviceListener(UsbDeviceListener listener)
Remove a UsbDeviceListener from this UsbDevice. |
void |
setActiveUsbConfigurationNumber(byte num)
Sets the active configuration index. |
void |
setCachedUsbStringDescriptor(byte index,
UsbStringDescriptor desc)
Set a cached UsbStringDescriptor. |
void |
setParentUsbPortImp(UsbPortImp port)
|
void |
setSpeed(java.lang.Object o)
Sets the speed of this device. |
void |
setUsbDeviceDescriptor(UsbDeviceDescriptor desc)
|
void |
setUsbDeviceOsImp(UsbDeviceOsImp deviceImp)
|
void |
syncSubmit(java.util.List list)
Submit a List of UsbControlIrps synchronously to the Default Control Pipe. |
void |
syncSubmit(UsbControlIrp irp)
Submit a UsbControlIrp synchronously to the Default Control Pipe. |
void |
usbIrpImpComplete(UsbIrpImp usbIrpImp)
Indicate that a specific UsbIrpImp has completed. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DCP_QUEUE_POLICY_KEY
public static final java.lang.String CREATE_SHORT_PACKET_EXCEPTION_POLICY_KEY
Constructor Detail |
---|
public UsbDeviceImp()
public UsbDeviceImp(UsbDeviceDescriptor desc)
desc
- This device's Descriptor.public UsbDeviceImp(UsbDeviceOsImp device)
device
- The UsbDeviceOsImp.public UsbDeviceImp(UsbDeviceDescriptor desc, UsbDeviceOsImp device)
desc
- This device's Descriptor.device
- The UsbDeviceOsImp.Method Detail |
---|
public UsbDeviceOsImp getUsbDeviceOsImp()
public void setUsbDeviceOsImp(UsbDeviceOsImp deviceImp)
deviceImp
- the UsbDeviceOsImp to usepublic UsbPort getParentUsbPort() throws UsbDisconnectedException
UsbDevice
getParentUsbPort
in interface UsbDevice
UsbDisconnectedException
- If this device has been disconnected.public UsbPortImp getParentUsbPortImp() throws UsbDisconnectedException
UsbDisconnectedException
public void setParentUsbPortImp(UsbPortImp port)
port
- The parent portpublic boolean isUsbHub()
UsbDevice
isUsbHub
in interface UsbDevice
public java.lang.String getManufacturerString() throws UsbException, java.io.UnsupportedEncodingException, UsbDisconnectedException
UsbDevice
This is a convienence method, which uses
getString
.
getManufacturerString
in interface UsbDevice
UsbException
- If there was an error getting the UsbStringDescriptor.
java.io.UnsupportedEncodingException
- If the string encoding is not supported.
UsbDisconnectedException
- If this device has been disconnected.public java.lang.String getSerialNumberString() throws UsbException, java.io.UnsupportedEncodingException, UsbDisconnectedException
UsbDevice
This is a convienence method, which uses
getString
.
getSerialNumberString
in interface UsbDevice
UsbException
- If there was an error getting the UsbStringDescriptor.
java.io.UnsupportedEncodingException
- If the string encoding is not supported.
UsbDisconnectedException
- If this device has been disconnected.public java.lang.String getProductString() throws UsbException, java.io.UnsupportedEncodingException, UsbDisconnectedException
UsbDevice
This is a convienence method, which uses
getString
.
getProductString
in interface UsbDevice
UsbException
- If there was an error getting the UsbStringDescriptor.
java.io.UnsupportedEncodingException
- If the string encoding is not supported.
UsbDisconnectedException
- If this device has been disconnected.public java.lang.Object getSpeed()
UsbDevice
The speed will be one of:
getSpeed
in interface UsbDevice
public java.util.List getUsbConfigurations()
UsbDevice
The List is unmodifiable.
getUsbConfigurations
in interface UsbDevice
public UsbConfiguration getUsbConfiguration(byte number)
UsbDevice
If the specified UsbConfiguration does not exist, null is returned. Config number 0 is reserved for the Not Configured state (see the USB 1.1 specification section 9.4.2). Obviously, no UsbConfiguration exists for the Not Configured state.
getUsbConfiguration
in interface UsbDevice
public UsbConfigurationImp getUsbConfigurationImp(byte number)
public boolean containsUsbConfiguration(byte number)
UsbDevice
This will return false for zero (the Not Configured state).
containsUsbConfiguration
in interface UsbDevice
public boolean isConfigured()
UsbDevice
This returns true if the device is in the configured state as shown in the USB 1.1 specification table 9.1.
isConfigured
in interface UsbDevice
public byte getActiveUsbConfigurationNumber()
UsbDevice
If the device is in a Not Configured state, this will return zero.
getActiveUsbConfigurationNumber
in interface UsbDevice
public UsbConfiguration getActiveUsbConfiguration()
UsbDevice
If this device is Not Configured, this returns null.
getActiveUsbConfiguration
in interface UsbDevice
public UsbConfigurationImp getActiveUsbConfigurationImp()
public UsbDeviceDescriptor getUsbDeviceDescriptor()
UsbDevice
The descriptor may be cached.
getUsbDeviceDescriptor
in interface UsbDevice
public UsbStringDescriptor getUsbStringDescriptor(byte index) throws UsbException, UsbDisconnectedException
UsbDevice
This is a convienence method. The UsbStringDescriptor may be cached. If the device does not support strings or does not define the specified string descriptor, this returns null.
getUsbStringDescriptor
in interface UsbDevice
index
- The index of the string descriptor to get.
UsbException
- If an error occurred while getting the string descriptor.
UsbDisconnectedException
- If this device has been disconnected.public java.lang.String getString(byte index) throws UsbException, java.io.UnsupportedEncodingException, UsbDisconnectedException
UsbDevice
This is a convienence method, which uses
getUsbStringDescriptor()
.
getString()
.
getString
in interface UsbDevice
index
- The index of the string to get.
UsbException
- if an error occurrs while getting the UsbStringDescriptor.
java.io.UnsupportedEncodingException
- If the string encoding is not supported.
UsbDisconnectedException
- If the device has been disconnected.public UsbControlIrp createUsbControlIrp(byte bmRequestType, byte bRequest, short wValue, short wIndex)
createUsbControlIrp
in interface UsbDevice
bmRequestType
- The bmRequestType.bRequest
- The bRequest.wValue
- The wValue.wIndex
- The wIndex.
public void usbIrpImpComplete(UsbIrpImp usbIrpImp)
usbIrpImpComplete
in interface UsbIrpImp.UsbIrpImpListener
usbIrpImp
- The UsbIrpImp that completed.public void addUsbDeviceListener(UsbDeviceListener listener)
UsbDevice
addUsbDeviceListener
in interface UsbDevice
listener
- The listener to addpublic void removeUsbDeviceListener(UsbDeviceListener listener)
UsbDevice
removeUsbDeviceListener
in interface UsbDevice
listener
- The listener to removepublic void setUsbDeviceDescriptor(UsbDeviceDescriptor desc)
desc
- The new device descriptorpublic UsbStringDescriptor getCachedUsbStringDescriptor(byte index)
index
- The index of the UsbStringDescriptor.
public void setCachedUsbStringDescriptor(byte index, UsbStringDescriptor desc)
index
- The index.desc
- The UsbStringDescriptor.public void setSpeed(java.lang.Object o)
o
- The speed.
java.lang.IllegalArgumentException
- If the speed is not one of the defined speeds.public void setActiveUsbConfigurationNumber(byte num)
Since this may be called before the associated configuration is actually added, this does not check if the specified configuration index actually associates to a valid configuration; the caller must ensure that.
num
- the active configuration number (0 if device has been unconfigured)public void addUsbConfigurationImp(UsbConfigurationImp configuration)
configuration
- The configuration to addpublic void connect(UsbHubImp hub, byte portNumber) throws UsbException
hub
- The parent.portNumber
- The port on the parent this is connected to.
UsbException
public void disconnect()
Only call this if the device was connected to the topology tree;
i.e. the UsbPortImp has been set
.
This will fire
usbDeviceDetached
events to all listeners.
This method must be called when a device is disconnected.
public void syncSubmit(UsbControlIrp irp) throws UsbException, java.lang.IllegalArgumentException, UsbDisconnectedException
syncSubmit
in interface UsbDevice
irp
- The UsbControlIrp.
UsbException
- If an error occurrs.
java.lang.IllegalArgumentException
- If the UsbControlIrp is invalid.
UsbDisconnectedException
- If the device has been disconnected.public void asyncSubmit(UsbControlIrp irp) throws UsbException, java.lang.IllegalArgumentException, UsbDisconnectedException
asyncSubmit
in interface UsbDevice
irp
- The UsbControlIrp.
UsbException
- If an error occurrs.
java.lang.IllegalArgumentException
- If the UsbControlIrp is invalid.
UsbDisconnectedException
- If the device has been disconnected.public void syncSubmit(java.util.List list) throws UsbException, java.lang.IllegalArgumentException, UsbDisconnectedException
All UsbControlIrps are guaranteed to be atomically (with respect to other clients of this API) submitted to the Default Control Pipe. Atomicity on a native level is implementation-dependent.
syncSubmit
in interface UsbDevice
list
- The List of UsbControlIrps.
UsbException
- If an error occurrs.
java.lang.IllegalArgumentException
- If one of the UsbControlIrps is invalid.
UsbDisconnectedException
- If the device has been disconnected.public void asyncSubmit(java.util.List list) throws UsbException, java.lang.IllegalArgumentException, UsbDisconnectedException
All UsbControlIrps are guaranteed to be atomically (with respect to other clients of this API) submitted to the Default Control Pipe. Atomicity on a native level is implementation-dependent.
asyncSubmit
in interface UsbDevice
list
- The List of UsbControlIrps.
UsbException
- If an error occurrs.
java.lang.IllegalArgumentException
- If one of the UsbControlIrps is invalid.
UsbDisconnectedException
- If the device has been disconnected.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |