|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcat.app.ContextApp
This class is a template for building applications using CAT. It implements a few useful features (which can be overwritten) and defines what needs to be implemented.
Field Summary | |
private java.util.Vector |
eventsQueue
Keep a queue of sensor events, for processing in a thread. |
private ContextManager |
manager
The ContextManager for this wearable application. |
Constructor Summary | |
ContextApp(java.lang.String id,
int port)
This constructor will start the application. |
Method Summary | |
void |
appSetUp()
This method sets up the basic information for the application. |
ContextManager |
getContextManager()
Returns the Context Manager for the app to use. |
java.util.Vector |
getSensorQueue()
Returns a list of non-processed sensor events. |
void |
handleSigEvent(SigEvent ce)
This method gets SIG events, it can process most of the information itself, and then it merely asks the extending application if it would like to join a SIG, or to inform it of an agent that joined. |
abstract void |
joinedSig(java.lang.String name,
Agent agent)
This method gets called when an agent joined a SIG that you part of. |
abstract boolean |
joinSig(java.lang.String name,
java.util.Vector agents,
java.util.Vector wanted_sensors,
java.util.Vector sharing_sensors)
This method gets called when app receives a SIG join request. |
static void |
p2pSend(Agent agent,
java.lang.Object obj)
This method can be used to send p2p communication. |
abstract void |
run()
This method is for handling sensor events. |
void |
update(java.lang.Object event)
Get sensor events in here. |
void |
willJoinSig(java.lang.String s,
java.util.Vector a,
java.util.Vector wanted,
java.util.Vector sharing)
This method tells the ContextApp, that the app wants to join the given SIG. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.util.Vector eventsQueue
private ContextManager manager
Constructor Detail |
public ContextApp(java.lang.String id, int port)
id
- The unique of this agent/device.port
- The port number that CAT will use to communicate.Method Detail |
public void appSetUp()
public static void p2pSend(Agent agent, java.lang.Object obj)
agent
- The agent to send a message/object to.obj
- The object to send to the agent.public abstract boolean joinSig(java.lang.String name, java.util.Vector agents, java.util.Vector wanted_sensors, java.util.Vector sharing_sensors)
public abstract void joinedSig(java.lang.String name, Agent agent)
name
- The name of the SIG that agent joined.agent
- The agent that joined the SIG that you are part of.public void handleSigEvent(SigEvent ce)
handleSigEvent
in interface SigListener
ce
- The incoming SIG eventpublic void willJoinSig(java.lang.String s, java.util.Vector a, java.util.Vector wanted, java.util.Vector sharing)
s
- SIG name.a
- Agents in SIG.wanted
- Sensors wanted for SIG.sharing
- Sensors giving to SIG.public abstract void run()
run
in interface java.lang.Runnable
public void update(java.lang.Object event)
update
in interface SensorListener
event
- The sensor data.public ContextManager getContextManager()
public java.util.Vector getSensorQueue()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |