agentland.output
Class IRAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--agentland.util.GoodAgent
                                |
                                +--agentland.resource.ManagedAgent
                                      |
                                      +--agentland.device.DeviceAgent
                                            |
                                            +--agentland.output.IRAgent

public class IRAgent
extends DeviceAgent
implements IR

IR Agent for resolving contention for the serialIR device The Intelligent Room/HAL Project MIT Artificial Intelligence Laboratory Cambridge, MA The designation for this agent must be the full path-name for the serial port which to go through. It is automatically tied to wonderbug.

See Also:
Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Fields inherited from class agentland.device.DeviceAgent
defaultState, fName, names, states
 
Fields inherited from class agentland.resource.ManagedAgent
rm, society
 
Fields inherited from class agentland.util.GoodAgent
alert, notifier
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Constructor Summary
IRAgent()
          Simply ties the IR agent to wonderbug so that it can be used.
 
Method Summary
 void close()
          Closes the port.
 String getPort()
          Get the name of the port from the attribute database.
 void getUseLock()
          All X10 commands are locked, and can't be used within INTER_TRANSMIT_TIME of each other
 void loadMemory(InputStream i)
          Loads a memory images (2048 bytes) from the given input stream to the BIRD
 void overlay(int bank, String dev)
          Loads a preprogrammed signal set into a bank.
 void releaseUseLock()
           
 void resetSerialIR()
          Closes the serial ir port, then tries to reopen it using ensureSrialIR
 void saveMemory(OutputStream o)
          Stores the BIRDs memory image (2048 bytes) to the given stream.
 void setInterTransmitTime(int ms)
          sets the minimum time required between transmissions
 void signalPulse(int bank, int address)
          Sends a pre-timed IR signal, and then stops.
 void signalStart(int bank, int address)
          Begins a continuous IR signal.
 void signalStop()
          Stops any ongoing continuous signal.
 void teachBegin(int bank)
          Starts the teaching cycle.
 void teachEnd(int bank)
          Ends the programming process.
 void teachSelect(int bank, int address)
          Selects the address to be programmed.
 
Methods inherited from class agentland.device.DeviceAgent
addName, createStateChangeNotification, ensureState, getDefaultNames, getDefaultStateName, getName, getNames, getState, getState, getStateNames, hasName, quietException, resetAllStates, resetName, resetState, resetState, setDefaultStateName, setName, setState, throwException, updateState, updateState, updateState, updateState, updateState, updateState, updateState, updateState
 
Methods inherited from class agentland.resource.ManagedAgent
connect, getAlert, getNeed, reliesOn, reliesOn, replace, request, request, request, requestAgent, requestAgent, resources, resourcesByAgentID, setNeed, yank, yank, yank
 
Methods inherited from class agentland.util.GoodAgent
addSpy, addSpy, alert, alertString, beep, error, getHistory, getHistoryElement, getPersistentMap, log, notify, removeSpy, removeSpy, resetHistory, safeRely, safeRely, safeRely, setNiceLogName, tell
 
Methods inherited from class metaglue.AgentAgent
addMonitor, alive, defrost, defrostAll, defrostBoolean, defrostInt, defrostString, fixAttribute, fixAttribute, freeze, freeze, freeze, freezeAll, freezeVar, getAgentID, getAttribute, getCatalog, getCatalogID, getDesignation, getFrozenVariables, getLogLevel, getMetaglueAgent, getMetaglueAgentID, getOccupation, getProperties, getSociety, log, log, obtainMetaglueAgent, obtainMetaglueAgent, obtainMetaglueAgentByName, reliesOn, reliesOnSynch, removeFrozen, replaceExceptionHandler, setFreezeName, setLogLevel, setLogName, shutdown, startAgent, startAgentOn, startAgentOn, startup, status, tiedTo, tiedTo, tiedTo, tiedTo, tieToDesignation, whereAreYou
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IRAgent

public IRAgent()
        throws RemoteException
Simply ties the IR agent to wonderbug so that it can be used. The actual SerialIR object is retrieved.
Method Detail

resetSerialIR

public void resetSerialIR()
                   throws RemoteException
Closes the serial ir port, then tries to reopen it using ensureSrialIR
Specified by:
resetSerialIR in interface IR

setInterTransmitTime

public void setInterTransmitTime(int ms)
                          throws RemoteException
sets the minimum time required between transmissions
Specified by:
setInterTransmitTime in interface IR

getUseLock

public void getUseLock()
                throws RemoteException
All X10 commands are locked, and can't be used within INTER_TRANSMIT_TIME of each other

releaseUseLock

public void releaseUseLock()
                    throws RemoteException

signalPulse

public void signalPulse(int bank,
                        int address)
                 throws RemoteException
Sends a pre-timed IR signal, and then stops. This cancels any previous continuous signal.
Specified by:
signalPulse in interface IR
Parameters:
bank - (0-3) the bank to load the signal from
address - the signal address

signalStart

public void signalStart(int bank,
                        int address)
                 throws RemoteException
Begins a continuous IR signal. This also cancels any previous continuous signal.
Specified by:
signalStart in interface IR
Parameters:
bank - (0-3) the bank to load the signal from
address - the signal address

signalStop

public void signalStop()
                throws RemoteException
Stops any ongoing continuous signal.
Specified by:
signalStop in interface IR

overlay

public void overlay(int bank,
                    String dev)
             throws RemoteException
Loads a preprogrammed signal set into a bank.
Specified by:
overlay in interface IR
Parameters:
bank - (0-3) the bank
dev - a three-character string consisting entirely of the characters '0'-'9', representing a device code (see BIRD manual)

teachBegin

public void teachBegin(int bank)
                throws RemoteException
Starts the teaching cycle. After this is called, the teaching remote can be positioned.
Parameters:
bank - the bank to be programmed

teachSelect

public void teachSelect(int bank,
                        int address)
                 throws RemoteException
Selects the address to be programmed. Call after the remote has been positioned and the user is ready to begin programming.
Parameters:
bank - the bank
address - the address to be programmed

teachEnd

public void teachEnd(int bank)
              throws RemoteException
Ends the programming process. Call after the remote button has been pressed and held. When this is called, the BIRD stores whatever signal it is recieving.
Parameters:
bank - the bank

loadMemory

public void loadMemory(InputStream i)
                throws RemoteException
Loads a memory images (2048 bytes) from the given input stream to the BIRD
Parameters:
i - the InputStream

saveMemory

public void saveMemory(OutputStream o)
                throws RemoteException
Stores the BIRDs memory image (2048 bytes) to the given stream.
Parameters:
o - the OutputStream

close

public void close()
           throws RemoteException
Closes the port.
Specified by:
close in interface IR

getPort

public String getPort()
Get the name of the port from the attribute database.