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
FieldsModifier and TypeFieldDescriptionstatic final intstatic final LocalSerialPort.FlowControlstatic final Stringstatic final intstatic final booleanFields inherited from class org.harctoolbox.harchardware.ir.IrSerial
serialPort, verboseFields inherited from interface org.harctoolbox.harchardware.ir.IIrReader
DEFAULT_BEGIN_TIMEOUT, DEFAULT_CAPTURE_MAXSIZE, DEFAULT_ENDING_TIMEOUTFields inherited from interface org.harctoolbox.harchardware.ir.IRawIrSender
repeatMax -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidorg.harctoolbox.ircore.ModulatedIrSequencecapture()Listens to the device and returns a sequence.voidvoidclose()Returns the hardware version (not the version of the driver software).voidopen()Opens the device with previously set parameters.org.harctoolbox.ircore.IrSequencereceive()Listens to the device and returns a sequence.voidreset(int times) selftest()booleansendCcf(String ccf, int count, Transmitter transmitter) booleansendCcfRepeat(String ccf, Transmitter transmitter) Not supported due to hardware restrictions.booleansendIr(org.harctoolbox.ircore.IrSignal code, int count, Transmitter transmitter) voidsetBeginTimeout(int beginTimeout) voidsetCaptureMaxSize(int captureMaxSize) voidsetDebug(int debug) Sets a debug parameter.voidsetEndingTimeout(int timeout) voidsetLed(boolean status) voidsetLedMute(boolean status) voidsetPin(int pin, boolean state) pin 2: RA2 pin 3: RA3 pin 4: RA4 pin 5: RA5 pin 11: RB3 pin 13: RB5booleanSignals the capturing device that it should stop capturing.booleanSignals 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, setVerboseMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.harctoolbox.harchardware.IHarcHardware
isValid, setTimeout, setVerboseMethods 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:IHarcHardwareOpens the device with previously set parameters.- Specified by:
openin interfaceIHarcHardware- Overrides:
openin classIrSerial<LocalSerialPortRaw>- Throws:
IOExceptionHarcHardwareException
-
checkVersion
- Throws:
HarcHardwareExceptionIOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classIrSerial<LocalSerialPortRaw>- Throws:
IOException
-
reset
- Throws:
IOException
-
capture
public org.harctoolbox.ircore.ModulatedIrSequence capture() throws HarcHardwareException, IOExceptionDescription copied from interface:ICaptureListens to the device and returns a sequence. Requires the device to be previously opened. Should itself neither open or close the device.- Specified by:
capturein 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:ICaptureSignals the capturing device that it should stop capturing. May not be implemented in all hardware.- Specified by:
stopCapturein interfaceICapture- Returns:
- status
-
receive
Description copied from interface:IReceiveListens to the device and returns a sequence. Requires the device to be previously opened. Should itself neither open or close the device.- Specified by:
receivein 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:IReceiveSignals the receiving device that it should stop receiving. May not be implemented in all hardware.- Specified by:
stopReceivein interfaceIReceive- Returns:
- status
-
selftest
- Throws:
IOException
-
bootloaderMode
- Throws:
IOException
-
getProtocolVersion
-
setLedMute
- Throws:
IOException
-
setLed
- Throws:
IOException
-
getVersion
Description copied from interface:IHarcHardwareReturns the hardware version (not the version of the driver software). May be null if no relevant information available.- Specified by:
getVersionin interfaceIHarcHardware- Overrides:
getVersionin classIrSerial<LocalSerialPortRaw>- Returns:
- Version string. Semantics can vary.
-
setBeginTimeout
- Specified by:
setBeginTimeoutin interfaceIIrReader- Throws:
IOException
-
setCaptureMaxSize
public void setCaptureMaxSize(int captureMaxSize) - Specified by:
setCaptureMaxSizein interfaceIIrReader
-
setEndingTimeout
public void setEndingTimeout(int timeout) - Specified by:
setEndingTimeoutin interfaceIIrReader
-
sendIr
public boolean sendIr(org.harctoolbox.ircore.IrSignal code, int count, Transmitter transmitter) throws IOException, HarcHardwareException - Specified by:
sendIrin interfaceIRawIrSender- Returns:
- if false, command failed.
- Throws:
IOExceptionNoSuchTransmitterExceptionHarcHardwareException
-
sendCcf
public boolean sendCcf(String ccf, int count, Transmitter transmitter) throws IOException, HarcHardwareException, org.harctoolbox.ircore.Pronto.NonProntoFormatException, org.harctoolbox.ircore.InvalidArgumentException - Throws:
IOExceptionHarcHardwareExceptionorg.harctoolbox.ircore.Pronto.NonProntoFormatExceptionorg.harctoolbox.ircore.InvalidArgumentException
-
sendCcfRepeat
Not supported due to hardware restrictions.- Parameters:
ccf-transmitter-- Returns:
-
setDebug
public void setDebug(int debug) Description copied from interface:IHarcHardwareSets a debug parameter. Exact semantic depends on the implementation.- Specified by:
setDebugin interfaceIHarcHardware
-