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
Modifier and TypeFieldDescriptionstatic final String
static final String
static final int
Number 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
ConstructorDescriptionIrWidget()
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.ModulatedIrSequence
capture()
Captures a signal using the given timeout values, and returns it as a ModulatedIrSequence.void
close()
The IrWidget does not support versions.boolean
isValid()
Checks validity of an instance.void
open()
Opens the device with previously set parameters.void
setBeginTimeout
(int timeout) void
setCaptureMaxSize
(int maxCaptureMaxSize) void
setDebug
(int debug) Sets a debug parameter.void
setEndingTimeout
(int endingTimeout) void
setTimeout
(int timeout) Set timeout in milliseconds.void
setVerbose
(boolean verbose) Sets a verbosity flag, causing commands to be executed verbosely.boolean
Stops 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:
IOException
NonExistingPortException
-
IrWidget
- Throws:
IOException
NonExistingPortException
-
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:
IOException
NonExistingPortException
-
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:
IOException
NonExistingPortException
-
-
Method Details
-
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
-
open
Description copied from interface:IHarcHardware
Opens the device with previously set parameters.- Specified by:
open
in interfaceIHarcHardware
- Throws:
HarcHardwareException
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
setTimeout
public void setTimeout(int timeout) Description copied from interface:IHarcHardware
Set timeout in milliseconds. Exact semantics may be dependent on the hardware.- Specified by:
setTimeout
in interfaceIHarcHardware
- Parameters:
timeout
-
-
setBeginTimeout
public void setBeginTimeout(int timeout) - Specified by:
setBeginTimeout
in interfaceIIrReader
-
setCaptureMaxSize
public void setCaptureMaxSize(int maxCaptureMaxSize) - Specified by:
setCaptureMaxSize
in interfaceIIrReader
-
setEndingTimeout
public void setEndingTimeout(int endingTimeout) - Specified by:
setEndingTimeout
in interfaceIIrReader
-
capture
Captures a signal using the given timeout values, and returns it as a ModulatedIrSequence.- Specified by:
capture
in interfaceICapture
- Returns:
- ModulatedIrSequence
- Throws:
IOException
-
getVersion
The IrWidget does not support versions.- Specified by:
getVersion
in interfaceIHarcHardware
- Returns:
- null
-
setVerbose
public void setVerbose(boolean verbose) Description copied from interface:IHarcHardware
Sets 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:
setVerbose
in interfaceIHarcHardware
- Parameters:
verbose
- on or off
-
isValid
public boolean isValid()Description copied from interface:IHarcHardware
Checks validity of an instance. Exact meaning can vary.- Specified by:
isValid
in interfaceIHarcHardware
- Returns:
- validity of the instance.
-
stopCapture
public boolean stopCapture()Stops ongoing capture.- Specified by:
stopCapture
in interfaceICapture
- Returns:
- true
-