public class SendableMessageWrapper extends java.lang.Object implements AX25FrameSource, java.io.Serializable, SetBeaconRatesIfc
Modifier and Type | Class and Description |
---|---|
static class |
SendableMessageWrapper.SendableMessageState
Enumeration identifying the states a
SendableMessageWrapper can be in. |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BULLETIN_SEQUENCE_CHARS
The characters (in order) for sequencing a multi-line bulletin.
|
NO_FRAMES
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
void |
addSendableMessageUpdateListener(SendableMessageUpdateListener l)
Register a listener to be informed when this message changes state.
|
static AX25Frame |
buildAX25FrameForMessage(java.lang.String[] relays,
SendableMessage msg,
int numTransmissions,
ProtocolFamily 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 |
findDuplicateWrapperOf(SendableMessage sm)
Find any wrapper outstanding for an equivalent SendableMessage.
|
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.
|
int |
getDecayRatio()
Get the scaling factor by which the message repeat interval is enlarged
(until the default slow send rate is reached).
|
java.lang.String[] |
getDigipeatPaths()
Get the proportional pathing ordered set of digipeat paths.
|
AX25Frame[] |
getFrames(boolean incrementXmtCount,
ProtocolFamily 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
|
int |
getInitialSendRate()
Get the fast retransmission rate for this message.
|
long |
getLastTransmitTime()
Get the last time this message was transmitted.
|
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.
|
SendableMessageWrapper.SendableMessageState |
getSendableState()
Return the
SendableMessageWrapper.SendableMessageState of this SendableMessage. |
int |
getSlowSendRate()
Get the slow retransmission rate for this message.
|
boolean |
isAcked()
Report whether this message was acknowledged by its recipient.
|
boolean |
isActive()
Report whether this SendableMessageWrapper is still queued for upcoming transmissions.
|
boolean |
isRejected()
Report whether this message was rejected by its recipient.
|
boolean |
isUseGpsForPosition()
Indicate whether beacon data source can dynamically change its position (latitude/longitude),
such as for a mobile station with a GPS.
|
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 |
removeSendableMessageUpdateListener(SendableMessageUpdateListener l)
Unregister a listener to no longer be informed when this message changes state.
|
void |
requeue()
Reschedule the beacon based on its last transmission time and any changes in
retransmit interval.
|
void |
resetTransmitCount(boolean isGuiDispatchThread)
Reset the retransmission counters as if this was a brand-new message using the initial
fast transmission rate.
|
void |
setAcked(boolean acknowledged)
Indicate that this message has been acknowledged.
|
void |
setConnector(Connector targetConnector)
Set the port to which this message should be sent.
|
void |
setDecayRatio(int decayRatio)
Set the scaling factor by which the message repeat interval is enlarged
(until the default slow send rate is reached).
|
void |
setDigipeatPaths(java.lang.String[] relays)
Set the proportional pathing ordered set of digipeat paths.
|
void |
setInitialSendRate(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)
Set the global handler for changes in the list of SendableMessages.
|
void |
setSendableState(SendableMessageWrapper.SendableMessageState newState)
Update the state of the wrapped
SendableMessage . |
void |
setSlowSendRate(int slowSendRate)
Set the slow retransmission rate for this message.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
public static final java.lang.String BULLETIN_SEQUENCE_CHARS
public SendableMessageWrapper(SendableMessage msg)
msg
- SendableMessage to transmitpublic SendableMessageWrapper(SendableMessage msg, java.lang.String[] relays)
msg
- SendableMessage to transmitrelays
- ordered array of digipeat paths for proportional pathing (1-element array to not use proportional pathing)public SendableMessageWrapper(SendableMessage msg, int maxRetries)
msg
- SendableMessage to transmitmaxRetries
- number of times (times 2^N length of proportional path set) the message should be transmittedpublic SendableMessageWrapper(SendableMessage msg, java.lang.String[] relays, int maxRetries)
msg
- SendableMessage to transmitrelays
- 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 transmittedpublic static void setSendableMessageListener(SendableMessageListener l)
l
- SendableMessageListener to handle list change eventspublic SendableMessage getMsg()
public AX25Frame[] getFrames(boolean incrementXmtCount, ProtocolFamily protocolId, java.lang.String senderCallsign)
getFrames
in interface AX25FrameSource
incrementXmtCount
- indicate whether the transmit counter (used to cycle through
proportional pathing) should be incrementedprotocolId
- indicate the protocol to generate this frame for (not relevant for
digipeated frames)senderCallsign
- String of local callsign sending this message (may be ignored if digipeating
a message from another station)public static AX25Frame buildAX25FrameForMessage(java.lang.String[] relays, SendableMessage msg, int numTransmissions, ProtocolFamily protocolId, java.lang.String senderCallsign)
relays
- digipeater to specify in the AX.25 framemsg
- the SendableMessage to encapsulate in an AX.25 framenumTransmissions
- number of times the message has been transmitted.protocolId
- AX.25 protocol ID to generate the message in; currently,
only APRS and OPENTRAC are supported.senderCallsign
- String of local callsign sending this message (may be ignored if digipeating
a message from another station)public int getNumTransmitsBeforeDecay()
getNumTransmitsBeforeDecay
in interface AX25FrameSource
public long getLastTransmitTime()
public int getNumTransmissions()
public void resetTransmitCount(boolean isGuiDispatchThread)
isGuiDispatchThread
- boolean true if caller is the GUI dispatch threadpublic int getInitialSendRate()
getInitialSendRate
in interface SetBeaconRatesIfc
public void setInitialSendRate(int fastSendRate)
setInitialSendRate
in interface SetBeaconRatesIfc
fastSendRate
- fast retransmit rate in secondspublic void setDecayRatio(int decayRatio)
setDecayRatio
in interface SetBeaconRatesIfc
decayRatio
- int decay ratio (should be 2 or 3)public int getDecayRatio()
getDecayRatio
in interface SetBeaconRatesIfc
public int getSlowSendRate()
getSlowSendRate
in interface SetBeaconRatesIfc
public void setSlowSendRate(int slowSendRate)
setSlowSendRate
in interface SetBeaconRatesIfc
slowSendRate
- slow retransmission rate in secondspublic boolean isUseGpsForPosition()
isUseGpsForPosition
in interface SetBeaconRatesIfc
public SendableMessageWrapper getNextMessage()
public void setNextMessage(SendableMessageWrapper nextMessage)
nextMessage
- SendableMessageWrapper around the next message after this one, or null for no next messagepublic Connector getConnector()
setConnector(Connector)
.getConnector
in interface AX25FrameSource
Connector.CAP_XMT_PACKET_DATA
public void setConnector(Connector targetConnector)
targetConnector
- specific PortConnector to transmit through, or null for all PortConnectorspublic static java.util.Vector<SendableMessageWrapper> getOutstandingMessages()
public static SendableMessageWrapper findWrapperOf(SendableMessage sm)
sm
- SendableMessage to look for in queuepublic static SendableMessageWrapper findDuplicateWrapperOf(SendableMessage sm)
sm
- SendableMessage to look for in queuepublic static java.util.HashMap<java.lang.String,int[]> getQruGroupCounts()
public static java.util.ArrayList<SendableMessageWrapper> getObjectsInGroup(java.lang.String groupName)
groupName
- QRU category namepublic boolean isAcked()
public void setAcked(boolean acknowledged)
acknowledged
- the new setting of the acknowledged boolean flagpublic boolean isRejected()
public void setRejected(boolean rejected)
rejected
- the new setting of the rejected boolean flagpublic void queueForTransmission()
public void cancelTransmission(boolean isGuiDispatchThread)
isGuiDispatchThread
- boolean true if caller is the GUI dispatch threadprotected void cleanup()
public void cancelPermanently(boolean isGuiDispatchThread)
isGuiDispatchThread
- boolean true if caller is the GUI dispatch threadpublic static void removeObsoleteMessage(Message msg, boolean isGuiDispatchThread)
msg
- Message to compare against queued messagesisGuiDispatchThread
- boolean true if caller is the GUI dispatch threadpublic static void removeObsoleteMessage(SendableMessageWrapper smw, boolean isGuiDispatchThread)
smw
- SendableMessageWrapper to compare against queued messagesisGuiDispatchThread
- boolean true if caller is the GUI dispatch threadpublic void requeue()
public void computeRandomizedTransmitTime()
public boolean isActive()
public int getRemainingTransmits()
public int getMaxTransmits()
public void setMaxTransmits(int maxTransmits)
maxTransmits
- maximum number of transmissionspublic java.lang.String[] getDigipeatPaths()
public void setDigipeatPaths(java.lang.String[] relays)
relays
- ordered String array of digipeat pathspublic java.lang.String toString()
toString
method returns a string that
"textually represents" this object.toString
in class java.lang.Object
public int getId()
public SendableMessageWrapper.SendableMessageState getSendableState()
SendableMessageWrapper.SendableMessageState
of this SendableMessage.public void setSendableState(SendableMessageWrapper.SendableMessageState newState)
SendableMessage
.newState
- new SendableMessageState of the messagejava.lang.NullPointerException
- if newState is nullpublic void addSendableMessageUpdateListener(SendableMessageUpdateListener l)
l
- SendableMessageUpdateListener to register on this SendableMessagepublic void removeSendableMessageUpdateListener(SendableMessageUpdateListener l)
l
- SendableMessageUpdateListener to unregister from this SendableMessage