|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sentilla.platform.tmote.DispatcherAction
com.sentilla.platform.tmote.Receiver
public class Receiver
Provides methods to receive messages from the mote communications interfaces.
Primary class for receiving messages and objects. Blocking and non-blocking
methods for receiving a message provided. Message metadata can be obtained
by calling the getNextReceiver
method and accessing the Receiver
metadata field directly.
DispatcherAction
,
Dispatcher
,
ReceiverDriver
,
Protocol
Field Summary | |
---|---|
Object |
data
|
Addressable |
destAddress
|
protected Class |
msgClass
|
protected Receiver |
nextReceiver
|
Addressable |
sourceAddress
|
Fields inherited from class com.sentilla.platform.tmote.DispatcherAction |
---|
actionState |
Fields inherited from interface com.sentilla.system.Action |
---|
DONE, ERROR, IDLE, PENDING |
Constructor Summary | |
---|---|
|
Receiver()
Provides default constructor for protocols. |
protected |
Receiver(Class msgClass)
Provides protected constructor instantiating a Receiver. |
Method Summary | ||
---|---|---|
void |
addMetadata(Receiver rcvr)
Adds a Receiver to the list of DispatchReceiver objects. |
|
|
getData()
Returns the received object. |
|
Addressable |
getDestAddress()
Returns the destination address of the last received message. |
|
|
getMetadata(Class<R> c)
Returns the platform specific receiver object that contains metadata about the received message. |
|
Addressable |
getSourceAddress()
Returns the source address of the last received message. |
|
|
receive()
Receives an object. |
|
Receiver |
setReceive()
Sets the Receiver object to receive. |
|
void |
signalReceive(Receiver rcvr)
Signals that an Object has been received by this receiver. |
|
protected boolean |
subcancel()
Cancels the receive request and removes receiver object from Dispatcher receiver queue. |
|
protected boolean |
subsubmit()
Queues a Receiver object receive request. |
Methods inherited from class com.sentilla.platform.tmote.DispatcherAction |
---|
block, block, cancel, getActionState, isDone, submit |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.sentilla.system.Action |
---|
block, block, cancel, getActionState, isDone, submit |
Field Detail |
---|
protected Receiver nextReceiver
protected Class msgClass
public Addressable sourceAddress
public Addressable destAddress
public Object data
Constructor Detail |
---|
public Receiver()
protected Receiver(Class msgClass)
msgClass
- Class of expected messageMethod Detail |
---|
public <M> M receive()
receive
in interface Receiver
public Receiver setReceive()
setReceive
in interface Receiver
DispatcherAction
,
Action
public <M> M getData()
getData
in interface Receiver
public Addressable getDestAddress()
getDestAddress
in interface Receiver
Addressable
public Addressable getSourceAddress()
getSourceAddress
in interface Receiver
Addressable
public <R extends Receiver> R getMetadata(Class<R> c)
getMetadata
in interface Receiver
public void addMetadata(Receiver rcvr)
rcvr
- Receiver object to be addedpublic void signalReceive(Receiver rcvr)
rcvr
- Receiver object that was receivedprotected boolean subcancel()
subcancel
in class DispatcherAction
protected boolean subsubmit()
Receiver
object receive request.
Returns true if the receive request was queued by the Dispatcher.
Should only be called by the Receiver
base class.
subsubmit
in class DispatcherAction
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |