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.NoSuchPortException
gnu.io.PortInUseException
gnu.io.UnsupportedCommOperationException
IOException
public LocalSerialPort(String portName, int baud) throws gnu.io.NoSuchPortException, gnu.io.PortInUseException, gnu.io.UnsupportedCommOperationException, IOException
gnu.io.NoSuchPortException
gnu.io.PortInUseException
gnu.io.UnsupportedCommOperationException
IOException
public LocalSerialPort(String portName) throws gnu.io.NoSuchPortException, gnu.io.PortInUseException, gnu.io.UnsupportedCommOperationException, IOException
gnu.io.NoSuchPortException
gnu.io.PortInUseException
gnu.io.UnsupportedCommOperationException
IOException
public LocalSerialPort(int portNumber) throws IOException, gnu.io.NoSuchPortException, gnu.io.PortInUseException, gnu.io.UnsupportedCommOperationException
IOException
gnu.io.NoSuchPortException
gnu.io.PortInUseException
gnu.io.UnsupportedCommOperationException
public void setVerbosity(boolean verbosity)
IHarcHardware
setVerbosity
in interface IHarcHardware
verbosity
- on or offpublic void setDebug(int debug)
IHarcHardware
setDebug
in interface IHarcHardware
public void open() throws HarcHardwareException, IOException
IHarcHardware
open
in interface IHarcHardware
HarcHardwareException
IOException
public void open(boolean iterate) throws HarcHardwareException, IOException
iterate
- HarcHardwareException
IOException
public static String getSerialPortName(int portNumber) throws IOException, gnu.io.NoSuchPortException
IOException
gnu.io.NoSuchPortException
public static ArrayList<String> getSerialPortNames(boolean useCached) throws IOException
useCached
- IOException
public void flushInput() throws IOException
IOException
public boolean isValid()
IHarcHardware
isValid
in interface IHarcHardware
public void setTimeout(int timeout) throws IOException
IHarcHardware
setTimeout
in interface IHarcHardware
timeout
- Timeout in milliseconds.IOException
public String getVersion()
IHarcHardware
getVersion
in interface IHarcHardware
public String getActualPortName()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public void flush() throws IOException
IOException
public void setDTR(boolean state)
public void dropDTR(int duration)
Copyright © 2015. All rights reserved.