de.wagner_ibw.iow
Class Iow

java.lang.Object
  |
  +--de.wagner_ibw.iow.Iow
Direct Known Subclasses:
Iow24, Iow40

public class Iow
extends java.lang.Object

This is the base class of all the iow devices, based on the com.codemercs.iow.IowKit JNI wrapper class to the iowkit library (iowki.dll for Windows, libiowkit.so for Linux).

Author:
Thomas Wagner

Field Summary
static long IOW24ID
          A constant for iow 24 device id.
static java.lang.String IOW24NAME
          A constant for iow 24 device name.
static long IOW40ID
          A constant for iow 40 device id.
static java.lang.String IOW40NAME
          A constant for iow 40 device name.
 
Constructor Summary
Iow()
          Sole constructor.
 
Method Summary
 void close()
          Close this iow device (Used by subclasses Iow40 and Iow24 only.)
 void closeAllDevices()
          Close all the iow devices.
 void exit(int code)
          Closes all open devices and terminates the jvm.
 int[] getCurrentPinStatus()
          Gets the current pin status.
 long getHandle()
          Implementation for IowInterface method getHandle.
 int getId()
          Implementation for IowInterface method getId.
 Iow24 getIow24Device()
          Returns the first connected iow 24 device.
 Iow24 getIow24Device(java.lang.String serial)
          Returns the iow 24 device according to the specified serial number.
 Iow40 getIow40Device()
          Returns the first connected iow 40 device.
 Iow40 getIow40Device(java.lang.String serial)
          Returns the iow40 device according to the specified serial number.
 long getNumDevices()
          Returns the number of connected iow devices.
 int getRev()
          Implementation for IowInterface method getRev.
 java.lang.String getSerial()
          Implementation for IowInterface method getSerial.
 java.lang.String getVersion()
          Returns the version of the loaded iowkit library.
 long openAllDevices()
          Open all connected iow devices.
 void openAllDevices(boolean debug)
          Deprecated.  
 int[] readReport(int pipe)
          Implementation for IowInterface method readReport.
 void setTimeout(long timeout)
          Set timeout for read operations.
 void setWriteTimeout(long timeout)
          Set timeout for write operations.
 java.lang.String toString()
          Returns a string representation of the object.
 long writeReport(int pipe, int[] wbuf)
          Implementation for IowInterface method writeReport.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IOW40ID

public static final long IOW40ID
A constant for iow 40 device id. (decimal 5376)

See Also:
Constant Field Values

IOW24ID

public static final long IOW24ID
A constant for iow 24 device id. (decimal 5377)

See Also:
Constant Field Values

IOW40NAME

public static final java.lang.String IOW40NAME
A constant for iow 40 device name.

See Also:
Constant Field Values

IOW24NAME

public static final java.lang.String IOW24NAME
A constant for iow 24 device name.

See Also:
Constant Field Values
Constructor Detail

Iow

public Iow()
Sole constructor. (For invocation by subclass constructors, typically implicit.)

Method Detail

openAllDevices

public void openAllDevices(boolean debug)
Deprecated.  

Open all connected iow devices.

Parameters:
debug -

openAllDevices

public long openAllDevices()
Open all connected iow devices.

Since:
0.9.3

setTimeout

public void setTimeout(long timeout)
Set timeout for read operations.

Parameters:
timeout - Timeout value in ms.

setWriteTimeout

public void setWriteTimeout(long timeout)
Set timeout for write operations.

Parameters:
timeout - Timeout value in ms.
Since:
0.9.3

getNumDevices

public long getNumDevices()
Returns the number of connected iow devices.

Returns:
Number of connected iow devices.
Since:
0.9.3

getIow40Device

public Iow40 getIow40Device()
                     throws java.util.NoSuchElementException
Returns the first connected iow 40 device.

Returns:
Instance of an iow 40 device.
Throws:
java.util.NoSuchElementException - If no connected iow 40 device was found.

getIow40Device

public Iow40 getIow40Device(java.lang.String serial)
                     throws java.util.NoSuchElementException
Returns the iow40 device according to the specified serial number.

Parameters:
serial - Serial number of the desired iow 40 device.
Returns:
@return Instance of the desired iow 40 device.
Throws:
java.util.NoSuchElementException - If no iow 40 device with desired serial number was found.

getIow24Device

public Iow24 getIow24Device()
                     throws java.util.NoSuchElementException
Returns the first connected iow 24 device.

Returns:
Instance of an iow 24 device.
Throws:
java.util.NoSuchElementException - If no connected iow 24 device was found.

getIow24Device

public Iow24 getIow24Device(java.lang.String serial)
                     throws java.util.NoSuchElementException
Returns the iow 24 device according to the specified serial number.

Parameters:
serial - Serial number of the desired iow 24 device.
Returns:
Instance of the desired iow 24 device.
Throws:
java.util.NoSuchElementException - If no iow 24 device with desired serial number was found.

closeAllDevices

public void closeAllDevices()
Close all the iow devices.


close

public void close()
Close this iow device (Used by subclasses Iow40 and Iow24 only.)


readReport

public int[] readReport(int pipe)
Implementation for IowInterface method readReport.

Parameters:
pipe -
Returns:
Array of int.

writeReport

public long writeReport(int pipe,
                        int[] wbuf)
Implementation for IowInterface method writeReport.

Parameters:
pipe -
wbuf - Write buffer.
Returns:
Count of written bytes.

getCurrentPinStatus

public int[] getCurrentPinStatus()
                          throws java.lang.UnsupportedOperationException
Gets the current pin status.

Returns:
Array of int.
java.lang.UnsupportedOperationException
Since:
0.9.3

getHandle

public long getHandle()
Implementation for IowInterface method getHandle. (Used by subclasses Iow40 and Iow24 only.)

Returns:
Returns the handle of this iow device.

getSerial

public java.lang.String getSerial()
Implementation for IowInterface method getSerial. (Used by subclasses Iow40 and Iow24 only.)

Returns:
The serial number of this iow device.

getId

public int getId()
Implementation for IowInterface method getId. (Used by subclasses Iow40 and Iow24 only.)

Returns:
Returns the device id of this device.

getRev

public int getRev()
Implementation for IowInterface method getRev. (Used by subclasses Iow40 and Iow24 only.)

Returns:
Returns the revision id of this device.
Since:
0.9.3

toString

public java.lang.String toString()
Returns a string representation of the object. It consists of the information about all connected iow devices.

Overrides:
toString in class java.lang.Object
Returns:
a string consisting of the device handle, id, revision and serial number of each connected iow device.

exit

public void exit(int code)
Closes all open devices and terminates the jvm.

Since:
0.9.3

getVersion

public java.lang.String getVersion()
Returns the version of the loaded iowkit library.

Returns:
Version of the iowkit.dll.
Since:
0.9.3