org.ka2ddo.yaac.io
Class ObjectReportSender

java.lang.Object
  extended by org.ka2ddo.yaac.io.SendableMessageWrapper
      extended by org.ka2ddo.yaac.io.ObjectReportSender
All Implemented Interfaces:
java.io.Serializable, AX25FrameSource, TrackerListener

public class ObjectReportSender
extends SendableMessageWrapper
implements TrackerListener

This class extends SendableMessageWrapper to cancel transmission when the ObjectReport is overridden by another source (i.e., taken over).

See Also:
Serialized Form

Constructor Summary
ObjectReportSender(ObjectReport msg)
          Wrap an ObjectReport for locally initiated transmission as many times as the object definition says (3 times for transient objects, forever for permanent objects),
ObjectReportSender(ObjectReport msg, int maxTransmits)
          Wrap an ObjectReport for locally initiated transmission the specified number of times,
 
Method Summary
protected  void cleanup()
          Do any cleanup work involved in removing this wrapped message from the transmission queue.
 void messageAdded(StationState ss, int index, AX25Message msg)
          Called when a Message is added to the history for a station in the tracker.
 void messageDeleted(StationState ss, int index, AX25Message msg)
          Called when a AX25Message is deleted from the history for a station in the tracker.
static ObjectReportSender readFromPreferences(java.util.prefs.Preferences prefs, java.lang.String objectName)
          Recreate an ObjectReport and its encapsulating ObjectReportSender from the preferences cache.
 void removeFromPreferences(java.util.prefs.Preferences prefs)
          Delete this ObjectReportSender and its contained ObjectReport from the preferences cache.
 void stationAdded(StationState ss, int index)
          Called when a new station is initially added to the tracker.
 void stationDeleted(StationState ss, int index)
          Called when an existing station is deleted from the tracker.
 void stationUpdated(StationState ss)
          Called when an existing station is updated with new information in the tracker.
 void writeToPreferences(java.util.prefs.Preferences prefs)
          Store this ObjectReportSender and its contained ObjectReport in the preferences cache.
 
Methods inherited from class org.ka2ddo.yaac.io.SendableMessageWrapper
buildAX25FrameForMessage, cancelPermanently, cancelTransmission, computeRandomizedTransmitTime, findWrapperOf, getConnector, getDigipeatPaths, getFastSendRate, getFrames, getId, getLastTransmitTime, getMaxTransmits, getMsg, getNextMessage, getNumTransmissions, getNumTransmitsBeforeDecay, getObjectsInGroup, getOutstandingMessages, getQruGroupCounts, getRemainingTransmits, getSlowSendRate, isActive, isRejected, queueForTransmission, removeObsoleteMessage, removeObsoleteMessage, resetTransmitCount, setFastSendRate, setMaxTransmits, setNextMessage, setRejected, setSendableMessageListener, setSlowSendRate, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectReportSender

public ObjectReportSender(ObjectReport msg)
Wrap an ObjectReport for locally initiated transmission as many times as the object definition says (3 times for transient objects, forever for permanent objects),

Parameters:
msg - ObjectReport to transmit

ObjectReportSender

public ObjectReportSender(ObjectReport msg,
                          int maxTransmits)
Wrap an ObjectReport for locally initiated transmission the specified number of times,

Parameters:
msg - ObjectReport to transmit
maxTransmits - number of times the ObjectReport should be transmitted
Method Detail

stationAdded

public void stationAdded(StationState ss,
                         int index)
Called when a new station is initially added to the tracker.

Specified by:
stationAdded in interface TrackerListener
Parameters:
ss - StationState containing the station's information; the initial AX25Message will not yet be stored within the StationState object
index - zero-based integer sequence number for this station in the StationTracker

stationUpdated

public void stationUpdated(StationState ss)
Called when an existing station is updated with new information in the tracker.

Specified by:
stationUpdated in interface TrackerListener
Parameters:
ss - StationState containing the station's information; the new AX25Message will not yet be stored within the StationState object

stationDeleted

public void stationDeleted(StationState ss,
                           int index)
Called when an existing station is deleted from the tracker.

Specified by:
stationDeleted in interface TrackerListener
Parameters:
ss - StationState containing the station's information
index - zero-based integer sequence number for this station in the StationTracker

messageAdded

public void messageAdded(StationState ss,
                         int index,
                         AX25Message msg)
Called when a Message is added to the history for a station in the tracker.

Specified by:
messageAdded in interface TrackerListener
Parameters:
ss - StationState containing the station's information
index - zero-based index of the message added to the StationState object
msg - APRS Message object being added to the tracker; note that non-APRS packets that can still be decoded (such as OpenTRAC) will also be passed here; AX25Frames that cannot be decoded will pass null here

messageDeleted

public void messageDeleted(StationState ss,
                           int index,
                           AX25Message msg)
Called when a AX25Message is deleted from the history for a station in the tracker.

Specified by:
messageDeleted in interface TrackerListener
Parameters:
ss - StationState containing the station's information; the AX25Message will already be removed from the StationState object
index - zero-based index of the message removed from the StationState object
msg - APRS Message object being removed from the tracker; note that non-APRS packets that can still be decoded (such as OpenTRAC) will also be passed here; AX25Frames that cannot be decoded will pass null here

writeToPreferences

public void writeToPreferences(java.util.prefs.Preferences prefs)
Store this ObjectReportSender and its contained ObjectReport in the preferences cache.

Parameters:
prefs - Preferences node to contain the object record

cleanup

protected void cleanup()
Do any cleanup work involved in removing this wrapped message from the transmission queue.

Overrides:
cleanup in class SendableMessageWrapper

removeFromPreferences

public void removeFromPreferences(java.util.prefs.Preferences prefs)
Delete this ObjectReportSender and its contained ObjectReport from the preferences cache.

Parameters:
prefs - Preferences node containing the object record

readFromPreferences

public static ObjectReportSender readFromPreferences(java.util.prefs.Preferences prefs,
                                                     java.lang.String objectName)
Recreate an ObjectReport and its encapsulating ObjectReportSender from the preferences cache.

Parameters:
prefs - the Preferences node containing the object information
objectName - String name of cached Object/Item
Returns:
ObjectReportSender containing the restored Object