public class LircClient extends Object implements IHarcHardware, IRemoteCommandIrSender, IIrSenderStop, ITransmitter
Modifier and Type | Class and Description |
---|---|
static class |
LircClient.CommandList |
static class |
LircClient.CommandSendOnce |
static class |
LircClient.CommandSendStart |
static class |
LircClient.CommandSendStop |
static class |
LircClient.CommandSetTransmitters |
static class |
LircClient.CommandSimulate |
static class |
LircClient.CommandVersion |
Modifier and Type | Field and Description |
---|---|
static String |
defaultLircIP |
static int |
defaultTimeout |
static int |
lircDefaultPort |
repeatMax
Constructor and Description |
---|
LircClient(String hostname) |
LircClient(String hostname,
boolean verbose) |
LircClient(String hostname,
boolean verbose,
int timeout) |
LircClient(String hostname,
int port,
boolean verbose,
int timeout) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
String[] |
getCommands(String remote)
Returns an array of command names for the remote given in the argument.
|
String[] |
getRemotes()
Returns an array of "remote" names.
|
LircTransmitter |
getTransmitter()
Returns a default Transmitter for the device.
|
LircTransmitter |
getTransmitter(int portNo) |
LircTransmitter |
getTransmitter(String port)
Parses the String argument, and returns a transmitter accordingly.
|
String[] |
getTransmitterNames()
Return possible name of transmitters, that are guaranteed to work with the getTransmitter(String).
|
String |
getVersion()
Returns the hardware version (not the version of the driver software).
|
boolean |
isValid()
Dummy implementation, always returns true
|
static void |
main(String[] args) |
void |
open()
Opens the device with previously set parameters.
|
protected void |
readLoop() |
protected String[] |
sendCommand(String packet,
boolean oneWord) |
boolean |
sendIrCommand(String remote,
String command,
int count,
int connector) |
boolean |
sendIrCommand(String remote,
String command,
int count,
Transmitter transmitter)
Sends the command to the hardware, to be sent count number of times.
|
boolean |
sendIrCommandRepeat(String remote,
String command,
Transmitter transmitter)
Like sendIr, but sends the IR signal until stopped by stopIr.
|
void |
setDebug(int debug)
Sets a debug parameter.
|
void |
setTimeout(int timeout)
Set timeout in milliseconds.
|
boolean |
setTransmitters(boolean[] ports) |
boolean |
setTransmitters(int port) |
boolean |
setTransmitters(Transmitter transmitter)
Sends the SET_TRANSMITTER command to the LIRC server.
|
void |
setVerbosity(boolean verbosity)
Sets a verbosity flag, causing commands to be executed verbosely.
|
boolean |
stopIr(String remote,
String command,
int port) |
boolean |
stopIr(String remote,
String command,
Transmitter transmitter) |
boolean |
stopIr(Transmitter transmitter)
Stops ongoing IR transmission.
|
public static final int lircDefaultPort
public static final String defaultLircIP
public static final int defaultTimeout
public LircClient(String hostname, int port, boolean verbose, int timeout) throws UnknownHostException, IOException
UnknownHostException
IOException
public LircClient(String hostname, boolean verbose, int timeout) throws UnknownHostException, IOException
UnknownHostException
IOException
public LircClient(String hostname, boolean verbose) throws UnknownHostException, IOException
UnknownHostException
IOException
public LircClient(String hostname) throws UnknownHostException, IOException
UnknownHostException
IOException
public static void main(String[] args)
args
- the command line arguments.public void close()
close
in interface Closeable
close
in interface AutoCloseable
public void open()
IHarcHardware
open
in interface IHarcHardware
public LircTransmitter getTransmitter()
IRemoteCommandIrSender
getTransmitter
in interface IRemoteCommandIrSender
getTransmitter
in interface ITransmitter
public LircTransmitter getTransmitter(int portNo) throws NoSuchTransmitterException
NoSuchTransmitterException
public LircTransmitter getTransmitter(String port) throws NoSuchTransmitterException
ITransmitter
getTransmitter
in interface ITransmitter
port
- String describing desired port. Syntax is dependent on the implementing class.NoSuchTransmitterException
public String[] getTransmitterNames()
ITransmitter
getTransmitterNames
in interface ITransmitter
public void setVerbosity(boolean verbosity)
IHarcHardware
setVerbosity
in interface IHarcHardware
verbosity
- on or offpublic void setDebug(int debug)
IHarcHardware
setDebug
in interface IHarcHardware
public void setTimeout(int timeout)
IHarcHardware
setTimeout
in interface IHarcHardware
timeout
- Timeout in milliseconds.protected void readLoop() throws IOException
IOException
protected final String[] sendCommand(String packet, boolean oneWord) throws IOException
IOException
public boolean sendIrCommand(String remote, String command, int count, Transmitter transmitter) throws IOException, NoSuchTransmitterException
IRemoteCommandIrSender
sendIrCommand
in interface IRemoteCommandIrSender
count
- Number of times to repeat the commandIOException
NoSuchTransmitterException
public boolean sendIrCommand(String remote, String command, int count, int connector) throws IOException, NoSuchTransmitterException
public boolean sendIrCommandRepeat(String remote, String command, Transmitter transmitter) throws IOException, NoSuchTransmitterException
IRemoteCommandIrSender
sendIrCommandRepeat
in interface IRemoteCommandIrSender
IOException
NoSuchTransmitterException
public boolean stopIr(String remote, String command, Transmitter transmitter) throws IOException, NoSuchTransmitterException
public boolean stopIr(String remote, String command, int port) throws IOException, NoSuchTransmitterException
public boolean stopIr(Transmitter transmitter) throws IOException, NoSuchTransmitterException
IIrSenderStop
stopIr
in interface IIrSenderStop
IOException
NoSuchTransmitterException
public String[] getRemotes() throws IOException
IRemoteCommandIrSender
getRemotes
in interface IRemoteCommandIrSender
IOException
public String[] getCommands(String remote) throws IOException
IRemoteCommandIrSender
getCommands
in interface IRemoteCommandIrSender
remote
- The "remote" to search inIOException
public boolean setTransmitters(Transmitter transmitter) throws NoSuchTransmitterException, IOException
transmitter
- IOException
NoSuchTransmitterException
public boolean setTransmitters(int port) throws NoSuchTransmitterException, IOException
public boolean setTransmitters(boolean[] ports) throws NoSuchTransmitterException, IOException
public String getVersion() throws IOException
IHarcHardware
getVersion
in interface IHarcHardware
IOException
public boolean isValid()
isValid
in interface IHarcHardware
Copyright © 2016. All rights reserved.