agentland.device
Class VCRAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--agentland.device.VCRAgent
All Implemented Interfaces:
Agent, MetagluePrimitives, Remote, Serializable, VCR

public class VCRAgent
extends AgentAgent
implements VCR

VCR Agent Intelligent Room/HAL Project MIT Artificial Intelligence Laboratory Cambridge, MA

Adapted from sbj's hci.dev.VCR code into agent form 1/22/98 - jjlilley The VCR class controls the VCR currently connected to Bird "A", by sending the appropriate addresses to the SerialIR class. It also keeps status information: power on/off, mute on/off, and tape status (play/pause/ffwd/rew/rec/idle). Of course, it doesn't receive this information from the VCR, so when this class is instantiated some status information is assumed. See below.

Commands are sent via the press() method, which acts like a finger, pressing a button on the remote control. For instance, press("VOLUME UP") raises the volume a notch. Other methods include hold(), which is like press but the button is left down. release() clears the BIRD, releasing any held buttons (including those from other devices). setChannel(), for convenience, presses all of the buttons necessary to set the VCR's channel to the number given.

Upon instantiation, the power to the VCR is assumed OFF. This means that few commands will work until a vcr.press("POWER") is performed. When the power is turned on, mute is assumed OFF, and the tape is assumed IDLE.

See Also:
Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Field Summary
 boolean muteStatus
          This flag reports true if the VCR is "muted".
static String myselfAsString
           
 boolean powerStatus
          This flag reports the guessed power status.
 int tapeStatus
          This flag reports the tape status.
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Constructor Summary
VCRAgent()
           
 
Method Summary
 void channelDown()
           
 void channelUp()
           
 void enter()
           
 void fastForward()
           
 int getIntTapeStatus()
           
 boolean getMuteStatus()
           
 boolean getPowerStatus()
           
 String getStringTapeStatus()
           
 void mute()
           
 void pause()
           
 void play()
           
 void pressNumber(int i)
           
 void record()
           
 void release()
          Releases a held signal, if there is one, from this SerialIR object.
 void rewind()
           
static String selfDescription()
           
 void setChannel(int channel)
          This sets the channel to the specified integer, by pressing the buttons in order, followed by ENTER.
 void setIntTapeStatus(int stat)
           
 void setMuteStatus(boolean muted)
           
 void setPowerStatus(boolean on)
          Use this to set the power status if it's wrong
 void stop()
           
 void togglePower()
           
 void turnOff()
           
 void turnOn()
           
 void tvVcr()
           
 void volumeDown()
           
 void volumeUp()
           
 
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, log, lookupClass, obtainMetaglueAgent, obtainMetaglueAgent, obtainMetaglueAgentByName, reliesOn, reliesOn, 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
 
Methods inherited from interface metaglue.Agent
addMonitor, alive, getAgentID, getMetaglueAgentID, shutdown, startup, whereAreYou
 

Field Detail

powerStatus

public boolean powerStatus
This flag reports the guessed power status. It is modifiable, so if it is wrong it can be changed by an outside class. If another class sets this to true, it should also set muteStatus to false, and tapeStatus to 0.

muteStatus

public boolean muteStatus
This flag reports true if the VCR is "muted".

tapeStatus

public int tapeStatus
This flag reports the tape status. Here are the meanings of the values:

myselfAsString

public static final String myselfAsString
Constructor Detail

VCRAgent

public VCRAgent()
         throws RemoteException
Method Detail

getMuteStatus

public boolean getMuteStatus()
                      throws RemoteException
Specified by:
getMuteStatus in interface VCR

setMuteStatus

public void setMuteStatus(boolean muted)
                   throws RemoteException
Specified by:
setMuteStatus in interface VCR

selfDescription

public static String selfDescription()

setPowerStatus

public void setPowerStatus(boolean on)
                    throws RemoteException
Use this to set the power status if it's wrong
Specified by:
setPowerStatus in interface VCR

release

public void release()
             throws RemoteException
Releases a held signal, if there is one, from this SerialIR object. If no signal is being held, then this method has no effect.

togglePower

public void togglePower()
                 throws RemoteException
Specified by:
togglePower in interface VCR

turnOn

public void turnOn()
            throws RemoteException
Specified by:
turnOn in interface VCR

turnOff

public void turnOff()
             throws RemoteException
Specified by:
turnOff in interface VCR

rewind

public void rewind()
            throws RemoteException
Specified by:
rewind in interface VCR

fastForward

public void fastForward()
                 throws RemoteException
Specified by:
fastForward in interface VCR

play

public void play()
          throws RemoteException
Specified by:
play in interface VCR

record

public void record()
            throws RemoteException
Specified by:
record in interface VCR

stop

public void stop()
          throws RemoteException
Specified by:
stop in interface VCR

pause

public void pause()
           throws RemoteException
Specified by:
pause in interface VCR

channelUp

public void channelUp()
               throws RemoteException
Specified by:
channelUp in interface VCR

channelDown

public void channelDown()
                 throws RemoteException
Specified by:
channelDown in interface VCR

volumeUp

public void volumeUp()
              throws RemoteException
Specified by:
volumeUp in interface VCR

volumeDown

public void volumeDown()
                throws RemoteException
Specified by:
volumeDown in interface VCR

mute

public void mute()
          throws RemoteException
Specified by:
mute in interface VCR

tvVcr

public void tvVcr()
           throws RemoteException
Specified by:
tvVcr in interface VCR

setChannel

public void setChannel(int channel)
                throws RemoteException
This sets the channel to the specified integer, by pressing the buttons in order, followed by ENTER. A one-second delay seperates the presses. Channels less than 0 trigger a VCRException.
Specified by:
setChannel in interface VCR

pressNumber

public void pressNumber(int i)
                 throws RemoteException
Specified by:
pressNumber in interface VCR

enter

public void enter()
           throws RemoteException
Specified by:
enter in interface VCR

getPowerStatus

public boolean getPowerStatus()
                       throws RemoteException
Specified by:
getPowerStatus in interface VCR

getIntTapeStatus

public int getIntTapeStatus()
                     throws RemoteException
Specified by:
getIntTapeStatus in interface VCR

setIntTapeStatus

public void setIntTapeStatus(int stat)
                      throws RemoteException
Specified by:
setIntTapeStatus in interface VCR

getStringTapeStatus

public String getStringTapeStatus()
                           throws RemoteException
Specified by:
getStringTapeStatus in interface VCR