Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ka2ddo.yaac.io
Class SendableMessageWrapper

    java.lang.Object
      org.ka2ddo.yaac.io.SendableMessageWrapper

All Implemented Interfaces:
  java.io.Serializable, AX25FrameSource

Direct Known Subclasses:
  ObjectReportSender

    public class SendableMessageWrapper

extends java.lang.Object
implements AX25FrameSource, java.io.Serializable

This class wraps a SendableMessage in a AX25Frame suitable for transmission.

See Also:
  Serialized Form

Constructor Summary
`SendableMessageWrapper(SendableMessage msg)` Wrap a SendableMessage for one transmission cycle with the default proportional pathing path set.
`SendableMessageWrapper(SendableMessage msg, int maxRetries)` Wrap a SendableMessage for the specified number of transmission cycles with the default proportional pathing path set.
`SendableMessageWrapper(SendableMessage msg, java.lang.String[] relays)` Wrap a SendableMessage for one transmission cycle with the specified proportional pathing path set.
`SendableMessageWrapper(SendableMessage msg, java.lang.String[] relays, int maxRetries)` Wrap a SendableMessage for the specified number of transmission cycles with the specified proportional pathing path set.

Method Summary
`static AX25Frame` | `buildAX25FrameForMessage(java.lang.String[] relays, SendableMessage msg, int numTransmissions, byte protocolId, java.lang.String senderCallsign)` Convert a SendableMessage object into a transmittable AX.25 frame, ready to send via KISS protocol to a TNC/radio.
`void` | `cancelPermanently(boolean isGuiDispatchThread)` Delete this SendableMessageWrapper from the transmission queue.
`void` | `cancelTransmission(boolean isGuiDispatchThread)` Stop trying to transmit this message, but still keep track of it in the model.
`protected void` | `cleanup()` Do any cleanup work involved in removing this wrapped message from the transmission queue.
`void` | `computeRandomizedTransmitTime()` Set the first time for this SendableMessage to transmit, so all the ones being started at YAAC startup time don't pile out at one time.
`static SendableMessageWrapper` | `findWrapperOf(SendableMessage sm)` Find any wrapper outstanding for the specified SendableMessage.
`Connector` | `getConnector()` Get the port to which this message should be sent.
`java.lang.String[]` | `getDigipeatPaths()` Get the proportional pathing ordered set of digipeat paths.
`int` | `getFastSendRate()` Get the fast retransmission rate for this message.
`AX25Frame[]` | `getFrames(boolean incrementXmtCount, byte protocolId, java.lang.String senderCallsign)` Get one or more AX25Frames of the data to transmit.
`int` | `getId()` Get the internal sequence ID assigned to this wrapper
`long` | `getLastTransmitTime()`
`int` | `getMaxTransmits()` Get the maximum number of transmissions allowed for this message.
`SendableMessage` | `getMsg()` Get the SendableMessage wrapped in this object
`SendableMessageWrapper` | `getNextMessage()` Get the next message in a chain of linked outgoing messages.
`int` | `getNumTransmissions()` Get the number of times this message has been transmitted.
`int` | `getNumTransmitsBeforeDecay()` Get the number of times the message will be transmitted before the transmission rate is slowed.
`static java.util.ArrayList<SendableMessageWrapper>` | `getObjectsInGroup(java.lang.String groupName)` Search the list of outgoing messages for local Objects tagged with the specified QRU group.
`static java.util.Vector<SendableMessageWrapper>` | `getOutstandingMessages()` Get a reference to the vector of outstanding locally originated messages.
`static java.util.HashMap<java.lang.String,int[]>` | `getQruGroupCounts()` Get a map of all the QRU groups known to have locally originated objects on this station, and return the count of objects per group.
`int` | `getRemainingTransmits()` Get the number of transmissions remaining until the message has been sent.
`int` | `getSlowSendRate()` Get the slow retransmission rate for this message.
`boolean` | `isActive()` Report whether this SendableMessageWrapper is still queued for upcoming transmissions.
`boolean` | `isRejected()` Report whether this message was rejected by its recipient.
`void` | `queueForTransmission()` Put this SendableMessageWrapper on the list of messages to be transmitted and start transmitting it according to its transmit parameters.
`static void` | `removeObsoleteMessage(Message msg, boolean isGuiDispatchThread)` Find and cancel any queued messages matching the passed message.
`static void` | `removeObsoleteMessage(SendableMessageWrapper smw, boolean isGuiDispatchThread)` Find and cancel any queued messages matching the passed message.
`void` | `resetTransmitCount(boolean isGuiDispatchThread)` Reset the retransmission counters as if this was a brand-new message using the initial fast transmission rate.
`void` | `setFastSendRate(int fastSendRate)` Set the fast retransmission rate for this message.
`void` | `setMaxTransmits(int maxTransmits)` Get the maximum number of transmissions allowed for this message.
`void` | `setNextMessage(SendableMessageWrapper nextMessage)` Set the message after this message in a chain of sequenced messages.
`void` | `setRejected(boolean rejected)` Indicate that this message has been rejected.
`static void` | `setSendableMessageListener(SendableMessageListener l)`
`void` | `setSlowSendRate(int slowSendRate)` Set the slow retransmission rate for this message.
`java.lang.String` | `toString()` Returns a string representation of the object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### SendableMessageWrapper

    public SendableMessageWrapper(SendableMessage msg)

  Wrap a SendableMessage for one transmission cycle with the default proportional pathing path set.

  Parameters:
    `msg` - SendableMessage to transmit

