Package org.ka2ddo.yaac.io
Class StatusData
java.lang.Object
org.ka2ddo.yaac.io.StatusData
- All Implemented Interfaces:
Serializable
,Cloneable
,SetBeaconRatesIfc
,AX25FrameSource
,SendableMessage
public class StatusData
extends Object
implements AX25FrameSource, Cloneable, SendableMessage, SetBeaconRatesIfc
This class defines all the data for transmitting an APRS Status message for this
station, per chapter 16 of the APRS Protocol Specification.
- Author:
- Andrew Pavlin, KA2DDO
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionint
Decay ratio when slowing down the beacon; should be 2 or 3.String[]
Specify the digipeater path or paths (if proportional pathing is being used) for transmitting this status message over RF.boolean
Flag indicating whether this status information should be transmitted.boolean
Enable meteor-scatter mode, where the status packet is transmitted repeatedly at maximum speed until the timeslot is over.The textual body content of the status message.int
Initial transmit interval for this beacon in seconds.boolean
Specify whether the local status's current position should be prefixed to the status text in Maidenhead format.boolean
Specify whether the current time should be prefixed to the status text.int
Slow stable transmit rate for non-changing station, in seconds.char
The APRS symbol code for this station's symbol.char
The APRS symbol table ID for this station's symbol; this may be an overlay character.Fields inherited from interface org.ka2ddo.ax25.AX25FrameSource
NO_FRAMES
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Cancel future periodic transmissions of this StatusData.clone()
Creates and returns a copy of this object.void
copyInto
(StatusData sd, 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.void
Specify that message should no longer be transmitted.dup()
Creates and returns a copy of this StatusData as a Message.byte[]
getBody
(boolean countTransmission, ProtocolFamily protocolId, AX25Frame frame) Get an instance of this message, suitable for transmitting.Specify the Connector this message should be transmitted through.int
Get the scaling factor by which the message repeat interval is enlarged (until the default slow send rate is reached).getFrames
(boolean incrementXmtCount, ProtocolFamily protocolId, String senderCallsign) Get one or more AX25Frames of the data to transmit.int
Get the time interval between retransmissions when a message is newly introduced into the system.int
Get the number of cycles for a complete iteration over the proportional pathing digipeat path set.int
The slowest rate a message should be sent.boolean
Test if message should still be transmitted.boolean
Indicate whether beacon data source can dynamically change its position (latitude/longitude), such as for a mobile station with a GPS.void
Queue the next transmission of this StatusData.void
queueNow()
Force this StatusData to be transmitted immediately.static StatusData
readFromPreferences
(Preferences root, String beaconName) Create a StatusData for the specified name from the information saved in the Java Preferences tree.void
Reset the counters used to calculate the transmission interval so that status will initially be transmitted frequently at the fast rate.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
setInitialSendRate
(int initialSendRate) Set the time interval between retransmissions when a message is newly introduced into the system.void
setSlowSendRate
(int slowSendRate) Set the slowest rate a message should be sent.void
Store the contents of this record in a Java Preferences node.
-
Field Details
-
format
The textual body content of the status message. -
enabled
public boolean enabledFlag indicating whether this status information should be transmitted. -
prefixMaidenhead
public boolean prefixMaidenheadSpecify whether the local status's current position should be prefixed to the status text in Maidenhead format. -
symTableId
public char symTableIdThe APRS symbol table ID for this station's symbol; this may be an overlay character. Only meaningful when using the Maidenhead prefix. -
symbolCode
public char symbolCodeThe APRS symbol code for this station's symbol. Only meaningful when using the Maidenhead prefix. -
prefixTime
public boolean prefixTimeSpecify whether the current time should be prefixed to the status text. -
digipeaters
Specify the digipeater path or paths (if proportional pathing is being used) for transmitting this status message over RF. Default is proportional pathed of no digipeat, WIDE1-1 digipeat, and WIDE1-1.WIDE2-1 digipeat. -
initialRateSecs
public int initialRateSecsInitial transmit interval for this beacon in seconds. -
decayRatio
public int decayRatioDecay ratio when slowing down the beacon; should be 2 or 3. -
slowRateSecs
public int slowRateSecsSlow stable transmit rate for non-changing station, in seconds. -
enableMeteorMode
public boolean enableMeteorModeEnable meteor-scatter mode, where the status packet is transmitted repeatedly at maximum speed until the timeslot is over.
-
-
Constructor Details
-
StatusData
public StatusData()
-
-
Method Details
-
dup
Creates and returns a copy of this StatusData as a 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 interfaceSendableMessage
- Returns:
- the AX25Message used to transmit this beacon
-
getFrames
public AX25Frame[] getFrames(boolean incrementXmtCount, ProtocolFamily protocolId, String senderCallsign) Get one or more AX25Frames of the data to transmit.- Specified by:
getFrames
in interfaceAX25FrameSource
- Parameters:
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)- 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 interfaceAX25FrameSource
- Returns:
- number of transmissions to do one cycle of proportional pathing (value is 2^(N-1) where N is number of path choices)
-
getConnector
Specify the Connector this message should be transmitted through.- Specified by:
getConnector
in interfaceAX25FrameSource
- 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:
-
isUseGpsForPosition
public boolean isUseGpsForPosition()Indicate whether beacon data source can dynamically change its position (latitude/longitude), such as for a mobile station with a GPS.- Specified by:
isUseGpsForPosition
in interfaceSetBeaconRatesIfc
- Returns:
- boolean true if latitude or longitude of beacon can change dynamically (not just through UI)
-
getBody
Get an instance of this message, suitable for transmitting.- Specified by:
getBody
in interfaceSendableMessage
- Parameters:
countTransmission
- number of times the message has been transmitted.protocolId
- ProtocolFamily to generate the message inframe
- 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:
-
isEnabled
public boolean isEnabled()Test if message should still be transmitted.- Specified by:
isEnabled
in interfaceSendableMessage
- Returns:
- boolean true if message should still be transmitted
-
disableForTransmit
public void disableForTransmit()Specify that message should no longer be transmitted. For the Status message, this should only happen when commanded by the user through the configuration dialog, so make this function a no-op.- Specified by:
disableForTransmit
in interfaceSendableMessage
-
writeToPreferences
Store the contents of this record in a Java Preferences node.- Parameters:
root
- Preferences node of the base of the application's Preferences tree- Throws:
BackingStoreException
- if data could not be saved to Preferences backing storage
-
readFromPreferences
public static StatusData readFromPreferences(Preferences root, String beaconName) throws BackingStoreException Create a StatusData for the specified name from the information saved in the Java Preferences tree.- Parameters:
root
- Preferences node of the base of the application's Preferences treebeaconName
- String name of specific StatusDate variant- Returns:
- filled-in StatusData object, or null if no StatusData configuration stored under the specified name
- Throws:
BackingStoreException
- if Preferences data could not be read for some reason
-
queueNow
public void queueNow()Force this StatusData to be transmitted immediately. -
queueForTransmission
public void queueForTransmission()Queue the next transmission of this StatusData. -
cancelTransmission
public void cancelTransmission()Cancel future periodic transmissions of this StatusData. -
resetTransmitCount
public void resetTransmitCount()Reset the counters used to calculate the transmission interval so that status will initially be transmitted frequently at the fast rate. -
getDecayRatio
public int getDecayRatio()Get the scaling factor by which the message repeat interval is enlarged (until the default slow send rate is reached).- Specified by:
getDecayRatio
in interfaceSetBeaconRatesIfc
- Returns:
- int decay ratio
-
setDecayRatio
public void setDecayRatio(int decayRatio) Set the scaling factor by which the message repeat interval is enlarged (until the default slow send rate is reached).- Specified by:
setDecayRatio
in interfaceSetBeaconRatesIfc
- Parameters:
decayRatio
- int decay ratio (should be 2 or 3)
-
getInitialSendRate
public int getInitialSendRate()Get the time interval between retransmissions when a message is newly introduced into the system.- Specified by:
getInitialSendRate
in interfaceSetBeaconRatesIfc
- Returns:
- send interval in seconds
-
setInitialSendRate
public void setInitialSendRate(int initialSendRate) Set the time interval between retransmissions when a message is newly introduced into the system.- Specified by:
setInitialSendRate
in interfaceSetBeaconRatesIfc
- Parameters:
initialSendRate
- send interval in seconds
-
getSlowSendRate
public int getSlowSendRate()The slowest rate a message should be sent. For messages to be terminated, they should stop being requeued when the retransmission interval is enlarged to this.- Specified by:
getSlowSendRate
in interfaceSetBeaconRatesIfc
- Returns:
- transmission interval in seconds
-
setSlowSendRate
public void setSlowSendRate(int slowSendRate) Set the slowest rate a message should be sent. For messages to be terminated, they should stop being requeued when the retransmission interval is enlarged to this.- Specified by:
setSlowSendRate
in interfaceSetBeaconRatesIfc
- Parameters:
slowSendRate
- transmission interval in seconds
-
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. -
copyInto
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 intoroot
- base Preferences object into which updated StatusData should be saved (or null to not save)
-