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 |
|---|---|
protected int |
debug |
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 |
getActualPortName()
Returns the actual 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 with previously set parameters.
|
void |
open(boolean iterate)
This version of open tries, if its argument is true, to open the "following" device if opening of the requested device fails.
|
void |
setDebug(int debug)
Sets a debug parameter.
|
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.
|
public static final String defaultPort
protected InputStream inStream
protected OutputStream outStream
protected boolean verbose
protected int debug
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 void setVerbosity(boolean verbosity)
IHarcHardwaresetVerbosity in interface IHarcHardwareverbosity - on or offpublic void setDebug(int debug)
IHarcHardwaresetDebug in interface IHarcHardwarepublic void open()
throws HarcHardwareException,
IOException
IHarcHardwareopen in interface IHarcHardwareHarcHardwareExceptionIOExceptionpublic void open(boolean iterate)
throws HarcHardwareException,
IOException
iterate - HarcHardwareExceptionIOExceptionpublic static String getSerialPortName(int portNumber) throws IOException, gnu.io.NoSuchPortException
IOExceptiongnu.io.NoSuchPortExceptionpublic static ArrayList<String> getSerialPortNames(boolean useCached) throws IOException
useCached - 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 getActualPortName()
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 © 2015. All rights reserved.