public final class LocalSerialPortBuffered extends LocalSerialPort implements ICommandLineDevice
LocalSerialPort.FlowControl, LocalSerialPort.Parity| Modifier and Type | Field and Description |
|---|---|
static int |
defaultBaudRate |
defaultPort, inStream, outStream, verbose| Constructor and Description |
|---|
LocalSerialPortBuffered(int portNumber) |
LocalSerialPortBuffered(String portName) |
LocalSerialPortBuffered(String portName,
int baudRate) |
LocalSerialPortBuffered(String portName,
int baud,
boolean verbose) |
LocalSerialPortBuffered(String portName,
int baud,
int timeout,
boolean verbose) |
LocalSerialPortBuffered(String portName,
int baud,
int length,
int stopBits,
LocalSerialPort.Parity parity,
LocalSerialPort.FlowControl flowControl,
int timeout,
boolean verbose) |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] args) |
void |
open()
Opens the device.
|
String |
readString()
Reads a line of text.
|
String |
readString(boolean wait)
Reads a line of text.
|
boolean |
ready()
Tells whether this stream is ready to be read.
|
void |
sendByte(byte b) |
void |
sendBytes(byte[] data) |
void |
sendBytes(byte[] data,
int offset,
int length) |
void |
sendString(String cmd)
Sends a command (a String) to the instance.
|
void |
setDebug(int debug)
Sets a debug parameter.
|
close, dropDTR, flush, flushInput, getPortName, getSerialPortName, getSerialPortNames, getVersion, isValid, setDTR, setTimeout, setVerboseclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitflushInputgetVersion, isValid, setTimeout, setVerbosepublic static final int defaultBaudRate
public LocalSerialPortBuffered(String portName, int baud, int length, int stopBits, LocalSerialPort.Parity parity, LocalSerialPort.FlowControl flowControl, int timeout, boolean verbose) throws gnu.io.NoSuchPortException, gnu.io.PortInUseException, gnu.io.UnsupportedCommOperationException, IOException
gnu.io.NoSuchPortExceptiongnu.io.PortInUseExceptiongnu.io.UnsupportedCommOperationExceptionIOExceptionpublic LocalSerialPortBuffered(String portName, int baud, boolean verbose) throws gnu.io.NoSuchPortException, gnu.io.PortInUseException, gnu.io.UnsupportedCommOperationException, IOException
gnu.io.NoSuchPortExceptiongnu.io.PortInUseExceptiongnu.io.UnsupportedCommOperationExceptionIOExceptionpublic LocalSerialPortBuffered(String portName, int baud, int timeout, boolean verbose) throws gnu.io.NoSuchPortException, gnu.io.PortInUseException, gnu.io.UnsupportedCommOperationException, IOException
gnu.io.NoSuchPortExceptiongnu.io.PortInUseExceptiongnu.io.UnsupportedCommOperationExceptionIOExceptionpublic LocalSerialPortBuffered(String portName, int baudRate) throws gnu.io.NoSuchPortException, gnu.io.PortInUseException, gnu.io.UnsupportedCommOperationException, IOException
gnu.io.NoSuchPortExceptiongnu.io.PortInUseExceptiongnu.io.UnsupportedCommOperationExceptionIOExceptionpublic LocalSerialPortBuffered(String portName) throws gnu.io.NoSuchPortException, gnu.io.PortInUseException, gnu.io.UnsupportedCommOperationException, IOException
gnu.io.NoSuchPortExceptiongnu.io.PortInUseExceptiongnu.io.UnsupportedCommOperationExceptionIOExceptionpublic LocalSerialPortBuffered(int portNumber)
throws IOException,
gnu.io.NoSuchPortException,
gnu.io.PortInUseException,
gnu.io.UnsupportedCommOperationException
IOExceptiongnu.io.NoSuchPortExceptiongnu.io.PortInUseExceptiongnu.io.UnsupportedCommOperationExceptionpublic static void main(String[] args)
public void open()
throws HarcHardwareException,
IOException
LocalSerialPortopen in interface IHarcHardwareopen in class LocalSerialPortHarcHardwareException - Bundles RXTX exceptions together.IOExceptionpublic void sendString(String cmd) throws IOException
ICommandLineDevicesendString in interface ICommandLineDevicecmd - Command string to be sent.IOExceptionpublic void sendBytes(byte[] data)
throws IOException
IOExceptionpublic void sendBytes(byte[] data,
int offset,
int length)
throws IOException
IOExceptionpublic void sendByte(byte b)
throws IOException
IOExceptionpublic String readString() throws IOException
ICommandLineDevicereadString in interface ICommandLineDeviceIOExceptionpublic String readString(boolean wait) throws IOException
ICommandLineDevicereadString in interface ICommandLineDevicewait - if true, wait until something arrives, otherwise return null if nothing there.IOExceptionpublic boolean ready()
throws IOException
ICommandLineDeviceready in interface ICommandLineDeviceIOException - If an I/O error occurspublic void setDebug(int debug)
IHarcHardwaresetDebug in interface IHarcHardwareCopyright © 2020. All rights reserved.