T
- public abstract class IrSerial<T extends LocalSerialPort> extends Object implements IHarcHardware
Modifier and Type | Field and Description |
---|---|
protected T |
serialPort |
protected boolean |
verbose |
Constructor and Description |
---|
IrSerial(Class<T> clazz,
String portName,
int baudRate,
int dataSize,
int stopBits,
LocalSerialPort.Parity parity,
LocalSerialPort.FlowControl flowControl,
int timeout,
boolean verbose) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
Transmitter |
getTransmitter() |
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 |
setBaudRate(int baudRate) |
void |
setDataSize(int dataSize) |
void |
setFlowControl(LocalSerialPort.FlowControl flowControl) |
void |
setParity(LocalSerialPort.Parity parity) |
void |
setPortName(String portName) |
void |
setStopBits(int stopBits) |
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, wait
setDebug
protected boolean verbose
protected T extends LocalSerialPort serialPort
public IrSerial(Class<T> clazz, String portName, int baudRate, int dataSize, int stopBits, LocalSerialPort.Parity parity, LocalSerialPort.FlowControl flowControl, int timeout, boolean verbose) throws NoSuchPortException, PortInUseException, UnsupportedCommOperationException, IOException
public void setBaudRate(int baudRate)
baudRate
- the baudRate to setpublic void setDataSize(int dataSize)
dataSize
- the dataSize to setpublic void setStopBits(int stopBits)
stopBits
- the stopBits to setpublic void setParity(LocalSerialPort.Parity parity)
parity
- the parity to setpublic void setFlowControl(LocalSerialPort.FlowControl flowControl)
flowControl
- the flowControl to setpublic void setPortName(String portName)
portName
- the portName to setpublic String getVersion() throws IOException
IHarcHardware
getVersion
in interface IHarcHardware
IOException
public void setVerbosity(boolean verbosity)
IHarcHardware
setVerbosity
in interface IHarcHardware
verbosity
- on or offpublic void setTimeout(int timeout) throws IOException
IHarcHardware
setTimeout
in interface IHarcHardware
timeout
- Timeout in milliseconds.IOException
public boolean isValid()
IHarcHardware
isValid
in interface IHarcHardware
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public Transmitter getTransmitter()
public void open() throws HarcHardwareException, IOException
IHarcHardware
open
in interface IHarcHardware
HarcHardwareException
IOException
Copyright © 2016. All rights reserved.