org.ka2ddo.yaac.io
Class StatusData

java.lang.Object
  extended by org.ka2ddo.yaac.io.StatusData
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, AX25FrameSource, SendableMessage

public class StatusData
extends java.lang.Object
implements AX25FrameSource, java.lang.Cloneable, SendableMessage

This class defines all the data for transmitting an APRS Status message for this station.

See Also:
Serialized Form

Field Summary
 java.lang.String[] digipeaters
           
 boolean enabled
           
 java.lang.String format
           
 boolean prefixMaidenhead
           
 boolean prefixTime
           
 
Constructor Summary
StatusData()
           
 
Method Summary
 void cancelTransmission()
           
 java.lang.Object clone()
          Creates and returns a copy of this object.
 void copyInto(StatusData sd, java.util.prefs.Preferences root)
          Copy the contents of this StatusData object into the specified one, and tell the other one that it was changed if any changes occur.
 AX25Message dup()
          Creates and returns a copy of this Message.
 byte[] getBody(boolean countTransmission, byte protocolId, AX25Frame frame)
          Get an instance of this message, suitable for transmitting.
 Connector getConnector()
          Specify the Connector this message should be transmitted through.
 AX25Frame[] getFrames(boolean incrementXmtCount, byte protocolId, java.lang.String senderCallsign)
          Get one or more AX25Frames of the data to transmit.
 int getNumTransmitsBeforeDecay()
          Get the number of cycles for a complete iteration over the proportional pathing digipeat path set.
 boolean isEnabled()
          Test if message should still be transmitted.
 void queueForTransmission()
           
 void queueNow()
           
static StatusData readFromPreferences(java.util.prefs.Preferences root, java.lang.String beaconName)
           
 void resetTransmitCount()
           
 void writeToPreferences(java.util.prefs.Preferences root)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

format

public java.lang.String format

enabled

public boolean enabled

prefixMaidenhead

public boolean prefixMaidenhead

prefixTime

public boolean prefixTime

digipeaters

public java.lang.String[] digipeaters
Constructor Detail

StatusData

public StatusData()
Method Detail

dup

public AX25Message dup()
Creates and returns a copy of this Message. Since StatusData is not actually a message, this returns the message type that would be used to transmit the beacon. Not very efficient, but implemented to meet the interface specification.

Specified by:
dup in interface SendableMessage
Returns:
the AX25Message used to transmit this beacon

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

getNumTransmitsBeforeDecay

public int getNumTransmitsBeforeDecay()
Get the number of cycles for a complete iteration over the proportional pathing digipeat path set.

Specified by:
getNumTransmitsBeforeDecay in interface AX25FrameSource
Returns:
number of transmissions to do one cycle of proportional pathing (value is 2^(N-1) where N is number of path choices)

getConnector

public Connector getConnector()
Specify the Connector this message should be transmitted through.

Specified by:
getConnector in interface AX25FrameSource
Returns:
a specific Connector instance to transmit through, or null for all applicable ports (Connector.CAP_XMT_PACKET_DATA and not rejecting this specific packet [such as IGateConnectors shouldn't re-transmit something received from the IGate])
See Also:
Connector.CAP_XMT_PACKET_DATA

getBody

public byte[] getBody(boolean countTransmission,
                      byte protocolId,
                      AX25Frame frame)
Get an instance of this message, suitable for transmitting.

Specified by:
getBody in interface SendableMessage
Parameters:
countTransmission - number of times the message has been transmitted.
protocolId - AX.25 protocol ID to generate the message in, or 0 for default protocol; currently, only NOLVL3 (APRS) and OPENTRAC are supported.
frame - AX25Frame into which the message will be placed; the decoded message (as opposed to the byte array encoding) should be stored into the field frame.parsedAX25Msg
Returns:
byte array of message, or null if message body cannot be generated in specified protocol, or retransmission count has been exceeded.
See Also:
AX25Frame.parsedAX25Msg

isEnabled

public boolean isEnabled()
Test if message should still be transmitted.

Specified by:
isEnabled in interface SendableMessage
Returns:
boolean true if message should still be transmitted

writeToPreferences

public void writeToPreferences(java.util.prefs.Preferences root)
                        throws java.util.prefs.BackingStoreException
Throws:
java.util.prefs.BackingStoreException

readFromPreferences

public static StatusData readFromPreferences(java.util.prefs.Preferences root,
                                             java.lang.String beaconName)
                                      throws java.util.prefs.BackingStoreException
Throws:
java.util.prefs.BackingStoreException

queueNow

public void queueNow()

queueForTransmission

public void queueForTransmission()

cancelTransmission

public void cancelTransmission()

resetTransmitCount

public void resetTransmitCount()

clone

public java.lang.Object clone()
Creates and returns a copy of this object. Note this overrides the default clone() only to change the access control and remove the exception.

Overrides:
clone in class java.lang.Object
Returns:
a clone of this instance.

copyInto

public void copyInto(StatusData sd,
                     java.util.prefs.Preferences root)
Copy the contents of this StatusData object into the specified one, and tell the other one that it was changed if any changes occur.

Parameters:
sd - target StatusData to copy into
root - base Preferences object into which updated StatusData should be saved (or null to not save)