Package org.harctoolbox.harchardware.ir
Class IrTrans
java.lang.Object
org.harctoolbox.harchardware.ir.IrTrans
- All Implemented Interfaces:
Closeable
,AutoCloseable
,IWeb
,IHarcHardware
,IRawIrSender
,ITransmitter
- Direct Known Subclasses:
IrTransIRDB
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Interface that can be used to command an IrTrans unitstatic class
static enum
IR LEDs on the IrTrans -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
protected static final int
protected static final int
protected InetAddress
protected IrTrans.Interface
static final int
port number, not possible to change.protected int
protected boolean
Fields inherited from interface org.harctoolbox.harchardware.ir.IRawIrSender
repeatMax
-
Constructor Summary
ConstructorDescriptionIrTrans
(InetAddress hostname) IrTrans
(InetAddress hostname, boolean verbose) IrTrans
(InetAddress hostname, boolean verbose, Integer timeout) IrTrans
(InetAddress inetAddress, boolean verbose, Integer timeout, IrTrans.Interface interfaze) IrTrans
(InetAddress inetAddress, Integer port, boolean verbose, Integer timeout) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static String
Returns a default Transmitter for the device.getTransmitter
(String port) Parses the String argument, and returns a transmitter accordingly.String[]
Return possible name of transmitters, that are guaranteed to work with the getTransmitter(String).Returns an URI to be used for browsing the device, possibly containing user and password information.protected boolean
Returns the hardware version (not the version of the driver software).boolean
isValid()
Checks validity of an instance.static void
void
open()
Opens the device with previously set parameters.boolean
sendCcf
(String ccf, int count, IrTrans.Led led) boolean
sendCcf
(String ccf, int count, Transmitter transmitter) boolean
sendCcfRepeat
(String ccf, Transmitter transmitter) protected String
sendCommand
(String cmd) protected boolean
sendCommandUdp
(String cmd) boolean
sendIr
(org.harctoolbox.ircore.IrSignal code, int count, IrTrans.Led led) boolean
sendIr
(org.harctoolbox.ircore.IrSignal code, int count, Transmitter transmitter) void
setDebug
(int debug) Sets a debug parameter.void
setTimeout
(int timeout) Set timeout in milliseconds.void
setVerbose
(boolean verbose) Sets a verbosity flag, causing commands to be executed verbosely.
-
Field Details
-
DEFAULT_IP
- See Also:
-
dummyDelay
protected static final int dummyDelay- See Also:
-
defaultTimeout
protected static final int defaultTimeout- See Also:
-
portNumber
public static final int portNumberport number, not possible to change.- See Also:
-
timeout
protected int timeout -
inetAddress
-
verbose
protected boolean verbose -
interfaze
-
-
Constructor Details
-
IrTrans
public IrTrans(InetAddress inetAddress, boolean verbose, Integer timeout, IrTrans.Interface interfaze) - Parameters:
inetAddress
-verbose
-timeout
-interfaze
-
-
IrTrans
-
IrTrans
-
IrTrans
-
IrTrans
-
IrTrans
- Throws:
UnknownHostException
-
-
Method Details
-
main
-
expandIP
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
getUri
Description copied from interface:IWeb
Returns an URI to be used for browsing the device, possibly containing user and password information. -
open
public void open()Description copied from interface:IHarcHardware
Opens the device with previously set parameters.- Specified by:
open
in interfaceIHarcHardware
-
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
-
getTransmitter
Description copied from interface:IRawIrSender
Returns a default Transmitter for the device. May be null if the device ignores the Transmitter argument in sendIr.- Specified by:
getTransmitter
in interfaceIRawIrSender
- Specified by:
getTransmitter
in interfaceITransmitter
- Returns:
- Transmitter
-
newTransmitter
-
getTransmitter
Description copied from interface:ITransmitter
Parses the String argument, and returns a transmitter accordingly. Syntax and semantics may vary.- Specified by:
getTransmitter
in interfaceITransmitter
- Parameters:
port
- String describing desired port. Syntax is dependent on the implementing class.- Returns:
- Transmitter
- Throws:
NoSuchTransmitterException
-
getTransmitterNames
Description copied from interface:ITransmitter
Return possible name of transmitters, that are guaranteed to work with the getTransmitter(String). This may be generated by inquiring the device, producing correct result, or it may be some static function, describing transmitters not necessarily present on the actually deployed device.- Specified by:
getTransmitterNames
in interfaceITransmitter
- Returns:
- Array of strings that are guaranteed to work with the getTransmitter(String)
-
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.
-
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
-
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
- Timeout in milliseconds.
-
sendCommand
- 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
- Returns:
- Version string. Semantics can vary.
- Throws:
IOException
-
getUrl
- Throws:
MalformedURLException
IOException
-
sendCommandUdp
- Throws:
IOException
-
sendCcf
- Throws:
IOException
-
sendCcf
public boolean sendCcf(String ccf, int count, Transmitter transmitter) throws IOException, NoSuchTransmitterException -
sendCcfRepeat
public boolean sendCcfRepeat(String ccf, Transmitter transmitter) throws IOException, NoSuchTransmitterException -
sendIr
public boolean sendIr(org.harctoolbox.ircore.IrSignal code, int count, IrTrans.Led led) throws IOException - Throws:
IOException
-
sendIr
public boolean sendIr(org.harctoolbox.ircore.IrSignal code, int count, Transmitter transmitter) throws IOException, NoSuchTransmitterException - Specified by:
sendIr
in interfaceIRawIrSender
- Returns:
- if false, command failed.
- Throws:
IOException
NoSuchTransmitterException
-