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 |
setVerbosity(boolean verbosity)
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 NoSuchPortException, PortInUseException, UnsupportedCommOperationException, IOException
public LocalSerialPort(String portName, int baud) throws NoSuchPortException, PortInUseException, UnsupportedCommOperationException, IOException
public LocalSerialPort(String portName) throws NoSuchPortException, PortInUseException, UnsupportedCommOperationException, IOException
public LocalSerialPort(int portNumber)
throws IOException,
NoSuchPortException,
PortInUseException,
UnsupportedCommOperationException
public static String getSerialPortName(int portNumber) throws IOException, NoSuchPortException
IOExceptionNoSuchPortExceptionpublic static ArrayList<String> getSerialPortNames(boolean useCached) throws IOException
useCached - If true, use previously acquired list, if availableIOExceptionpublic void setVerbosity(boolean verbosity)
IHarcHardwaresetVerbosity in interface IHarcHardwareverbosity - 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 © 2016. All rights reserved.