org.ka2ddo.yaac.io
Class BeaconData

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

public class BeaconData
extends java.lang.Object
implements AX25FrameSource, GpsDataListener, java.lang.Cloneable, SendableMessage, java.io.Serializable

This class contains all the data associated with a beacon message.

See Also:
Serialized Form

Nested Class Summary
static class BeaconData.BeaconType
          Enum defining the APRS message formats that YAAC can use for position beacons.
static class BeaconData.PositionType
          Enum specifying the specific APRS Position Report message type code used for BeaconType.POSITION and BeaconType.COMPRESSED beacon messages in APRS.
 
Field Summary
 XmitEncoding ctcss
           
 java.lang.String[] digipeaters
           
 byte directionality
           
static java.lang.String[] DIRECTIVITY
           
 boolean enabled
           
 float fixedAltitudeM
           
 java.lang.String freeText
           
 byte gain
           
 byte height
           
 double latitude
           
 double longitude
           
 double monitorFreq
           
static java.lang.String MYCALL
           
static java.lang.String NOCALL
           
 short offset
           
 BeaconData.PositionType positionType
           
 byte power
           
 boolean reportAltitude
           
 boolean reportSpeed
           
 boolean showDFS
           
 boolean showPHG
           
 short status
           
 char symbolCode
           
 char symTableId
           
 BeaconData.BeaconType type
           
 boolean useGpsForPosition
           
 boolean useWeather
           
 
Constructor Summary
BeaconData()
           
 
Method Summary
 void addBeaconChangeListener(BeaconChangeListener l)
          Register to be informed when the beacon parameters are changed.
 void cancelTransmission()
          Cancel all upcoming transmissions of the beacon.
 java.lang.Object clone()
          Creates and returns a copy of this object.
 void copyInto(BeaconData bd, java.util.prefs.Preferences root)
          Copy the contents of this BeaconData 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 PortConnector this message should be transmitted through.
 AX25Frame getFrame(boolean incrementXmtCount, BeaconData.BeaconType overrideType, byte protocolId)
           
 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.
 void gpsDataUpdated(GPSDistributor distributor, GpsFix currentFix, boolean isLocal, java.lang.String source)
          Do not call.
 boolean isEnabled()
          Test if message should still be transmitted.
 void queueForTransmission()
          Queue the beacon for transmission after the next transmission interval.
 void queueNow()
          Queue the beacon for immediate transmission.
static BeaconData readFromPreferences(java.util.prefs.Preferences root, java.lang.String beaconName)
          Load the beacon settings from Java Preferences.
 void removeBeaconChangeListener(BeaconChangeListener l)
          Unregister from being informed when the beacon parameters are changed.
 void resetTransmitCount()
           
 void satDataUpdated(GPSDistributor distributor, SatelliteCatalog satCatalog, boolean isLocal, java.lang.String source)
          Do not call.
 java.lang.String toString()
           
 void writeToPreferences(java.util.prefs.Preferences root)
          Store the current beacon settings in Java Preferences.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MYCALL

public static final java.lang.String MYCALL
See Also:
Constant Field Values

NOCALL

public static final java.lang.String NOCALL
See Also:
Constant Field Values

type

public BeaconData.BeaconType type

positionType

public BeaconData.PositionType positionType

enabled

public boolean enabled

useGpsForPosition

public boolean useGpsForPosition

latitude

public double latitude

longitude

public double longitude

reportSpeed

public boolean reportSpeed

reportAltitude

public boolean reportAltitude

fixedAltitudeM

public float fixedAltitudeM

symTableId

public char symTableId

symbolCode

public char symbolCode

monitorFreq

public double monitorFreq

offset

public short offset

ctcss

public XmitEncoding ctcss

status

public short status

showPHG

public boolean showPHG

showDFS

public boolean showDFS

power

public byte power

height

public byte height

gain

public byte gain

directionality

public byte directionality

freeText

public java.lang.String freeText

useWeather

public boolean useWeather

digipeaters

public java.lang.String[] digipeaters

DIRECTIVITY

public static final java.lang.String[] DIRECTIVITY
Constructor Detail

BeaconData

public BeaconData()
Method Detail

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

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

getFrame

public AX25Frame getFrame(boolean incrementXmtCount,
                          BeaconData.BeaconType overrideType,
                          byte protocolId)

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)

resetTransmitCount

public void resetTransmitCount()

getConnector

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

Specified by:
getConnector in interface AX25FrameSource
Returns:
null for all applicable ports (PortConnector.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

gpsDataUpdated

public void gpsDataUpdated(GPSDistributor distributor,
                           GpsFix currentFix,
                           boolean isLocal,
                           java.lang.String source)
Do not call. Listener that is called by the GPSDistributor when the GPS data has been updated.

Specified by:
gpsDataUpdated in interface GpsDataListener
Parameters:
distributor - instance of the GPSDistributor
currentFix - current position data reported by the local GPS
isLocal - boolean true if this is GPS data for the local station, false if for a remote GPS receiver
source - String name assigned to remote GPS receiver, or null if for the local receiver

satDataUpdated

public void satDataUpdated(GPSDistributor distributor,
                           SatelliteCatalog satCatalog,
                           boolean isLocal,
                           java.lang.String source)
Do not call. Listener that is called when the satellite constellation in use changes.

Specified by:
satDataUpdated in interface GpsDataListener
Parameters:
distributor - instance of the GPSDistributor
satCatalog - updated SatelliteCatalog instance
isLocal - boolean true if this is GPS data for the local station, false if for a remote GPS receiver
source - String name assigned to remote GPS receiver, or null if for the local receiver

addBeaconChangeListener

public void addBeaconChangeListener(BeaconChangeListener l)
Register to be informed when the beacon parameters are changed.

Parameters:
l - BeaconChangeListener to register

removeBeaconChangeListener

public void removeBeaconChangeListener(BeaconChangeListener l)
Unregister from being informed when the beacon parameters are changed.

Parameters:
l - BeaconChangeListener to unregister

writeToPreferences

public void writeToPreferences(java.util.prefs.Preferences root)
                        throws java.util.prefs.BackingStoreException
Store the current beacon settings in Java Preferences.

Parameters:
root - the Preferences node that is the base for YAAC configuration data
Throws:
java.util.prefs.BackingStoreException - if Preferences could not be updated

readFromPreferences

public static BeaconData readFromPreferences(java.util.prefs.Preferences root,
                                             java.lang.String beaconName)
                                      throws java.util.prefs.BackingStoreException
Load the beacon settings from Java Preferences.

Parameters:
root - the Preferences node that is the base for YAAC configuration data
beaconName - the String name of the beacon instance to load
Returns:
a filled-in BeaconData structure
Throws:
java.util.prefs.BackingStoreException - if the beacon Preferences could not be read

queueNow

public void queueNow()
Queue the beacon for immediate transmission.


queueForTransmission

public void queueForTransmission()
Queue the beacon for transmission after the next transmission interval.


cancelTransmission

public void cancelTransmission()
Cancel all upcoming transmissions of the beacon.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

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

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(BeaconData bd,
                     java.util.prefs.Preferences root)
Copy the contents of this BeaconData object into the specified one, and tell the other one that it was changed if any changes occur.

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

dup

public AX25Message dup()
Creates and returns a copy of this Message. Since BeaconData 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