|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ka2ddo.yaac.ax25.StationTracker
public class StationTracker
This class manages tracking all heard APRS stations and objects/items. It keeps a time-ordered and callsign-searchable index of all stations, with the messages associated with each station in reverse chronological order, along with an assembled current state of the station.
Nested Class Summary | |
---|---|
static class |
StationTracker.AddressStatistics<K,C extends StationTracker.AddressStatistics>
This abstract class collects the occurrence counts for a particular type of station. |
static class |
StationTracker.DestinationStatistics
Usage statistics for a particular tocall (destination) callsign in AX.25 traffic. |
static class |
StationTracker.DigipeatStatistics
Address statistics for a particular digipeater. |
Field Summary | |
---|---|
protected java.util.HashMap<java.lang.String,StationState> |
stationMap
|
Method Summary | |
---|---|
void |
addDestinationListener(DestinationListener l)
Register a listener that wants to know when a new tocall or explicit network destination is recorded. |
StationState |
addMessage(java.lang.String identifier,
AX25Message msg,
AX25Callsign[] digipeaters,
boolean upshiftIdentifier)
Register a message with the appropriate sending station. |
void |
addNewDestination(java.lang.String dest)
Add a new destination to the map of destination callsigns and statistics. |
StationState |
addNewStationIfNeeded(java.lang.String callsign)
Get the current StationState record for the specified station or object, creating a new record if one doesn't currently exist. |
void |
addRelayListener(DigipeatListener l)
Register a listener that wants to know when a new digipeater is recorded. |
void |
addTrackerListener(TrackerListener l)
Register a listener to be informed of changes to the station histories. |
void |
aprsMessageReceived(Message msg)
Delivers the next message received by YAAC that is an APRS message. |
void |
deleteStation(StationState ss)
Remove the specified station or object from the tracked history immediately. |
protected void |
fireMessageAdded(StationState ss,
int index,
AX25Message msg)
Inform all registered TrackerListener instances that a new message has arrived from the specified station or about the specified object. |
protected void |
fireMessageDeleted(StationState ss,
int index,
AX25Message msg)
Inform all registered TrackerListener instances that an old message has been deleted from the specified station or about the specified object. |
protected void |
fireStationAdded(StationState ss,
int index)
Inform all registered TrackerListener instances that a new station or object has been added to the tracker. |
void |
fireStationDeleted(StationState ss,
int index)
Inform all registered TrackerListener instances that a station or object's state is being deleted due to lack of activity, |
void |
fireStationUpdated(StationState ss)
Inform all registered TrackerListener instances that a station's status is being updated. |
java.util.Set<java.lang.String> |
getCurrentNameSet()
Get a Set of all the identifiers of stations and objects currently known. |
StationState[] |
getCurrentTrackedObjectArray()
Get an array of all the known StationState objects. |
StationState[] |
getCurrentTrackedObjectArray(boolean includeStations,
boolean includeObjects,
boolean includeSelf,
Filter filter,
java.util.Comparator<StationState> sortComparator)
Get an array of a selected filtered subset of the known StationState instances. |
java.util.ArrayList<StationState> |
getCurrentTrackedObjectList()
Get a list of all the known StationState objects. |
java.util.HashMap<java.lang.String,StationTracker.DestinationStatistics> |
getDestinationsMap()
Get the raw Map of destination callsigns to statistics counters. |
java.util.Set<java.lang.String> |
getDestinationsStringSet()
Get the sorted set of all destination callsign strings. |
java.lang.String[] |
getDirectStationList(long now)
Get a list of all stations heard directly by this station. |
java.util.HashMap<java.lang.String,StationTracker.DigipeatStatistics> |
getFinalSendersMap()
Get the map of last digipeater statistics |
java.util.Set<java.lang.String> |
getFinalSendersSet()
Get all the callsigns of the final digipeaters/I-gates used by all stations in the history. |
static StationTracker |
getInstance()
Get the singleton instance of the StationTracker. |
RadiusFilter |
getRangeLimitFilter()
Get a reference to the RadiusFilter used for deciding if a station or object has changed between being in-range and out-of-range. |
int |
getStationTypeCount(char symTableId,
char symbolCode)
Count the number of known stations of a specified type. |
StationState |
getTrackedObject(java.lang.String name)
Get the state object for the specified station or object. |
java.util.Iterator<StationState> |
iterator()
Returns an iterator over a set of elements of type StationState. |
void |
parsedAX25MessageReceived(byte pid,
AX25Message msg)
Delivers the next message received by YAAC that is some sort of parsed AX.25 higher-level message. |
void |
purgeStaleTraffic()
Delete all cached messages older than the purge threshold. |
void |
removeDestinationListener(DestinationListener l)
Remove a listener that no longer wants to know when a new tocall or explicit network destination is recorded. |
void |
removeRelayListener(DigipeatListener l)
Unregister a listener that no longer wants to know when a new digipeater is recorded. |
void |
removeTrackerListener(TrackerListener l)
Unregister a listener. |
java.lang.String |
toString()
Return String describing the StationTracker object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final java.util.HashMap<java.lang.String,StationState> stationMap
Method Detail |
---|
public void purgeStaleTraffic()
public StationState getTrackedObject(java.lang.String name)
name
- callsign or identifier for the desired station or object
public java.util.Set<java.lang.String> getCurrentNameSet()
public java.util.ArrayList<StationState> getCurrentTrackedObjectList()
public StationState[] getCurrentTrackedObjectArray()
public StationState[] getCurrentTrackedObjectArray(boolean includeStations, boolean includeObjects, boolean includeSelf, Filter filter, java.util.Comparator<StationState> sortComparator)
includeStations
- boolean true if stations (message originators) should be includedincludeObjects
- boolean true if objects (non-transmitting) should be includedincludeSelf
- boolean true if own station should be included, regardless of filters and other include flagsfilter
- a Filter to decide which StationState instances should be included, or null if no filtering should be donesortComparator
- if non-null, a Comparator to use to sort the StationState objects in a desired order while
the mutex is being held, to prevent the StationState objects from changing while the
sort is in progress
public void addTrackerListener(TrackerListener l)
l
- TrackerListener to registerpublic void removeTrackerListener(TrackerListener l)
l
- TrackerListener to unregisterprotected void fireStationAdded(StationState ss, int index)
ss
- newly-added StationStateindex
- index in tracker list of the new StationStatepublic void fireStationUpdated(StationState ss)
ss
- StationState receiving updatepublic void fireStationDeleted(StationState ss, int index)
ss
- StationState instance being deletedindex
- index in tracker list of the station being deletedprotected void fireMessageAdded(StationState ss, int index, AX25Message msg)
ss
- StationState instance adding a new messageindex
- index within StationState object of the added messagemsg
- the AX25Message being added to the station/objectprotected void fireMessageDeleted(StationState ss, int index, AX25Message msg)
ss
- StationState instance deleting an old messageindex
- index within StationState object of the deleted messagemsg
- the AX25Message being deleted from the station/objectpublic java.lang.String toString()
toString
in class java.lang.Object
public void deleteStation(StationState ss)
ss
- StationState to removepublic static StationTracker getInstance()
public void aprsMessageReceived(Message msg)
aprsMessageReceived
in interface AprsMessageListener
msg
- some subclass of Message containing the message contents; the message should have
an AX25Frame connected to itAX25Frame
,
AX25Message.ax25Frame
,
AX25Message.getAx25Frame()
public void parsedAX25MessageReceived(byte pid, AX25Message msg)
parsedAX25MessageReceived
in interface ParsedAX25MessageListener
pid
- AX.25 protocol IDmsg
- some subclass of Message containing the message contents; the message should have
an AX25Frame connected to itAX25Frame
public StationState addMessage(java.lang.String identifier, AX25Message msg, AX25Callsign[] digipeaters, boolean upshiftIdentifier)
identifier
- String identifier of station or object sending the messagemsg
- the AX25Message to be recordeddigipeaters
- any digipeater stations associated with the message's transmissionupshiftIdentifier
- boolean true if identifier should be forced to upper case (i.e., is a station
callsign, not an object identifier)
public void addNewDestination(java.lang.String dest)
dest
- String callsign of destinationpublic StationState addNewStationIfNeeded(java.lang.String callsign)
callsign
- String identifier for the station/object record to find or create
public int getStationTypeCount(char symTableId, char symbolCode)
symTableId
- code identifying the table or overlay being used (only valid primary or alternate
table, or APRS 1.2 extensions known to YAAC)symbolCode
- code identifying the station symbol
public java.util.Iterator<StationState> iterator()
iterator
in interface java.lang.Iterable<StationState>
public java.lang.String[] getDirectStationList(long now)
now
- reference time (in milliseconds since Java epoch) that messages must
not be more than 30 minutes older
public java.util.Set<java.lang.String> getFinalSendersSet()
public java.util.HashMap<java.lang.String,StationTracker.DigipeatStatistics> getFinalSendersMap()
public java.util.Set<java.lang.String> getDestinationsStringSet()
public java.util.HashMap<java.lang.String,StationTracker.DestinationStatistics> getDestinationsMap()
public void addRelayListener(DigipeatListener l)
l
- DigipeatListener to registerpublic void removeRelayListener(DigipeatListener l)
l
- DigipeatListener to unregisterpublic void addDestinationListener(DestinationListener l)
l
- DestinationListener to registerpublic void removeDestinationListener(DestinationListener l)
l
- DestinationListener to unregisterpublic RadiusFilter getRangeLimitFilter()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |