public abstract class LocalSerialPort extends Object implements IHarcHardware
| Modifier and Type | Class and Description |
|---|---|
static class |
LocalSerialPort.FlowControl |
static class |
LocalSerialPort.Parity |
| Modifier and Type | Field and Description |
|---|---|
static String |
defaultPort |
protected InputStream |
inStream |
protected OutputStream |
outStream |
protected boolean |
verbose |
| Constructor and Description |
|---|
LocalSerialPort(int portNumber) |
LocalSerialPort(String portName) |
LocalSerialPort(String portName,
int baud) |
LocalSerialPort(String portName,
int baud,
int length,
int stopBits,
LocalSerialPort.Parity parity,
LocalSerialPort.FlowControl flowControl,
int timeout) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
dropDTR(int duration) |
void |
flush() |
void |
flushInput() |
String |
getPortName()
Returns the nominal port name being used.
|
static String |
getSerialPortName(int portNumber) |
static ArrayList<String> |
getSerialPortNames(boolean useCached)
Returns all serial port names found in the system.
|
String |
getVersion()
Returns the hardware version (not the version of the driver software).
|
boolean |
isValid()
Tries to identify instances that are not valid.
|
void |
open()
Opens the device.
|
void |
setDTR(boolean state) |
void |
setTimeout(int timeout)
Set timeout in milliseconds.
|
void |
setVerbose(boolean verbose)
Sets a verbosity flag, causing commands to be executed verbosely.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetDebugpublic static final String defaultPort
protected InputStream inStream
protected OutputStream outStream
protected boolean verbose
public LocalSerialPort(String portName, int baud, int length, int stopBits, LocalSerialPort.Parity parity, LocalSerialPort.FlowControl flowControl, int timeout) throws gnu.io.NoSuchPortException, gnu.io.PortInUseException, gnu.io.UnsupportedCommOperationException, IOException
gnu.io.NoSuchPortExceptiongnu.io.PortInUseExceptiongnu.io.UnsupportedCommOperationExceptionIOExceptionpublic LocalSerialPort(String portName, int baud) throws gnu.io.NoSuchPortException, gnu.io.PortInUseException, gnu.io.UnsupportedCommOperationException, IOException
gnu.io.NoSuchPortExceptiongnu.io.PortInUseExceptiongnu.io.UnsupportedCommOperationExceptionIOExceptionpublic LocalSerialPort(String portName) throws gnu.io.NoSuchPortException, gnu.io.PortInUseException, gnu.io.UnsupportedCommOperationException, IOException
gnu.io.NoSuchPortExceptiongnu.io.PortInUseExceptiongnu.io.UnsupportedCommOperationExceptionIOExceptionpublic LocalSerialPort(int portNumber)
throws IOException,
gnu.io.NoSuchPortException,
gnu.io.PortInUseException,
gnu.io.UnsupportedCommOperationException
IOExceptiongnu.io.NoSuchPortExceptiongnu.io.PortInUseExceptiongnu.io.UnsupportedCommOperationExceptionpublic static String getSerialPortName(int portNumber) throws IOException, gnu.io.NoSuchPortException
IOExceptiongnu.io.NoSuchPortExceptionpublic static ArrayList<String> getSerialPortNames(boolean useCached) throws IOException
useCached - If true, use previously acquired list, if availableIOExceptionpublic void setVerbose(boolean verbose)
IHarcHardwaresetVerbose in interface IHarcHardwareverbose - on or offpublic void open()
throws HarcHardwareException,
IOException
open in interface IHarcHardwareHarcHardwareException - Bundles RXTX exceptions together.IOExceptionpublic void flushInput()
throws IOException
IOExceptionpublic boolean isValid()
IHarcHardwareisValid in interface IHarcHardwarepublic void setTimeout(int timeout)
throws IOException
IHarcHardwaresetTimeout in interface IHarcHardwaretimeout - Timeout in milliseconds.IOExceptionpublic String getVersion()
IHarcHardwaregetVersion in interface IHarcHardwarepublic String getPortName()
public void close()
close in interface Closeableclose in interface AutoCloseablepublic void flush()
throws IOException
IOExceptionpublic void setDTR(boolean state)
public void dropDTR(int duration)
Copyright © 2020. All rights reserved.