de.wagner_ibw.iow
Class IowFactory

java.lang.Object
  |
  +--de.wagner_ibw.iow.IowFactory

public class IowFactory
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
private static long devCount
          Count of available iow devices.
static IowFactory INSTANCE
           
private static java.util.Vector iowDevices
          Vector of all scanned iow devices.
 
Constructor Summary
private IowFactory()
           
 
Method Summary
 void closeAllDevices()
          Close all the iow devices.
 void exit(int code)
          Closes all open devices and terminates the jvm.
static IowFactory getInstance()
           
 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.
 java.lang.String getVersion()
          Returns the version of the loaded iowkit library.
private  long openAllDevices()
          Open all connected iow devices.
private  java.lang.Object readResolve()
          Ensure Singleton class
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

devCount

private static long devCount
Count of available iow devices.


iowDevices

private static java.util.Vector iowDevices
Vector of all scanned iow devices.


INSTANCE

public static final IowFactory INSTANCE
Constructor Detail

IowFactory

private IowFactory()
Method Detail

getInstance

public static IowFactory getInstance()

readResolve

private java.lang.Object readResolve()
                              throws java.io.ObjectStreamException
Ensure Singleton class

java.io.ObjectStreamException

openAllDevices

private long openAllDevices()
Open all connected iow devices.

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.


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