agentland.device
Class AlphaLEDSignAgent

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.AlphaLEDSignAgent
All Implemented Interfaces:
Agent, AlphaLEDSign, Good, Managed, MetagluePrimitives, Remote, Serializable, Spy, TextOutput

public class AlphaLEDSignAgent
extends ManagedAgent
implements AlphaLEDSign

AlphaLEDSignAgent controls the Alpha-brand LED signs. The Alpha LED sign can display two lines of text. Using this agent, you can send text information to either the top line, the bottom line, or the middle (which treats both top and bottom lines as one). The text can be formatted in different colors, sizes, and fonts.

See Also:
AlphaLEDColors, AlphaLEDFonts, GoodAgent, AlphaLEDSign, Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
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
 
Constructor Summary
AlphaLEDSignAgent()
          Creates a new AlphaLEDSignAgent instance.
 
Method Summary
 void clear()
          Outputs a " " space character, essentially clearing the display.
 String get()
          Gets the text on the LED.
 String getBottom()
          Gets the text on the bottom line of the LED.
 String getTop()
          Gets the text on the top line of the LED.
 void outputText(String sText)
          outputText displays a message across the entire sign.
 void outputText(String sText, String sColor)
          Outputs text with a specific color to the LED sign.
 void outputText(String sText, String sColor, String sFont)
          Outputs text with a specific color and font to the LED sign.
 void outputTextBoth(String topText, String botText)
          Send output to both lines at once.
 void outputTextBottom(String sText)
          SignBottomOut displays a message on the bottom line of the sign.
 void outputTextBottom(String sText, String sColor)
          Outputs text with a specific color to the bottom row of the LED
 void outputTextTop(String sText)
          Outputs text to the top line of the LED sign.
 void outputTextTop(String sText, String sColor)
          Outputs text with a specified color to the top row of the LED
protected  void sendLinesToSign()
          Internal procedure to send current line data out to sign.
 void setColor(int iColor)
          Sets the color of future text on the display.
 void setColor(String sColor)
          Sets the color of future text on the display.
 void setColorBottom(String sColor)
          Sets the color of the bottom row.
 void setColorTop(String sColor)
          Sets the color of the top row.
 void setFont(int iFont)
          Sets the font of future text.
 void setFont(String sFont)
          Sets the font of future text.
 boolean signTest()
          SignTest asks the sign what is in Text file A.
 boolean testOutputText()
          Tests if we are able to output text to the sign
 
Methods inherited from class agentland.resource.ManagedAgent
connect, getAlert, getNeed, isAvailable, isAvailable, reliesOn, reliesOn, replace, replace, request, request, request, requestAgent, requestAgent, resources, resourcesByAgentID, setNeed, tiedTo, 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, lookupClass, 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
 
Methods inherited from interface agentland.resource.Managed
getNeed, replace, replace, resources, yank, yank
 
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
 

Constructor Detail

AlphaLEDSignAgent

public AlphaLEDSignAgent()
                  throws RemoteException,
                         IOException,
                         javax.comm.PortInUseException,
                         javax.comm.NoSuchPortException
Creates a new AlphaLEDSignAgent instance. This uses the com port and machine specified as attributes. The com port is configured to 2400-7-2-E.
Throws:
RemoteException - if an error occurs
IOException - if an error occurs
javax.comm.PortInUseException - if an error occurs
javax.comm.NoSuchPortException - if an error occurs
Method Detail

outputText

public void outputText(String sText)
                throws RemoteException
outputText displays a message across the entire sign. see the LED Sign PDF document for information on each byte that is used.
Specified by:
outputText in interface AlphaLEDSign
Parameters:
sText - a String value that contains the text to be displayed on the sign.
Throws:
RemoteException - if an error occurs

outputText

public void outputText(String sText,
                       String sColor)
                throws RemoteException
Outputs text with a specific color to the LED sign.
Specified by:
outputText in interface AlphaLEDSign
Parameters:
sText - a String value
sColor - a String value
Throws:
RemoteException - if an error occurs

outputText

public void outputText(String sText,
                       String sColor,
                       String sFont)
                throws RemoteException
Outputs text with a specific color and font to the LED sign.
Specified by:
outputText in interface AlphaLEDSign
Parameters:
sText - a String value
sColor - a String value
sFont - a String value
Throws:
RemoteException - if an error occurs

outputTextBottom

public void outputTextBottom(String sText)
                      throws RemoteException
SignBottomOut displays a message on the bottom line of the sign. If the message is long, it will scroll
Specified by:
outputTextBottom in interface AlphaLEDSign
Parameters:
stuff - a String value that contains the text to be displayed on the bottom line
Throws:
RemoteException - if an error occurs

outputTextBottom

public void outputTextBottom(String sText,
                             String sColor)
                      throws RemoteException
Outputs text with a specific color to the bottom row of the LED
Specified by:
outputTextBottom in interface AlphaLEDSign
Parameters:
sText - a String value
sColor - a String value
Throws:
RemoteException - if an error occurs

