Package org.harctoolbox.harchardware.ir
Class IrToy
- All Implemented Interfaces:
Closeable
,AutoCloseable
,IHarcHardware
,ICapture
,IIrReader
,IRawIrSender
,IReceive
public final class IrToy
extends IrSerial<LocalSerialPortRaw>
implements IRawIrSender, ICapture, IReceive
This class contains a driver for Dangerous Prototype's IrToy.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final LocalSerialPort.FlowControl
static final String
static final int
static final boolean
Fields inherited from class org.harctoolbox.harchardware.ir.IrSerial
serialPort, verbose
Fields inherited from interface org.harctoolbox.harchardware.ir.IIrReader
DEFAULT_BEGIN_TIMEOUT, DEFAULT_CAPTURE_MAXSIZE, DEFAULT_ENDING_TIMEOUT
Fields inherited from interface org.harctoolbox.harchardware.ir.IRawIrSender
repeatMax
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
org.harctoolbox.ircore.ModulatedIrSequence
capture()
Listens to the device and returns a sequence.void
void
close()
Returns the hardware version (not the version of the driver software).void
open()
Opens the device with previously set parameters.org.harctoolbox.ircore.IrSequence
receive()
Listens to the device and returns a sequence.void
reset
(int times) selftest()
boolean
sendCcf
(String ccf, int count, Transmitter transmitter) boolean
sendCcfRepeat
(String ccf, Transmitter transmitter) Not supported due to hardware restrictions.boolean
sendIr
(org.harctoolbox.ircore.IrSignal code, int count, Transmitter transmitter) void
setBeginTimeout
(int beginTimeout) void
setCaptureMaxSize
(int captureMaxSize) void
setDebug
(int debug) Sets a debug parameter.void
setEndingTimeout
(int timeout) void
setLed
(boolean status) void
setLedMute
(boolean status) void
setPin
(int pin, boolean state) pin 2: RA2 pin 3: RA3 pin 4: RA4 pin 5: RA5 pin 11: RB3 pin 13: RB5boolean
Signals the capturing device that it should stop capturing.boolean
Signals the receiving device that it should stop receiving.Methods inherited from class org.harctoolbox.harchardware.ir.IrSerial
getTransmitter, isValid, setBaudRate, setDataSize, setFlowControl, setParity, setPortName, setStopBits, setTimeout, setVerbose
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.harctoolbox.harchardware.IHarcHardware
isValid, setTimeout, setVerbose
Methods inherited from interface org.harctoolbox.harchardware.ir.IRawIrSender
getTransmitter
-
Field Details
-
useDebuggingLeds
public static final boolean useDebuggingLeds- See Also:
-
defaultPortName
- See Also:
-
defaultBaudRate
public static final int defaultBaudRate- See Also:
-
defaultFlowControl
-
defaultTimeout
public static final int defaultTimeout- See Also:
-
-
Constructor Details
-
IrToy
- Throws:
IOException
-
IrToy
- Throws:
IOException
-
IrToy
- Throws:
IOException
-
IrToy
- Throws:
IOException
-
IrToy
public IrToy(String portName, boolean verbose, Integer timeout, Integer baudRate) throws IOException - Throws:
IOException
-
IrToy
public IrToy(String portName, boolean verbose, Integer timeout, Integer baudRate, Integer maxLearnLength, LocalSerialPort.FlowControl flowControl) throws IOException - Throws:
IOException
-
-
Method Details
-
setPin
pin 2: RA2 pin 3: RA3 pin 4: RA4 pin 5: RA5 pin 11: RB3 pin 13: RB5- Parameters:
pin
-state
-- Throws:
IOException
-
open
Description copied from interface:IHarcHardware
Opens the device with previously set parameters.- Specified by:
open
in interfaceIHarcHardware
- Overrides:
open
in classIrSerial<LocalSerialPortRaw>
- Throws:
IOException
HarcHardwareException
-
checkVersion
- Throws:
HarcHardwareException
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classIrSerial<LocalSerialPortRaw>
- Throws:
IOException
-
reset
- Throws:
IOException
-
capture
public org.harctoolbox.ircore.ModulatedIrSequence capture() throws HarcHardwareException, IOExceptionDescription copied from interface:ICapture
Listens to the device and returns a sequence. Requires the device to be previously opened. Should itself neither open or close the device.- Specified by:
capture
in interfaceICapture
- Returns:
- Captured sequence, or null by timeout.
- Throws:
HarcHardwareException
- if the device is not in valid/open state.IOException
-
stopCapture
public boolean stopCapture()Description copied from interface:ICapture
Signals the capturing device that it should stop capturing. May not be implemented in all hardware.- Specified by:
stopCapture
in interfaceICapture
- Returns:
- status
-
receive
Description copied from interface:IReceive
Listens to the device and returns a sequence. Requires the device to be previously opened. Should itself neither open or close the device.- Specified by:
receive
in interfaceIReceive
- Returns:
- Captured sequence, or null by timeout.
- Throws:
HarcHardwareException
- if the device is not in valid/open state.IOException
-
stopReceive
public boolean stopReceive()Description copied from interface:IReceive
Signals the receiving device that it should stop receiving. May not be implemented in all hardware.- Specified by:
stopReceive
in interfaceIReceive
- Returns:
- status
-
selftest
- Throws:
IOException
-
bootloaderMode
- Throws:
IOException
-
getProtocolVersion
-
setLedMute
- Throws:
IOException
-
setLed
- Throws:
IOException
-
getVersion
Description copied from interface:IHarcHardware
Returns the hardware version (not the version of the driver software). May be null if no relevant information available.- Specified by:
getVersion
in interfaceIHarcHardware
- Overrides:
getVersion
in classIrSerial<LocalSerialPortRaw>
- Returns:
- Version string. Semantics can vary.
-
setBeginTimeout
- Specified by:
setBeginTimeout
in interfaceIIrReader
- Throws:
IOException
-
setCaptureMaxSize
public void setCaptureMaxSize(int captureMaxSize) - Specified by:
setCaptureMaxSize
in interfaceIIrReader
-
setEndingTimeout
public void setEndingTimeout(int timeout) - Specified by:
setEndingTimeout
in interfaceIIrReader
-
sendIr
public boolean sendIr(org.harctoolbox.ircore.IrSignal code, int count, Transmitter transmitter) throws IOException, HarcHardwareException - Specified by:
sendIr
in interfaceIRawIrSender
- Returns:
- if false, command failed.
- Throws:
IOException
NoSuchTransmitterException
HarcHardwareException
-
sendCcf
public boolean sendCcf(String ccf, int count, Transmitter transmitter) throws IOException, HarcHardwareException, org.harctoolbox.ircore.Pronto.NonProntoFormatException, org.harctoolbox.ircore.InvalidArgumentException - Throws:
IOException
HarcHardwareException
org.harctoolbox.ircore.Pronto.NonProntoFormatException
org.harctoolbox.ircore.InvalidArgumentException
-
sendCcfRepeat
Not supported due to hardware restrictions.- Parameters:
ccf
-transmitter
-- Returns:
-
setDebug
public void setDebug(int debug) Description copied from interface:IHarcHardware
Sets a debug parameter. Exact semantic depends on the implementation.- Specified by:
setDebug
in interfaceIHarcHardware
-