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
Nested ClassesModifier and TypeClassDescriptionstatic enumInterface that can be used to command an IrTrans unitstatic classstatic enumIR LEDs on the IrTrans -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected static final intprotected static final intprotected InetAddressprotected IrTrans.Interfacestatic final intport number, not possible to change.protected intprotected booleanFields inherited from interface org.harctoolbox.harchardware.ir.IRawIrSender
repeatMax -
Constructor Summary
ConstructorsConstructorDescriptionIrTrans(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 TypeMethodDescriptionvoidclose()static StringReturns 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 booleanReturns the hardware version (not the version of the driver software).booleanisValid()Checks validity of an instance.static voidvoidopen()Opens the device with previously set parameters.booleansendCcf(String ccf, int count, IrTrans.Led led) booleansendCcf(String ccf, int count, Transmitter transmitter) booleansendCcfRepeat(String ccf, Transmitter transmitter) protected StringsendCommand(String cmd) protected booleansendCommandUdp(String cmd) booleansendIr(org.harctoolbox.ircore.IrSignal code, int count, IrTrans.Led led) booleansendIr(org.harctoolbox.ircore.IrSignal code, int count, Transmitter transmitter) voidsetDebug(int debug) Sets a debug parameter.voidsetTimeout(int timeout) Set timeout in milliseconds.voidsetVerbose(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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getUri
Description copied from interface:IWebReturns an URI to be used for browsing the device, possibly containing user and password information. -
open
public void open()Description copied from interface:IHarcHardwareOpens the device with previously set parameters.- Specified by:
openin interfaceIHarcHardware
-
setDebug
public void setDebug(int debug) Description copied from interface:IHarcHardwareSets a debug parameter. Exact semantic depends on the implementation.- Specified by:
setDebugin interfaceIHarcHardware
-
getTransmitter
Description copied from interface:IRawIrSenderReturns a default Transmitter for the device. May be null if the device ignores the Transmitter argument in sendIr.- Specified by:
getTransmitterin interfaceIRawIrSender- Specified by:
getTransmitterin interfaceITransmitter- Returns:
- Transmitter
-
newTransmitter
-
getTransmitter
Description copied from interface:ITransmitterParses the String argument, and returns a transmitter accordingly. Syntax and semantics may vary.- Specified by:
getTransmitterin interfaceITransmitter- Parameters:
port- String describing desired port. Syntax is dependent on the implementing class.- Returns:
- Transmitter
- Throws:
NoSuchTransmitterException
-
getTransmitterNames
Description copied from interface:ITransmitterReturn 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:
getTransmitterNamesin interfaceITransmitter- Returns:
- Array of strings that are guaranteed to work with the getTransmitter(String)
-
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.
-
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
-
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- Timeout in milliseconds.
-
sendCommand
- 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- Returns:
- Version string. Semantics can vary.
- Throws:
IOException
-
getUrl
- Throws:
MalformedURLExceptionIOException
-
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:
sendIrin interfaceIRawIrSender- Returns:
- if false, command failed.
- Throws:
IOExceptionNoSuchTransmitterException
-