|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jflux.api.common.rk.property.PropertyChangeNotifier
org.mechio.impl.motion.rxtx.serial.RXTXSerialPort
public class RXTXSerialPort
A SerialPort using the RXTX library. This class is not thread safe.
| Field Summary | |
|---|---|
static String |
DEVICE_ERROR
Device Error error string. |
static String |
INVALID_PORT_ERROR
Invalid Port error string. |
static String |
PORT_IN_USE_ERROR
Port In Use error string. |
static String |
PORT_NOT_FOUND_ERROR
Port Not Found error string. |
static String |
PROP_ERRORS
Property string for RXTXSerialPort Errors. |
static String |
READ_ERROR
Port Read Error error string. |
static String |
TIMEOUT_ERROR
Timeout error string. |
static String |
WRITE_ERROR
Port Write Error error string. |
| Constructor Summary | |
|---|---|
RXTXSerialPort(String portName)
Creates a new RXTXSerialPort using the given port. |
|
| Method Summary | |
|---|---|
protected void |
addError(String error)
Adds an error to the RXTXSerialPort. |
protected void |
addError(String error,
String message)
Adds an error to the RXTXSerialPort. |
void |
addError(String error,
String message,
Throwable t)
Adds an error to the RXTXSerialPort. |
protected void |
addError(String error,
Throwable t)
Adds an error to the RXTXSerialPort. |
void |
clearErrors()
Clears all port errors. |
void |
clearReader()
Clears any available data from the port reader. |
boolean |
connect(int baudRate,
int dataBtis,
int stopBits,
int parity)
Connects to the serial port using the given parameters. |
boolean |
disconnect()
Disconnect the serial port. |
boolean |
flushWriter()
Flushes the serial port's OutputStream. |
ConnectionStatus |
getConnectionStatus()
Returns the port's ConnectionStatus. |
List<String> |
getErrors()
Returns a List of the port's errors. |
gnu.io.SerialPort |
getPort()
Returns underlying SerialPort. |
InputStream |
getReader()
Returns underlying InputStream. |
int |
getTimeoutLength()
Returns port timeout length. |
OutputStream |
getWriter()
Returns underlying OutputStream. |
boolean |
hasErrors()
Returns true if the port has errors. |
int |
read()
Reads a single byte. |
int |
read(byte[] data,
int offset,
int len)
Reads a number of bytes from the serial port. |
int |
read(byte[] data,
int offset,
int len,
int timeout)
|
byte[] |
read(int len)
Reads a number of bytes from the serial port. |
byte[] |
read(int len,
int timeout)
|
boolean |
reconnect()
|
void |
setTimeoutLength(int len)
Sets the timeout length. |
boolean |
write(byte... data)
Writes the data to the serial port. |
boolean |
write(byte[] data,
int offset,
int len)
Writes the data to the serial port. |
| Methods inherited from class org.jflux.api.common.rk.property.PropertyChangeNotifier |
|---|
addPropertyChangeListener, addPropertyChangeListener, clearAllListeners, clearListeners, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String PROP_ERRORS
public static final String TIMEOUT_ERROR
public static final String PORT_NOT_FOUND_ERROR
public static final String PORT_IN_USE_ERROR
public static final String INVALID_PORT_ERROR
public static final String READ_ERROR
public static final String WRITE_ERROR
public static final String DEVICE_ERROR
| Constructor Detail |
|---|
public RXTXSerialPort(String portName)
portName - port identifier| Method Detail |
|---|
public void setTimeoutLength(int len)
len - timeout length in millisecondspublic int getTimeoutLength()
public gnu.io.SerialPort getPort()
public OutputStream getWriter()
public InputStream getReader()
public boolean connect(int baudRate,
int dataBtis,
int stopBits,
int parity)
baudRate - port baud ratedataBtis - number of data bitsstopBits - number of stop bitsparity - parity
public boolean disconnect()
public boolean reconnect()
public boolean write(byte[] data,
int offset,
int len)
data - bytes to writeoffset - data array offsetlen - data write length
public boolean write(byte... data)
data - bytes to write
public boolean flushWriter()
public byte[] read(int len)
len - number of bytes to read
public byte[] read(int len,
int timeout)
public int read(byte[] data,
int offset,
int len)
data - array to filloffset - data array offsetlen - number of bytes to read
public int read(byte[] data,
int offset,
int len,
int timeout)
public int read()
public void clearReader()
public ConnectionStatus getConnectionStatus()
protected void addError(String error)
error - error string to add
protected void addError(String error,
String message)
error - error string to addmessage - error message
protected void addError(String error,
Throwable t)
error - error string to addt - error Throwable
public void addError(String error,
String message,
Throwable t)
error - error string to addmessage - error messaget - error Throwablepublic List<String> getErrors()
public void clearErrors()
public boolean hasErrors()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||