|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.alien.enterpriseRFID.util.SerialManager
SerialManager in an interface to the javax.comm Serial routines. Sometimes these classes will not be present (i.e. Applets that communicate only via the Network) and in these instances we need to be able to shut off Serial functionality and stop the code from crashing with ClassNotFound exceptions.
Normal instancing this class will work fine. If serial classes are not present instancing this class will cause problems. So before instancing, use the following code:
try { Class.forName("javax.comm.SerialPort"); SerialManager serialManager = new SerialManager(); } catch(ClassNotFoundException cnfe) { //Serial Classes not present on the JVM }
Constructor Summary | |
SerialManager()
Constructs a SerialManager object. |
Method Summary | |
static void |
addPortName(java.lang.String portName)
Adds the named serial port to the list of ports known to the serial libraries. |
void |
close()
Closes the connection to the serial port managed by this SerialManager. |
java.io.InputStream |
getInputStream()
Returns the InputStream object for the serial port managed by this SerialManager. |
java.io.OutputStream |
getOutputStream()
Returns the OutputStream object for the serial port managed by this SerialManager. |
int |
getSerialBaudRate()
Returns the communication rate of the serial port managed by this SerialManager. |
javax.comm.SerialPort |
getSerialPort()
Returns the SerialPort object managed by this SerialManager. |
javax.comm.SerialPort |
getSerialPort(java.lang.String serialPortName)
Returns a SerialPort object associated with the given serialPortName. |
static java.util.Vector |
getSerialPortList()
Returns a list of available serial ports on this host. |
java.lang.String |
getSerialPortName()
Returns the name of the serial port managed by this SerialManager. |
int |
getSerialPortTimeout()
Returns the communication timeout value for the serial port managed by this SerialManager. |
static void |
main(java.lang.String[] args)
|
void |
openSerialConnection()
Opens a connection to the serial port managed by this SerialManager. |
void |
setInputStream(java.io.InputStream inputStream)
Sets the InputStream object for the serial port managed by this SerialManager. |
void |
setOutputStream(java.io.OutputStream outputStream)
Sets the OutputStream object for the serial port managed by this SerialManager. |
void |
setSerialBaudRate(int serialBaudRate)
Sets the communication rate of the serial port managed by this SerialManager. |
void |
setSerialPort(javax.comm.SerialPort serialPort)
Sets the SerialPort object managed by this SerialManager. |
void |
setSerialPortName(java.lang.String serialPortName)
Sets the name of the serial port managed by this SerialManager. |
void |
setSerialPortTimeout(int serialPortTimeout)
Sets the communication timeout value for the serial port managed by this SerialManager. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SerialManager()
Method Detail |
public java.lang.String getSerialPortName()
setSerialPortName(String)
public void setSerialPortName(java.lang.String serialPortName)
serialPortName
- the name of this managed serial portgetSerialPortName()
public int getSerialBaudRate()
setSerialBaudRate(int)
public void setSerialBaudRate(int serialBaudRate)
serialBaudRate
- the communication rate of this managed serial portpublic javax.comm.SerialPort getSerialPort()
public void setSerialPort(javax.comm.SerialPort serialPort)
serialPort
- the SerialPort object to managepublic int getSerialPortTimeout()
public void setSerialPortTimeout(int serialPortTimeout)
serialPortTimeout
- the timeout value of this managed serial portpublic java.io.InputStream getInputStream()
public void setInputStream(java.io.InputStream inputStream)
inputStream
- the InputStream object of this managed serial portpublic java.io.OutputStream getOutputStream()
public void setOutputStream(java.io.OutputStream outputStream)
outputStream
- the OutputStream object of this managed serial portpublic void openSerialConnection() throws java.lang.Exception
java.lang.Exception
- if serial communication failspublic void close()
public static java.util.Vector getSerialPortList()
public javax.comm.SerialPort getSerialPort(java.lang.String serialPortName) throws java.io.IOException, javax.comm.NoSuchPortException, javax.comm.PortInUseException
serialPortName
- the name of the serial port
java.io.IOException
- if serial classes aren't loaded or the port doesn't exist
javax.comm.PortInUseException
- if the named serial port is already in use
javax.comm.NoSuchPortException
public static void addPortName(java.lang.String portName)
portName
- the name of the serial port to be addedpublic static void main(java.lang.String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |