com.sentilla.platform.cmote
Class Sender

java.lang.Object
  extended by com.sentilla.platform.cmote.DispatcherAction
      extended by com.sentilla.platform.cmote.Sender
All Implemented Interfaces:
Sender, Action
Direct Known Subclasses:
ByteSender, ClientRadioProtocol.Sender, MimeoDisseminationProtocol.MimeoSender

public abstract class Sender
extends DispatcherAction
implements Sender

Provides interfaces for sending objects with the radio and the UART.

This class is the primary method for sending messages and objects. It provides a unified interface for sending messages with any protocol, provided that protocol exists on the runtime platform. Blocking and non-blocking versions of the send command are provided. The protocol metadata is also accessible by directly modifying the class values.

See Also:
DispatcherAction, Dispatcher, SenderDriver, Protocol

Field Summary
 Addressable address
          This field is NOT automatically nulled when this object is done sending.
 Object data
          Sender.setDone automatically nulls out this field when this object is done sending.
protected  Sender nextData
          Dispatcher.sendServiceQueue automatically nulls out this field when this object is done sending.
protected  Protocol protocol
          This field is NOT automatically nulled when this object is done sending.
 
Fields inherited from class com.sentilla.platform.cmote.DispatcherAction
actionState
 
Fields inherited from interface com.sentilla.system.Action
DONE, ERROR, IDLE, PENDING
 
Constructor Summary
Sender()
          Creates a Sender object.
 
Method Summary
 void send(Object obj)
          Sends the input object.
abstract  void setAddress(Addressable addr)
          Sets the destination address.
 void setDone(byte a)
          Sets actionState to input byte value and notifies all waiting threads.
 Sender setSend(Object obj)
          Sets the object to send.
protected  boolean subsubmit()
          Queues this for transmission by the Dispatcher.
 
Methods inherited from class com.sentilla.platform.cmote.DispatcherAction
block, block, cancel, getActionState, isDone, subcancel, submit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sentilla.system.Action
block, block, cancel, getActionState, isDone, submit
 

Field Detail

nextData

protected Sender nextData
Dispatcher.sendServiceQueue automatically nulls out this field when this object is done sending.


protocol

protected Protocol protocol
This field is NOT automatically nulled when this object is done sending.


address

public Addressable address
This field is NOT automatically nulled when this object is done sending.


data

public Object data
Sender.setDone automatically nulls out this field when this object is done sending.

Constructor Detail

Sender

public Sender()
Creates a Sender object.

See Also:
DispatcherAction
Method Detail

send

public void send(Object obj)
Sends the input object. Blocking version of send. Blocks program execution until the send operation has completed.

Specified by:
send in interface Sender
Parameters:
obj - object to send

setSend

public Sender setSend(Object obj)
Sets the object to send. Advanced form of send. The application sets the object to send, then performs a submit() and block(timeout) on the sender object.

Specified by:
setSend in interface Sender
Parameters:
obj - object to send
Returns:
Sender object

setAddress

public abstract void setAddress(Addressable addr)
Sets the destination address. Any valid object implementing the Addressable interface can be set as the destination address. The protocols extending this class should throw an error if the address object is not supported.

Specified by:
setAddress in interface Sender
Parameters:
addr - object implementing Addressable interface to be used as address
Throws:
UnsupportedAddressException
See Also:
Addressable

setDone

public void setDone(byte a)
Sets actionState to input byte value and notifies all waiting threads. Protocols call setDone( byte a ) to specify that the send is done transmitting. The input byte a should be Action.DONE or Action.ERROR. All other values are invalid.


subsubmit

protected boolean subsubmit()
Queues this for transmission by the Dispatcher. Returns true if send request is accepted by the Dispatcher; should never be called by a user application.

Specified by:
subsubmit in class DispatcherAction
Returns:
true if the method successfully executes
See Also:
DispatcherAction


Copyright © 2007 Sentilla Corporation. All Rights Reserved.