T
- public class GirsClient<T extends ICommandLineDevice & IHarcHardware> extends Object implements IHarcHardware, IReceive, IRawIrSender, IRawIrSenderRepeat, IRemoteCommandIrSender, IIrSenderStop, ITransmitter, ICapture, ICommandLineDevice
repeatMax
repeatMax
defaultBeginTimeout, defaultCaptureMaxSize, defaultEndTimeout
Constructor and Description |
---|
GirsClient(T hardware) |
Modifier and Type | Method and Description |
---|---|
ModulatedIrSequence |
capture()
Listens to the device and returns a sequence.
|
void |
close() |
void |
flushInput() |
int |
getBeginTimeout() |
String[] |
getCommands(String remote)
Returns an array of command names for the remote given in the argument.
|
int |
getEndTimeout() |
int |
getMaxCaptureLength() |
List<String> |
getModules() |
String[] |
getRemotes()
Returns an array of "remote" names.
|
Transmitter |
getTransmitter()
Returns a default Transmitter for the device.
|
Transmitter |
getTransmitter(String connector)
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 |
hasModule(String module) |
boolean |
isValid()
Tries to identify instances that are not valid.
|
static void |
main(String[] args)
Just for testing.
|
void |
open()
Opens the device with previously set parameters.
|
String |
readString()
Reads a line of text.
|
String |
readString(boolean wait)
Reads a line of text.
|
boolean |
ready()
Tells whether this stream is ready to be read.
|
IrSequence |
receive()
Listens to the device and returns a sequence.
|
void |
reset() |
boolean |
sendIr(IrSignal irSignal,
int count,
Transmitter transmitter) |
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.
|
boolean |
sendIrRepeat(IrSignal irSignal,
Transmitter transmitter)
Like sendCcf, but continues the transmission until interrupted by a stopIr command.
|
void |
sendString(String cmd)
Sends a command (a String) to the instance.
|
void |
setBeginTimeout(int beginTimeout) |
void |
setCaptureMaxSize(int maxCaptureLength) |
void |
setDebug(int debug)
Sets a debug parameter.
|
void |
setEndTimeout(int endingTimeout) |
void |
setFallbackFrequency(int fallbackFrequency) |
void |
setLcd(String message) |
void |
setLcd(String message,
int x,
int y) |
void |
setLcdBacklight(boolean state) |
void |
setLcdBacklight(int flashTime) |
void |
setLed(int led,
boolean state) |
void |
setLed(int led,
int flashTime) |
void |
setLineEnding(String lineEnding) |
void |
setTimeout(int timeout)
Deprecated.
|
void |
setUseReceiveForCapture(boolean val) |
void |
setVerbosity(boolean verbose)
Sets a verbosity flag, causing commands to be executed verbosely.
|
boolean |
stopCapture()
Signals the capturing device that it should stop capturing.
|
boolean |
stopIr(Transmitter transmitter)
Stops ongoing IR transmission.
|
boolean |
stopReceive()
Signals the receiving device that it should stop receiving.
|
void |
waitFor(String goal,
String areUThere,
int delay,
int tries) |
public GirsClient(T hardware) throws HarcHardwareException, IOException
HarcHardwareException
IOException
public static void main(String[] args)
args
- the command line argumentspublic void setUseReceiveForCapture(boolean val)
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public String getVersion() throws IOException
IHarcHardware
getVersion
in interface IHarcHardware
IOException
public void setVerbosity(boolean verbose)
IHarcHardware
setVerbosity
in interface IHarcHardware
verbose
- on or offpublic void setDebug(int debug)
IHarcHardware
setDebug
in interface IHarcHardware
@Deprecated public void setTimeout(int timeout) throws IOException
IHarcHardware
setTimeout
in interface IHarcHardware
timeout
- Timeout in milliseconds.IOException
public int getBeginTimeout()
public void setBeginTimeout(int beginTimeout)
setBeginTimeout
in interface IIrReader
beginTimeout
- the beginTimeout to setpublic int getMaxCaptureLength()
public void setCaptureMaxSize(int maxCaptureLength)
setCaptureMaxSize
in interface IIrReader
maxCaptureLength
- the maxCaptureLength to setpublic int getEndTimeout()
public void setEndTimeout(int endingTimeout)
setEndTimeout
in interface IIrReader
endingTimeout
- the endingTimeout to setpublic void setLineEnding(String lineEnding)
lineEnding
- the lineEnding to setpublic boolean isValid()
IHarcHardware
isValid
in interface IHarcHardware
public boolean hasModule(String module)
public void setFallbackFrequency(int fallbackFrequency)
fallbackFrequency
- the fallbackFrequency to setpublic boolean sendIr(IrSignal irSignal, int count, Transmitter transmitter) throws NoSuchTransmitterException, IrpMasterException, IOException
sendIr
in interface IRawIrSender
NoSuchTransmitterException
IrpMasterException
IOException
public void open() throws IOException, HarcHardwareException
IHarcHardware
open
in interface IHarcHardware
IOException
HarcHardwareException
public void waitFor(String goal, String areUThere, int delay, int tries) throws IOException, HarcHardwareException
IOException
HarcHardwareException
public ModulatedIrSequence capture() throws IOException, HarcHardwareException, IrpMasterException
ICapture
capture
in interface ICapture
IOException
HarcHardwareException
- if the device is not in valid/open state.IrpMasterException
public boolean stopCapture()
ICapture
stopCapture
in interface ICapture
public IrSequence receive() throws HarcHardwareException, IOException, IrpMasterException
IReceive
receive
in interface IReceive
HarcHardwareException
- if the device is not in valid/open state.IOException
IrpMasterException
public boolean stopReceive()
IReceive
stopReceive
in interface IReceive
public void reset() throws IOException
IOException
public void sendString(String cmd) throws IOException
ICommandLineDevice
sendString
in interface ICommandLineDevice
cmd
- Command string to be sent.IOException
public String readString() throws IOException
ICommandLineDevice
readString
in interface ICommandLineDevice
IOException
public String readString(boolean wait) throws IOException
ICommandLineDevice
readString
in interface ICommandLineDevice
wait
- if true, wait until something arrives, otherwise return null if nothing there.IOException
public boolean ready() throws IOException
ICommandLineDevice
ready
in interface ICommandLineDevice
IOException
- If an I/O error occurspublic void flushInput() throws IOException
flushInput
in interface ICommandLineDevice
IOException
public Transmitter getTransmitter()
IRawIrSender
getTransmitter
in interface IRawIrSender
getTransmitter
in interface IRemoteCommandIrSender
getTransmitter
in interface ITransmitter
public boolean stopIr(Transmitter transmitter) throws NoSuchTransmitterException, IOException
IIrSenderStop
stopIr
in interface IIrSenderStop
NoSuchTransmitterException
IOException
public Transmitter getTransmitter(String connector) throws NoSuchTransmitterException
ITransmitter
getTransmitter
in interface ITransmitter
connector
- String describing desired port. Syntax is dependent on the implementing class.NoSuchTransmitterException
public String[] getTransmitterNames()
ITransmitter
getTransmitterNames
in interface ITransmitter
public boolean sendIrRepeat(IrSignal irSignal, Transmitter transmitter) throws NoSuchTransmitterException, IOException, IrpMasterException
IRawIrSenderRepeat
sendIrRepeat
in interface IRawIrSenderRepeat
NoSuchTransmitterException
IOException
IrpMasterException
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 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 sendIrCommandRepeat(String remote, String command, Transmitter transmitter) throws IOException, NoSuchTransmitterException
IRemoteCommandIrSender
sendIrCommandRepeat
in interface IRemoteCommandIrSender
IOException
NoSuchTransmitterException
public void setLed(int led, boolean state) throws IOException, HarcHardwareException
IOException
HarcHardwareException
public void setLed(int led, int flashTime)
public void setLcd(String message) throws IOException, HarcHardwareException
IOException
HarcHardwareException
public void setLcd(String message, int x, int y)
public void setLcdBacklight(boolean state)
public void setLcdBacklight(int flashTime)
Copyright © 2016. All rights reserved.