### SendableMessageWrapper

    public SendableMessageWrapper(SendableMessage msg,
                                  java.lang.String[] relays)

  Wrap a SendableMessage for one transmission cycle with the specified proportional pathing path set.

  Parameters:
    `msg` - SendableMessage to transmit
    `relays` - ordered array of digipeat paths for proportional pathing (1-element array to not use proportional pathing)

### SendableMessageWrapper

    public SendableMessageWrapper(SendableMessage msg,
                                  int maxRetries)

  Wrap a SendableMessage for the specified number of transmission cycles with the default proportional pathing path set.

  Parameters:
    `msg` - SendableMessage to transmit
    `maxRetries` - number of times (times 2^N length of proportional path set) the message should be transmitted

### SendableMessageWrapper

    public SendableMessageWrapper(SendableMessage msg,
                                  java.lang.String[] relays,
                                  int maxRetries)

  Wrap a SendableMessage for the specified number of transmission cycles with the specified proportional pathing path set.

  Parameters:
    `msg` - SendableMessage to transmit
    `relays` - ordered array of digipeat paths for proportional pathing (1-element array to not use proportional pathing)
    `maxRetries` - number of times (times 2^N length of proportional path set) the message should be transmitted

Method Detail

### setSendableMessageListener

    public static void setSendableMessageListener(SendableMessageListener l)

### getMsg

    public SendableMessage getMsg()

  Get the SendableMessage wrapped in this object

  Returns:
    wrapped SendableMessage

### getFrames

    public AX25Frame[] getFrames(boolean incrementXmtCount,
                                 byte protocolId,
                                 java.lang.String senderCallsign)

  Get one or more AX25Frames of the data to transmit.

  Specified by:
    `getFrames` in interface `AX25FrameSource`
  Parameters:
    `incrementXmtCount` - indicate whether the transmit counter (used to cycle through proportional pathing) should be incremented
    `protocolId` - indicate the protocol to generate this frame for (not relevant for digipeated frames); zero to indicate current protocol
    `senderCallsign` - String of local callsign sending this message (may be ignored if digipeating a message from another station)
  Returns:
    array of AX25Frame objects to transmit, or null indicating nothing to transmit in the specified protocol

### buildAX25FrameForMessage

    public static AX25Frame buildAX25FrameForMessage(java.lang.String[] relays,
                                                     SendableMessage msg,
                                                     int numTransmissions,
                                                     byte protocolId,
                                                     java.lang.String senderCallsign)

  Convert a SendableMessage object into a transmittable AX.25 frame, ready to send via KISS protocol to a TNC/radio.

  Parameters:
    `relays` - digipeater to specify in the AX.25 frame
    `msg` - the SendableMessage to encapsulate in an AX.25 frame
    `numTransmissions` - number of times the message has been transmitted.
    `protocolId` - AX.25 protocol ID to generate the message in; currently, only NOLVL3 (APRS) and OPENTRAC are supported.
    `senderCallsign` - String of local callsign sending this message (may be ignored if digipeating a message from another station)
  Returns:
    an AX25Frame object ready to transmit, or null if the conversion and encapsulation could not be done.

### getNumTransmitsBeforeDecay

    public int getNumTransmitsBeforeDecay()

  Get the number of times the message will be transmitted before the transmission rate is slowed. This is a function of the number of proportional paths defined, as the transmit interval will not be slowed until the entire proportional path cycle has been gone through.

  Specified by:
    `getNumTransmitsBeforeDecay` in interface `AX25FrameSource`
  Returns:
    number of transmits for one cycle of the proportional paths of this message

### getLastTransmitTime

    public long getLastTransmitTime()

### getNumTransmissions

    public int getNumTransmissions()

  Get the number of times this message has been transmitted.

  Returns:
    transmit count

### resetTransmitCount

    public void resetTransmitCount(boolean isGuiDispatchThread)

  Reset the retransmission counters as if this was a brand-new message using the initial fast transmission rate.

  Parameters:
    `isGuiDispatchThread` - boolean true if caller is the GUI dispatch thread

### getFastSendRate

    public int getFastSendRate()

  Get the fast retransmission rate for this message.

  Returns:
    fast retransmit rate in seconds

### setFastSendRate

    public void setFastSendRate(int fastSendRate)

  Set the fast retransmission rate for this message.

  Parameters:
    `fastSendRate` - fast retransmit rate in seconds

### getSlowSendRate

    public int getSlowSendRate()

  Get the slow retransmission rate for this message.

  Returns:
    slow retransmission rate in seconds

### setSlowSendRate

    public void setSlowSendRate(int slowSendRate)

  Set the slow retransmission rate for this message.

  Parameters:
    `slowSendRate` - slow retransmission rate in seconds

