agentland.device.phone
Class PhoneAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--agentland.util.GoodAgent
                                |
                                +--agentland.device.phone.PhoneAgent
All Implemented Interfaces:
Agent, Good, GuiEnabled, MetagluePrimitives, ModemEventListener, Phone, Remote, Serializable, Spy

public class PhoneAgent
extends GoodAgent
implements Phone, ModemEventListener

See Also:
Serialized Form

Inner Class Summary
protected  class PhoneAgent.CallTimeout
           
 
Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Field Summary
static int IN_USE
           
static int RINGING
           
protected  int status
           
static String[] statusNames
           
static int WAITING
           
 
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
 
Constructor Summary
PhoneAgent()
           
 
Method Summary
 void answer()
          answers the phone in voice mode
 String cleanUpNumber(String number)
          Removes all non-digit characters from the string
 Vector getCallLog()
           
 GuiMaker getGuiMaker()
           
 int getStatus()
           
 String getStatusString()
           
 void hangUp()
          Hangs up and thus ends a phone connection
 void makeACall(String number)
          Initiates a voice phonecall
 void modemSays(String in)
          A call back method - it get's called by the SerialVoiceModem when stuff arrives through the serial port
 void resetCallLog()
          Clears the log
 void sendCommand(String cmd)
          If you really must....
protected  void setStatus(int v)
           
protected  void startedRinging()
           
protected  void stoppedRinging()
           
protected  void updateCallLog(PhonecallInfo pi)
           
 
Methods inherited from class agentland.util.GoodAgent
addSpy, addSpy, alert, alertString, beep, error, getAlert, 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, 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 agentland.util.Good
getHistory, getHistoryElement, resetHistory
 
Methods inherited from interface metaglue.Agent
addMonitor, alive, getAgentID, getMetaglueAgentID, shutdown, startup, whereAreYou
 
Methods inherited from interface agentland.util.Spy
tell
 

Field Detail

WAITING

public static final int WAITING

RINGING

public static final int RINGING

IN_USE

public static final int IN_USE

statusNames

public static final String[] statusNames

status

protected int status
Constructor Detail

PhoneAgent

public PhoneAgent()
           throws RemoteException
Method Detail

cleanUpNumber

public String cleanUpNumber(String number)
                     throws RemoteException
Removes all non-digit characters from the string
Specified by:
cleanUpNumber in interface Phone
Parameters:
number - string to be cleaned up

makeACall

public void makeACall(String number)
               throws RemoteException
Initiates a voice phonecall
Specified by:
makeACall in interface Phone
Parameters:
number - the phonenumber to dial; can contain spaces and dashes

hangUp

public void hangUp()
            throws RemoteException
Hangs up and thus ends a phone connection
Specified by:
hangUp in interface Phone
Throws:
RemoteException - if an error occurs

answer

public void answer()
            throws RemoteException
answers the phone in voice mode
Specified by:
answer in interface Phone

sendCommand

public void sendCommand(String cmd)
                 throws RemoteException
If you really must....
Specified by:
sendCommand in interface Phone
Parameters:
cmd - the command to be sent to the modem; if you mess up it's your fault

getCallLog

public Vector getCallLog()
                  throws RemoteException
Specified by:
getCallLog in interface Phone
Returns:
a sorted (by time) vector of recent phonecalls (in ascending order)

resetCallLog

public void resetCallLog()
                  throws RemoteException
Clears the log
Specified by:
resetCallLog in interface Phone

updateCallLog

protected void updateCallLog(PhonecallInfo pi)

setStatus

protected void setStatus(int v)

getStatus

public int getStatus()
              throws RemoteException
Specified by:
getStatus in interface Phone

getStatusString

public String getStatusString()
                       throws RemoteException
Specified by:
getStatusString in interface Phone

modemSays

public void modemSays(String in)
A call back method - it get's called by the SerialVoiceModem when stuff arrives through the serial port
Specified by:
modemSays in interface ModemEventListener

stoppedRinging

protected void stoppedRinging()

startedRinging

protected void startedRinging()

getGuiMaker

public GuiMaker getGuiMaker()
                     throws RemoteException
Specified by:
getGuiMaker in interface GuiEnabled