public class Arduino extends IrSerial<LocalSerialPortBuffered> implements IRawIrSender, ICapture, IReceive, ICommandLineDevice
Modifier and Type | Field and Description |
---|---|
static int |
defaultBaudRate |
static String |
defaultPortName |
static String |
okString |
static String |
timeoutString |
serialPort, verbose
repeatMax
defaultBeginTimeout, defaultCaptureMaxSize, defaultEndTimeout
Constructor and Description |
---|
Arduino() |
Arduino(String portName) |
Arduino(String portName,
int baudRate) |
Arduino(String portName,
int baudRate,
boolean verbose) |
Arduino(String portName,
int baudRate,
int beginTimeout,
boolean verbose) |
Arduino(String portName,
int beginTimeout,
int captureMaxSize,
int endingTimeout,
boolean verbose) |
Arduino(String portName,
int baudRate,
int beginTimeout,
int captureMaxSize,
int endingTimeout,
boolean verbose) |
Modifier and Type | Method and Description |
---|---|
ModulatedIrSequence |
capture()
Listens to the device and returns a sequence.
|
void |
flushInput() |
String |
getVersion()
Returns the hardware version (not the version of the driver software).
|
static void |
main(String[] args) |
void |
open()
Opens the device with previously set parameters.
|
String |
readString()
Reads a line of text.
|
String |
readString(boolean wait)
Reads a line of text.
|
boolean |
ready()
Tells whether this stream is ready to be read.
|
IrSequence |
receive()
Listens to the device and returns a sequence.
|
void |
reset() |
boolean |
sendIr(IrSignal irSignal,
int count,
Transmitter transmitter) |
void |
sendString(String cmd)
Sends a command (a String) to the instance.
|
void |
setBeginTimeout(int beginTimeout) |
void |
setCaptureMaxSize(int captureMaxSize) |
void |
setDebug(int debug)
Sets a debug parameter.
|
void |
setEndTimeout(int endTimeout) |
void |
setFallbackFrequency(double fallbackFrequency) |
void |
setLineEnding(String lineEnding) |
boolean |
stopCapture()
Signals the capturing device that it should stop capturing.
|
boolean |
stopReceive()
Signals the receiving device that it should stop receiving.
|
void |
waitFor(String goal,
String areUThere,
int delay,
int tries) |
close, getTransmitter, isValid, setBaudRate, setDataSize, setFlowControl, setParity, setPortName, setStopBits, setTimeout, setVerbosity
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getTransmitter
isValid, setTimeout, setVerbosity
public static final String defaultPortName
public static final String okString
public static final String timeoutString
public static final int defaultBaudRate
public Arduino() throws NoSuchPortException, PortInUseException, UnsupportedCommOperationException, IOException
public Arduino(String portName) throws NoSuchPortException, PortInUseException, UnsupportedCommOperationException, IOException
public Arduino(String portName, int baudRate) throws NoSuchPortException, PortInUseException, UnsupportedCommOperationException, IOException
public Arduino(String portName, int baudRate, boolean verbose) throws NoSuchPortException, PortInUseException, UnsupportedCommOperationException, IOException
public Arduino(String portName, int baudRate, int beginTimeout, boolean verbose) throws NoSuchPortException, PortInUseException, UnsupportedCommOperationException, IOException
public Arduino(String portName, int beginTimeout, int captureMaxSize, int endingTimeout, boolean verbose) throws NoSuchPortException, PortInUseException, UnsupportedCommOperationException, IOException
public Arduino(String portName, int baudRate, int beginTimeout, int captureMaxSize, int endingTimeout, boolean verbose) throws NoSuchPortException, PortInUseException, UnsupportedCommOperationException, IOException
public static void main(String[] args)
args
- the command line argumentspublic void setLineEnding(String lineEnding)
lineEnding
- the lineEnding to setpublic void setFallbackFrequency(double fallbackFrequency)
fallbackFrequency
- the fallbackFrequency to setpublic boolean sendIr(IrSignal irSignal, int count, Transmitter transmitter) throws NoSuchTransmitterException, IrpMasterException, IOException
sendIr
in interface IRawIrSender
NoSuchTransmitterException
IrpMasterException
IOException
public void open() throws IOException, HarcHardwareException
IHarcHardware
open
in interface IHarcHardware
open
in class IrSerial<LocalSerialPortBuffered>
IOException
HarcHardwareException
public void waitFor(String goal, String areUThere, int delay, int tries) throws IOException, HarcHardwareException
IOException
HarcHardwareException
public String getVersion()
IHarcHardware
getVersion
in interface IHarcHardware
getVersion
in class IrSerial<LocalSerialPortBuffered>
public void setBeginTimeout(int beginTimeout) throws IOException
setBeginTimeout
in interface IIrReader
IOException
public void setCaptureMaxSize(int captureMaxSize)
setCaptureMaxSize
in interface IIrReader
public void setEndTimeout(int endTimeout)
setEndTimeout
in interface IIrReader
public ModulatedIrSequence capture() throws IOException, HarcHardwareException
ICapture
capture
in interface ICapture
IOException
HarcHardwareException
- if the device is not in valid/open state.public boolean stopCapture()
ICapture
stopCapture
in interface ICapture
public IrSequence receive() throws HarcHardwareException, IOException, IrpMasterException
IReceive
receive
in interface IReceive
HarcHardwareException
- if the device is not in valid/open state.IOException
IrpMasterException
public boolean stopReceive()
IReceive
stopReceive
in interface IReceive
public void reset()
public void sendString(String cmd) throws IOException
ICommandLineDevice
sendString
in interface ICommandLineDevice
cmd
- Command string to be sent.IOException
public String readString() throws IOException
ICommandLineDevice
readString
in interface ICommandLineDevice
IOException
public String readString(boolean wait) throws IOException
ICommandLineDevice
readString
in interface ICommandLineDevice
wait
- if true, wait until something arrives, otherwise return null if nothing there.IOException
public boolean ready() throws IOException
ICommandLineDevice
ready
in interface ICommandLineDevice
IOException
- If an I/O error occurspublic void setDebug(int debug)
IHarcHardware
setDebug
in interface IHarcHardware
public void flushInput() throws IOException
flushInput
in interface ICommandLineDevice
IOException
Copyright © 2016. All rights reserved.