outputTextTop

public void outputTextTop(String sText)
                   throws RemoteException
Outputs text to the top line of the LED sign.
Specified by:
outputTextTop in interface AlphaLEDSign
Parameters:
sText - a String value
Throws:
RemoteException - if an error occurs

outputTextTop

public void outputTextTop(String sText,
                          String sColor)
                   throws RemoteException
Outputs text with a specified color to the top row of the LED
Specified by:
outputTextTop in interface AlphaLEDSign
Parameters:
sText - a String value
sColor - a String value
Throws:
RemoteException - if an error occurs

outputTextBoth

public void outputTextBoth(String topText,
                           String botText)
                    throws RemoteException
Send output to both lines at once. No color is provided here, so colors should be set separately.
Specified by:
outputTextBoth in interface AlphaLEDSign
Parameters:
topText - a String value
botText - a String value
Throws:
RemoteException - if an error occurs

sendLinesToSign

protected void sendLinesToSign()
Internal procedure to send current line data out to sign.

get

public String get()
           throws RemoteException
Gets the text on the LED.
Specified by:
get in interface AlphaLEDSign
Returns:
a String value
Throws:
RemoteException - if an error occurs

getTop

public String getTop()
              throws RemoteException
Gets the text on the top line of the LED.
Specified by:
getTop in interface AlphaLEDSign
Returns:
a String value
Throws:
RemoteException - if an error occurs

getBottom

public String getBottom()
                 throws RemoteException
Gets the text on the bottom line of the LED.
Specified by:
getBottom in interface AlphaLEDSign
Returns:
a String value
Throws:
RemoteException - if an error occurs

clear

public void clear()
           throws RemoteException
Outputs a " " space character, essentially clearing the display.
Specified by:
clear in interface AlphaLEDSign
Throws:
RemoteException - if an error occurs

setColor

public void setColor(String sColor)
              throws RemoteException
Sets the color of future text on the display. The valid colors are auto, red, green, amber, dimred, dimgreen, brown, orange, yellow, rainbow1, rainbow2, or mix. If an invalid color is given, the color will be set to auto
Specified by:
setColor in interface AlphaLEDSign
Parameters:
sColor - a String value
Throws:
RemoteException - if an error occurs

setColor

public void setColor(int iColor)
              throws RemoteException
Sets the color of future text on the display. The valid colors are AlphaLEDColors.AUTO AlphaLEDColors.RED AlphaLEDColors.GREEN AlphaLEDColors.AMBER AlphaLEDColors.DIMRED AlphaLEDColors.DIMGREEN AlphaLEDColors.BROWN AlphaLEDColors.ORANGE AlphaLEDColors.YELLOW AlphaLEDColors.RAINBOW1 AlphaLEDColors.RAINBOW2 AlphaLEDColors.MIX If an invalid color is given, the color will be set to AlphaLEDColors.AUTO
Specified by:
setColor in interface AlphaLEDSign
Parameters:
iColor - an int value
Throws:
RemoteException - if an error occurs

setColorTop

public void setColorTop(String sColor)
                 throws RemoteException
Sets the color of the top row. The bottom row is unaffected.
Specified by:
setColorTop in interface AlphaLEDSign
Parameters:
sColor - a String value
Throws:
RemoteException - if an error occurs

setColorBottom

public void setColorBottom(String sColor)
                    throws RemoteException
Sets the color of the bottom row. The top row is unaffected.
Specified by:
setColorBottom in interface AlphaLEDSign
Parameters:
sColor - a String value
Throws:
RemoteException - if an error occurs

setFont

public void setFont(String sFont)
             throws RemoteException
Sets the font of future text. The font can be: small medium mediumbold large huge hugebold
Specified by:
setFont in interface AlphaLEDSign
Parameters:
sFont - a String value
Throws:
RemoteException - if an error occurs

setFont

public void setFont(int iFont)
             throws RemoteException
Sets the font of future text. The font can be: AlphaLEDSign.SMALL AlphaLEDSign.MEDIUM AlphaLEDSign.MEDIUMBOLD AlphaLEDSign.LARGE AlphaLEDSign.HUGE AlphaLEDSign.HUGEBOLD
Specified by:
setFont in interface AlphaLEDSign
Parameters:
iFont - an int value
Throws:
RemoteException - if an error occurs

testOutputText

public boolean testOutputText()
                       throws RemoteException
Tests if we are able to output text to the sign
Specified by:
testOutputText in interface AlphaLEDSign
Returns:
a boolean value
Throws:
RemoteException - if an error occurs

signTest

public boolean signTest()
                 throws RemoteException
SignTest asks the sign what is in Text file A. If the sign is connected it will respond and the method will return true. If the sign does not respond with anything, it will return false.
Specified by:
signTest in interface AlphaLEDSign
Returns:
a boolean value - True = sign responded, False = sign did not respond
Throws:
RemoteException - if an error occurs