|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
lime.StationaryAgent
lime.motes.MoteAgent
This Agent is responsible to establish the bridge between lime and the motes subsystem, it reacts to configuration tuple in the BASENAME-CONFIG tuple space, asks the motes subsystem to read environmental data and out them in the BASENAME tuple space. Please refer to the main documentation for further information on the role of the MoteAccess.
StationaryAgent
,
Location
,
Reaction
,
ReactionListener
,
LimeTupleSpace
,
IMoteListener
,
Serialized FormNested Class Summary | |
private class |
MoteAgent.MoteStopOperation
This class is used to react to a tuple that indicates the command to stop a running operation on the motes (typically a reaction). |
private class |
MoteAgent.ReactionRequestListener
This class is used to react to tuples in the config tuple space that request for a reaction. |
Field Summary | |
private java.util.HashMap |
agentsRequests
This hashmap is used to associate each agent that perform at least a request on the MoteAgent to its requests (so the agent is associated to a vector of requests). |
private java.util.LinkedList |
dataQueue
Linked lists used for implementing queues, needed since only the MoteAgent can access the tuple space directly. |
private IMoteLimeTupleDecorator |
decorator
Decorator for the MoteLimeTupleDecorator |
private static java.lang.String |
DEFAULT_SPACES_BASE_NAME
Default name of the tuple space is MOTES. |
private LimeTupleSpace |
ltc
LimeTuple space used for configuration. |
private LimeTupleSpace |
lts
LimeTupleSpace that contains the data, i.e. |
private IMoteAccess |
moteaccess
The IMoteAccess that will be used in accessing the motes network. |
private java.util.LinkedList |
reactionQueue
|
private java.lang.String |
spacesBaseName
Name of the tuple space, by default set to DEFAULT_SPACES_BASE_NAME. |
private LimeSystemTupleSpace |
sys
Used for catching the deregistration of an agent. |
private java.util.HashMap |
timeouts
This HashMap is used to associate each tuple that is inserted into the tuplespace to its duration. |
private static int |
TIMER_STEP_SECS
Establishes the rate at which expired tuples are searched and removed if found. |
Fields inherited from class lime.StationaryAgent |
|
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
MoteAgent()
Public constructor that calls the StationaryAgent constructor with name "MoteAgent". |
Method Summary | |
void |
addData(MoteResult mr)
This is the call back method used by the underlying mote subsystem to return data. |
void |
addReactionData(MoteResult mr)
Method implementing the IMoteListener interface; it is called by the moteaccess when reaction data is produced. |
private void |
buildAndOutAggDataTuples(MoteResult mr)
|
private void |
buildAndOutAggReactionTuples(MoteResult mr)
|
private void |
buildAndOutDataTuples(MoteResult mr)
This method accepts as parameter the mote result from a reading of the sensor network and builds a tuple from it, outing the constructed tuple into the tuple space. |
private void |
buildAndOutReactionTuples(MoteResult mr)
This method plays the same role as the buildAndOutDataTuples for reaction data. |
private boolean |
isAggregType(lights.interfaces.ITuple tuple)
Verifies if the tuple passed as a parameter is an aggregation tuple or not. |
private void |
logAgentRequest(AgentID aid,
RequestID rid)
This method is used to log the couple RequestID AgentID in order to be able to remove all the operation by a given AgentID. |
private boolean |
lookForTuples(LimeTuple lt)
This private method is used to check wether the tuplespace contains at least a tuple that matches the tuple passed as parameter. |
void |
reactsTo(ReactionEvent e)
This method implements the ReactionListener ractsTo method, checking the type of the configuration tuple. |
private void |
removeStuffBy(AgentID aid)
This method is used to remove all the running operations requested by an agent that is no more present. |
void |
run()
The run method instantiates the LimeTupleSpaces, and registers for reactions on needed tuples, like requests for reads or reactions. |
Methods inherited from class lime.StationaryAgent |
getMgr |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final java.lang.String DEFAULT_SPACES_BASE_NAME
private static final int TIMER_STEP_SECS
private IMoteAccess moteaccess
private LimeTupleSpace lts
private LimeTupleSpace ltc
private LimeSystemTupleSpace sys
private java.lang.String spacesBaseName
private java.util.HashMap timeouts
private java.util.HashMap agentsRequests
private java.util.LinkedList dataQueue
private java.util.LinkedList reactionQueue
private IMoteLimeTupleDecorator decorator
Constructor Detail |
public MoteAgent()
Method Detail |
public void run()
run
in interface java.lang.Runnable
public void reactsTo(ReactionEvent e)
MoteAgent.ReactionRequestListener
.
reactsTo
in interface ReactionListener
e
- the event that triggered the reaction.private boolean isAggregType(lights.interfaces.ITuple tuple)
tuple
-
private boolean lookForTuples(LimeTuple lt)
lt
- the lime tuple which template is searched in the tuplespace.
true
if there is at least one matching tuple, false
otherwise.private void removeStuffBy(AgentID aid)
aid
- the id of the agent that deregistered.private void logAgentRequest(AgentID aid, RequestID rid)
aid
- the agent id of the agent that performed the request.public void addData(MoteResult mr)
addData
in interface IMoteListener
mr
- private void buildAndOutDataTuples(MoteResult mr)
mr
- The mote result that is produced by the sensor network.public void addReactionData(MoteResult mr)
addReactionData
in interface IMoteListener
mr
- the MoteResult produced since the reaction fired.private void buildAndOutReactionTuples(MoteResult mr)
mr
- the MoteResult that carryes the information in response of a
request.private void buildAndOutAggDataTuples(MoteResult mr)
private void buildAndOutAggReactionTuples(MoteResult mr)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |