Modifier and Type | Field and Description |
---|---|
protected com.fazecast.jSerialComm.SerialPort |
com |
Constructor and Description |
---|
SerialPortConnector(java.lang.String devname,
int baud,
java.lang.String settings)
Open a serial port.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the connection.
|
java.io.InputStream |
getInputStream()
Get the input stream to read data over.
|
java.lang.String |
getName()
Get a string representation of the connection.
|
java.io.OutputStream |
getOutputStream()
Get the output stream to write data to.
|
com.fazecast.jSerialComm.SerialPort |
getSerialPort()
Get the underlying serial port.
|
boolean |
isReliable()
Check if a connection is relaible.
|
void |
setConnectionListener(ConnectionListener listener)
Set a connection state listener.
|
java.lang.String |
toString() |
boolean |
waitOutputCompletion(long timeout)
Wait until the output buffer is empty.
|
public SerialPortConnector(java.lang.String devname, int baud, java.lang.String settings) throws java.io.IOException
devname
- device name of the serial port.baud
- baud rate for the serial port.settings
- serial port settings (null for defaults, or "N81" for no parity, 8 bits, 1 stop bit).java.io.IOException
public com.fazecast.jSerialComm.SerialPort getSerialPort()
public java.lang.String getName()
Connector
public java.io.InputStream getInputStream()
Connector
getInputStream
in interface Connector
public java.io.OutputStream getOutputStream()
Connector
getOutputStream
in interface Connector
public void setConnectionListener(ConnectionListener listener)
Connector
setConnectionListener
in interface Connector
listener
- listener to call for connection/disconnection,
or null to disable listener.public void close()
Connector
public boolean isReliable()
Connector
isReliable
in interface Connector
public boolean waitOutputCompletion(long timeout)
Connector
waitOutputCompletion
in interface Connector
timeout
- timeout in milliseconds.public java.lang.String toString()
toString
in class java.lang.Object