### getNextMessage

    public SendableMessageWrapper getNextMessage()

  Get the next message in a chain of linked outgoing messages.

  Returns:
    SendableMessageWrapper of next message, or null if this message is alone or the end of a chain

### setNextMessage

    public void setNextMessage(SendableMessageWrapper nextMessage)

  Set the message after this message in a chain of sequenced messages.

  Parameters:
    `nextMessage` - SendableMessageWrapper around the next message after this one, or null for no next message

### getConnector

    public Connector getConnector()

  Get the port to which this message should be sent. Always returns null (i.e., send to all available ports).

  Specified by:
    `getConnector` in interface `AX25FrameSource`
  Returns:
    null for all PortConnectors
  See Also:
    `Connector.CAP_XMT_PACKET_DATA`

### getOutstandingMessages

    public static java.util.Vector<SendableMessageWrapper> getOutstandingMessages()

  Get a reference to the vector of outstanding locally originated messages.

  Returns:
    Vector of SendableMessageWrappers that are still outstanding

### findWrapperOf

    public static SendableMessageWrapper findWrapperOf(SendableMessage sm)

  Find any wrapper outstanding for the specified SendableMessage.

  Parameters:
    `sm` - SendableMessage to look for in queue
  Returns:
    SendableMessageWrapper containing the specified SendableMessage, or null if not found

### getQruGroupCounts

    public static java.util.HashMap<java.lang.String,int[]> getQruGroupCounts()

  Get a map of all the QRU groups known to have locally originated objects on this station, and return the count of objects per group.

  Returns:
    HashMap of group names to counts

### getObjectsInGroup

    public static java.util.ArrayList<SendableMessageWrapper> getObjectsInGroup(java.lang.String groupName)

  Search the list of outgoing messages for local Objects tagged with the specified QRU group.

  Parameters:
    `groupName` - QRU category name
  Returns:
    ArrayList of SendableMessageWrappers containing ObjectReports in the specified QRU group

### isRejected

    public boolean isRejected()

  Report whether this message was rejected by its recipient.

  Returns:
    boolean true if this message received a "rej" response.

### setRejected

    public void setRejected(boolean rejected)

  Indicate that this message has been rejected.

  Parameters:
    `rejected` - the new setting of the rejected boolean flag

### queueForTransmission

    public void queueForTransmission()

  Put this SendableMessageWrapper on the list of messages to be transmitted and start transmitting it according to its transmit parameters.

### cancelTransmission

    public void cancelTransmission(boolean isGuiDispatchThread)

  Stop trying to transmit this message, but still keep track of it in the model.

  Parameters:
    `isGuiDispatchThread` - boolean true if caller is the GUI dispatch thread

### cleanup

    protected void cleanup()

  Do any cleanup work involved in removing this wrapped message from the transmission queue.

### cancelPermanently

    public void cancelPermanently(boolean isGuiDispatchThread)

  Delete this SendableMessageWrapper from the transmission queue. Note this doesn't call cancelTransmission() because that would send an update event to any listeners, and this message might be deleted entirely before the event was processed.

  Parameters:
    `isGuiDispatchThread` - boolean true if caller is the GUI dispatch thread

### removeObsoleteMessage

    public static void removeObsoleteMessage(Message msg,
                                             boolean isGuiDispatchThread)

  Find and cancel any queued messages matching the passed message.

  Parameters:
    `msg` - Message to compare against queued messages
    `isGuiDispatchThread` - boolean true if caller is the GUI dispatch thread

### removeObsoleteMessage

    public static void removeObsoleteMessage(SendableMessageWrapper smw,
                                             boolean isGuiDispatchThread)

  Find and cancel any queued messages matching the passed message.

  Parameters:
    `smw` - SendableMessageWrapper to compare against queued messages
    `isGuiDispatchThread` - boolean true if caller is the GUI dispatch thread

### computeRandomizedTransmitTime

    public void computeRandomizedTransmitTime()

  Set the first time for this SendableMessage to transmit, so all the ones being started at YAAC startup time don't pile out at one time.

### isActive

    public boolean isActive()

  Report whether this SendableMessageWrapper is still queued for upcoming transmissions.

  Returns:
    boolean true if message is still waiting for (re)transmission

### getRemainingTransmits

    public int getRemainingTransmits()

  Get the number of transmissions remaining until the message has been sent.

  Returns:
    int number of remaining transmissions

### getMaxTransmits

    public int getMaxTransmits()

  Get the maximum number of transmissions allowed for this message.

  Returns:
    int maximum number of transmissions

### setMaxTransmits

    public void setMaxTransmits(int maxTransmits)

  Get the maximum number of transmissions allowed for this message.

  Parameters:
    `maxTransmits` - maximum number of transmissions

### getDigipeatPaths

    public java.lang.String[] getDigipeatPaths()

  Get the proportional pathing ordered set of digipeat paths.

  Returns:
    ordered String array of digipeat paths

### toString

    public java.lang.String toString()

  Returns a string representation of the object. In general, the `toString` method returns a string that "textually represents" this object.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a string representation of the object.

### getId

    public int getId()

  Get the internal sequence ID assigned to this wrapper

  Returns:
    ID number

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD