Package org.harctoolbox.harchardware.ir
Class IrWidget
java.lang.Object
org.harctoolbox.harchardware.ir.IrWidget
- All Implemented Interfaces:
Closeable,AutoCloseable,IHarcHardware,ICapture,IIrReader
This class implements support for Kevin Timmerman's Ir Widget.
It uses the NRJavaSerial library, which encapsulates all system dependencies.
Although it duplicates some functionality found in Kevin's program IrScope (file widget.cpp),
it is not derived.
Original web page.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final intNumber of micro seconds in a count.Fields inherited from interface org.harctoolbox.harchardware.ir.IIrReader
DEFAULT_BEGIN_TIMEOUT, DEFAULT_CAPTURE_MAXSIZE, DEFAULT_ENDING_TIMEOUT -
Constructor Summary
ConstructorsConstructorDescriptionIrWidget()Constructs new IrWidget with default port name and timeouts.Constructs new IrWidget with default timeouts.IrWidget(String portName, boolean verbose, Integer beginTimeout, Integer captureMaxSize, Integer endingTimeout, boolean lowerDtrRts) Constructs new IrWidget. -
Method Summary
Modifier and TypeMethodDescriptionorg.harctoolbox.ircore.ModulatedIrSequencecapture()Captures a signal using the given timeout values, and returns it as a ModulatedIrSequence.voidclose()The IrWidget does not support versions.booleanisValid()Checks validity of an instance.voidopen()Opens the device with previously set parameters.voidsetBeginTimeout(int timeout) voidsetCaptureMaxSize(int maxCaptureMaxSize) voidsetDebug(int debug) Sets a debug parameter.voidsetEndingTimeout(int endingTimeout) voidsetTimeout(int timeout) Set timeout in milliseconds.voidsetVerbose(boolean verbose) Sets a verbosity flag, causing commands to be executed verbosely.booleanStops ongoing capture.
-
Field Details
-
MICROS_PER_TICK
public static final int MICROS_PER_TICKNumber of micro seconds in a count.- See Also:
-
DEFAULT_PORTNAME
- See Also:
-
IRWIDGET
- See Also:
-
-
Constructor Details
-
IrWidget
Constructs new IrWidget with default port name and timeouts.- Throws:
IOExceptionNonExistingPortException
-
IrWidget
- Throws:
IOExceptionNonExistingPortException
-
IrWidget
public IrWidget(String portName, boolean verbose, Integer timeout, boolean lowerDtrRts) throws IOException, NonExistingPortException Constructs new IrWidget with default timeouts.- Parameters:
portName- Name of serial port to use. Typically something like COM7: (Windows) or /dev/ttyUSB0.verbose-timeout-lowerDtrRts-- Throws:
IOExceptionNonExistingPortException
-
IrWidget
public IrWidget(String portName, boolean verbose, Integer beginTimeout, Integer captureMaxSize, Integer endingTimeout, boolean lowerDtrRts) throws IOException, NonExistingPortException Constructs new IrWidget.- Parameters:
portName- Name of serial port to use. Typically something like COM7: (Windows) or /dev/ttyUSB0.verbose-beginTimeout-captureMaxSize-endingTimeout-lowerDtrRts-- Throws:
IOExceptionNonExistingPortException
-
-
Method Details
-
setDebug
public void setDebug(int debug) Description copied from interface:IHarcHardwareSets a debug parameter. Exact semantic depends on the implementation.- Specified by:
setDebugin interfaceIHarcHardware
-
open
Description copied from interface:IHarcHardwareOpens the device with previously set parameters.- Specified by:
openin interfaceIHarcHardware- Throws:
HarcHardwareExceptionIOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
setTimeout
public void setTimeout(int timeout) Description copied from interface:IHarcHardwareSet timeout in milliseconds. Exact semantics may be dependent on the hardware.- Specified by:
setTimeoutin interfaceIHarcHardware- Parameters:
timeout-
-
setBeginTimeout
public void setBeginTimeout(int timeout) - Specified by:
setBeginTimeoutin interfaceIIrReader
-
setCaptureMaxSize
public void setCaptureMaxSize(int maxCaptureMaxSize) - Specified by:
setCaptureMaxSizein interfaceIIrReader
-
setEndingTimeout
public void setEndingTimeout(int endingTimeout) - Specified by:
setEndingTimeoutin interfaceIIrReader
-
capture
Captures a signal using the given timeout values, and returns it as a ModulatedIrSequence.- Specified by:
capturein interfaceICapture- Returns:
- ModulatedIrSequence
- Throws:
IOException
-
getVersion
The IrWidget does not support versions.- Specified by:
getVersionin interfaceIHarcHardware- Returns:
- null
-
setVerbose
public void setVerbose(boolean verbose) Description copied from interface:IHarcHardwareSets a verbosity flag, causing commands to be executed verbosely. Exact semantic depends on the implementation. Typically, all communication with the device is echoed to stderr.- Specified by:
setVerbosein interfaceIHarcHardware- Parameters:
verbose- on or off
-
isValid
public boolean isValid()Description copied from interface:IHarcHardwareChecks validity of an instance. Exact meaning can vary.- Specified by:
isValidin interfaceIHarcHardware- Returns:
- validity of the instance.
-
stopCapture
public boolean stopCapture()Stops ongoing capture.- Specified by:
stopCapturein interfaceICapture- Returns:
- true
-