|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sentilla.system.DriverAdapter
com.sentilla.platform.tmote.Dispatcher
public class Dispatcher
Dispatches messages through Protocols to user application receivers.
The Dispatcher is resposible for managing the sending and receiving of messages. It contains two threads: one for sending messages and one for receiving them. Messages are sent in the order they are received. The Dispatcher calls receive on the communications interfaces and dispatches the received objects to their respective protocols.
Protocol
,
DriverAdapter
,
Drivers
,
Sender
,
Receiver
Field Summary | |
---|---|
static int |
MAX_SIZE
|
Fields inherited from class com.sentilla.system.DriverAdapter |
---|
m_nextDriver |
Constructor Summary | |
---|---|
Dispatcher()
Instantiates the Dispatcher and starts the send and receive threads. |
|
Dispatcher(int maxSize)
|
Method Summary | |
---|---|
void |
dispatch(Receiver rcvr)
Dispatches messages to protocols and waiting receivers. |
static Dispatcher |
getDefaultDispatcher()
Returns the default Dispatcher object for this platform. |
String |
getDriverName(int n)
Returns the driver name of this class, "disp". |
boolean |
queueForReceive(Receiver rcvr)
Queues a Receiver object that is ready to receive. |
boolean |
queueForSend(Sender sender)
Queues a Sender object for transmission. |
void |
registerReceiver(Receiver receiver)
Register a new Receiver with the Dispatcher. |
void |
registerSender(Sender sender)
Register a new Sender with the Dispatcher. |
boolean |
removeFromReceiveQueue(Receiver rcvr)
Remove a Receiver object from the receive queue. |
void |
serviceSendQueue()
Examine the sendQueue and send a message if not empty. |
static void |
setDefaultDispatcher(Dispatcher d)
Sets the default Dispatcher for this platform. |
void |
stop()
Stops the running Dispatcher threads. |
Methods inherited from class com.sentilla.system.DriverAdapter |
---|
getNextDriver, setNextDriver |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int MAX_SIZE
Constructor Detail |
---|
public Dispatcher()
public Dispatcher(int maxSize)
Method Detail |
---|
public static void setDefaultDispatcher(Dispatcher d)
d
- a valid Dispatcher objectpublic static Dispatcher getDefaultDispatcher()
public void stop()
public void dispatch(Receiver rcvr)
rcvr
- Receiver object containing the received message.Receiver
public void serviceSendQueue()
public boolean queueForSend(Sender sender)
sender
- Sender object containing the message.
Sender
public boolean queueForReceive(Receiver rcvr)
rcvr
- Receiver object containing the received message.
Receiver
public boolean removeFromReceiveQueue(Receiver rcvr)
public String getDriverName(int n)
getDriverName
in interface Driver
getDriverName
in class DriverAdapter
n
- index of class name
Drivers
,
Driver
public void registerSender(Sender sender) throws ProtocolNotFoundException
sender
- the Sender object to register
ProtocolNotFoundException
public void registerReceiver(Receiver receiver) throws ProtocolNotFoundException
Dispatcher
to allow
receiving of messages.
receiver
- the Receiver object to register
ProtocolNotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |