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, setVerbose
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
flushInput
getVersion, isValid, setTimeout, setVerbose
public 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.NoSuchPortException
gnu.io.PortInUseException
gnu.io.UnsupportedCommOperationException
IOException
public LocalSerialPortBuffered(String portName, int baud, boolean verbose) throws gnu.io.NoSuchPortException, gnu.io.PortInUseException, gnu.io.UnsupportedCommOperationException, IOException
gnu.io.NoSuchPortException
gnu.io.PortInUseException
gnu.io.UnsupportedCommOperationException
IOException
public LocalSerialPortBuffered(String portName, int baud, int timeout, boolean verbose) throws gnu.io.NoSuchPortException, gnu.io.PortInUseException, gnu.io.UnsupportedCommOperationException, IOException
gnu.io.NoSuchPortException
gnu.io.PortInUseException
gnu.io.UnsupportedCommOperationException
IOException
public LocalSerialPortBuffered(String portName, int baudRate) throws gnu.io.NoSuchPortException, gnu.io.PortInUseException, gnu.io.UnsupportedCommOperationException, IOException
gnu.io.NoSuchPortException
gnu.io.PortInUseException
gnu.io.UnsupportedCommOperationException
IOException
public LocalSerialPortBuffered(String portName) throws gnu.io.NoSuchPortException, gnu.io.PortInUseException, gnu.io.UnsupportedCommOperationException, IOException
gnu.io.NoSuchPortException
gnu.io.PortInUseException
gnu.io.UnsupportedCommOperationException
IOException
public LocalSerialPortBuffered(int portNumber) throws IOException, gnu.io.NoSuchPortException, gnu.io.PortInUseException, gnu.io.UnsupportedCommOperationException
IOException
gnu.io.NoSuchPortException
gnu.io.PortInUseException
gnu.io.UnsupportedCommOperationException
public static void main(String[] args)
public void open() throws HarcHardwareException, IOException
LocalSerialPort
open
in interface IHarcHardware
open
in class LocalSerialPort
HarcHardwareException
- Bundles RXTX exceptions together.IOException
public void sendString(String cmd) throws IOException
ICommandLineDevice
sendString
in interface ICommandLineDevice
cmd
- Command string to be sent.IOException
public void sendBytes(byte[] data) throws IOException
IOException
public void sendBytes(byte[] data, int offset, int length) throws IOException
IOException
public void sendByte(byte b) throws IOException
IOException
public String readString() throws IOException
ICommandLineDevice
readString
in interface ICommandLineDevice
IOException
public String readString(boolean wait) throws IOException
ICommandLineDevice
readString
in interface ICommandLineDevice
wait
- if true, wait until something arrives, otherwise return null if nothing there.IOException
public boolean ready() throws IOException
ICommandLineDevice
ready
in interface ICommandLineDevice
IOException
- If an I/O error occurspublic void setDebug(int debug)
IHarcHardware
setDebug
in interface IHarcHardware
Copyright © 2019. All rights reserved.