org.lirc.util
Class SimpleLIRCClient

java.lang.Object
  |
  +--org.lirc.util.SimpleLIRCClient

public class SimpleLIRCClient
extends java.lang.Object

Can be used to quickly add LIRC support to a java application. Takes care of loading a config file and mapping button presses to application specific strings. The format of this config file is decsribed in the LIRCMap documentation. See org.lirc.test.MoveDot for an example application. Code example:

private SimpleLIRCClient client;

...

String configFile = "myConfig.lirc";
client = new SimpleLIRCClient("myprog", configFile);
client.addIRActionListener(new MyIRListener());

...

client.stopListening();

Version:
$Revision: 1.4 $
Author:
Bjorn Bringert (bjorn@mumblebee.com)
See Also:
LIRCMap

Constructor Summary
SimpleLIRCClient(java.io.File file)
          Creates a new SimpleLIRCClient that loads it's settings from a file.
SimpleLIRCClient(java.lang.String filename)
          Creates a new SimpleLIRCClient that loads it's settings from a file.
SimpleLIRCClient(java.lang.String program, java.io.File file)
          Creates a new SimpleLIRCClient that loads it's settings from a file.
SimpleLIRCClient(java.lang.String program, java.lang.String filename)
          Creates a new SimpleLIRCClient that loads it's settings from a file.
 
Method Summary
 void addIRActionListener(IRActionListener l)
          Adds an IRActionListener
protected  void fireIRAction(java.lang.String command)
          Notify all listeners that have registered interest for notification on this event type.
 void loadSettings(java.io.File file)
          Loads a LIRCMap from a file.
 void loadSettings(java.lang.String filename)
          Loads a LIRCMap from a file.
 void removeIRActionListener(IRActionListener l)
          Removes an IRActionListener
 void saveSettings(java.io.File file)
          Saves the LIRCMap to a file.
 void saveSettings(java.lang.String filename)
          Saves the LIRCMap to a file.
 void stopListening()
          Stops listening for IR events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleLIRCClient

public SimpleLIRCClient(java.lang.String filename)
                 throws LIRCException,
                        java.io.FileNotFoundException,
                        java.io.IOException
Creates a new SimpleLIRCClient that loads it's settings from a file.
Parameters:
filename - The file to load settings from
Throws:
LIRCException - if there is a problem connection to the LIRC daemon
java.io.FileNotFoundException - if the config file can't be found
java.io.IOException - if there is a problem reading the config file

SimpleLIRCClient

public SimpleLIRCClient(java.io.File file)
                 throws LIRCException,
                        java.io.FileNotFoundException,
                        java.io.IOException
Creates a new SimpleLIRCClient that loads it's settings from a file.
Parameters:
file - The file to load settings from
Throws:
LIRCException - if there is a problem connection to the LIRC daemon
java.io.FileNotFoundException - if the config file can't be found
java.io.IOException - if there is a problem reading the config file

SimpleLIRCClient

public SimpleLIRCClient(java.lang.String program,
                        java.lang.String filename)
                 throws LIRCException,
                        java.io.FileNotFoundException,
                        java.io.IOException
Creates a new SimpleLIRCClient that loads it's settings from a file.
Parameters:
program - The program name used in config files, can be null
filename - The file to load settings from
Throws:
LIRCException - if there is a problem connection to the LIRC daemon
java.io.FileNotFoundException - if the config file can't be found
java.io.IOException - if there is a problem reading the config file

SimpleLIRCClient

public SimpleLIRCClient(java.lang.String program,
                        java.io.File file)
                 throws LIRCException,
                        java.io.FileNotFoundException,
                        java.io.IOException
Creates a new SimpleLIRCClient that loads it's settings from a file.
Parameters:
program - The program name used in config files, can be null
file - The file to load settings from
Throws:
LIRCException - if there is a problem connection to the LIRC daemon
java.io.FileNotFoundException - if the config file can't be found
java.io.IOException - if there is a problem reading the config file
Method Detail

stopListening

public void stopListening()
Stops listening for IR events.

addIRActionListener

public void addIRActionListener(IRActionListener l)
Adds an IRActionListener

removeIRActionListener

public void removeIRActionListener(IRActionListener l)
Removes an IRActionListener

fireIRAction

protected void fireIRAction(java.lang.String command)
Notify all listeners that have registered interest for notification on this event type.

loadSettings

public void loadSettings(java.lang.String filename)
                  throws java.io.FileNotFoundException,
                         java.io.IOException
Loads a LIRCMap from a file.
Throws:
java.io.FileNotFoundException - if the config file can't be found
java.io.IOException - if there is a problem reading the config file

loadSettings

public void loadSettings(java.io.File file)
                  throws java.io.FileNotFoundException,
                         java.io.IOException
Loads a LIRCMap from a file.
Throws:
java.io.FileNotFoundException - if the config file can't be found
java.io.IOException - if there is a problem reading the config file

saveSettings

public void saveSettings(java.lang.String filename)
                  throws java.io.IOException
Saves the LIRCMap to a file.
Throws:
java.io.IOException - if there is a problem writing the config file

saveSettings

public void saveSettings(java.io.File file)
                  throws java.io.IOException
Saves the LIRCMap to a file.
Throws:
java.io.IOException - if there is a problem writing the config file