|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.meiglobal.ebds.api.WrappedSerialPort
public class WrappedSerialPort
WrappedSerialPort class is a wrapper for the gnu.io.serialPort class. It contains the basic operations for opening, closing, sending and receiving data. It is expected that this class be subclassed in order to properly process the incomming data.
Field Summary | |
---|---|
protected byte[] |
_buffer
|
protected int |
_iRead
|
protected int |
_iWrite
|
protected java.lang.String |
_strPortName
|
Constructor Summary | |
---|---|
WrappedSerialPort()
Wrapped Serial port is a serial port object that is wrapped for the convienence of timeout detection. |
Method Summary | |
---|---|
void |
close()
Closes the connection to the currently opened port. |
protected void |
flushInputStream()
Clears out any bytes in the input stream |
boolean |
isOpen()
Determines if the port is open and can be used. |
static java.lang.String[] |
listPorts()
Method used to retrieve the available ports. |
boolean |
openPort(java.lang.String portName)
Opens communication with a port. |
void |
send(byte[] data)
Sends a byte array out the serial port. |
void |
serialEvent(gnu.io.SerialPortEvent event)
This functions handles all the events raised by the serial port object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String _strPortName
protected byte[] _buffer
protected int _iRead
protected int _iWrite
Constructor Detail |
---|
public WrappedSerialPort()
Method Detail |
---|
public boolean isOpen()
public static java.lang.String[] listPorts()
public boolean openPort(java.lang.String portName) throws AcceptorException
portName
- The name of the port to open. Ex. COM1
AcceptorException
- If there is any reason the port cannot be opened.public void close()
public void send(byte[] data) throws java.io.IOException
data
- The byte array to send
java.io.IOException
protected void flushInputStream()
public void serialEvent(gnu.io.SerialPortEvent event)
serialEvent
in interface gnu.io.SerialPortEventListener
event
- SerialPortEvent that was raised.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |