public class StationState extends java.lang.Object implements java.lang.Comparable<StationState>, java.io.Serializable, SupportsExtraData, java.lang.Iterable<AX25Message>
Modifier and Type | Class and Description |
---|---|
static class |
StationState.SpecialState
This enumeration identifies special conditions of a monitored station or object
that color a background circle behind the icon for the station.
|
Modifier and Type | Field and Description |
---|---|
protected char |
altSymbolCode
The local alias symbol code within the specified symbol table for representing this station or
object on the map.
|
protected char |
altSymTableId
The local alias symbol table ID (or overlay character for alternate symbols).
|
java.lang.String |
identifier
The String identifying this particular station or object.
|
boolean |
isViewable
Whether or not this station or object should be displayed on the map.
|
java.lang.String |
localAlias
The String identifying a local alias for this Station or Object.
|
static long |
MINUTES_80
Constant defining 80 minutes (the period commonly considered to be out-of-date in APRS) in Java milliseconds.
|
protected java.util.HashMap<java.lang.Object,java.lang.Object> |
miscAttachments
Place to attach miscellaneous attachments to a station or object.
|
float |
rangeM
Scratch range variable used for aloha circle calculation.
|
static java.util.Comparator<StationState> |
SORT_BY_IDENTIFIER
Comparator to order StationState objects by case-insensitive comparison of their identifier strings.
|
protected char |
symbolCode
The symbol code within the specified symbol table for representing this station or
object on the map.
|
protected char |
symTableId
The symbol table ID (or overlay character for alternate symbols).
|
Constructor and Description |
---|
StationState(java.lang.String callsign)
Create a new StationState object with the specified identifying String and the specified
parent node for tree-style display of the information.
|
Modifier and Type | Method and Description |
---|---|
int |
addMessage(AX25Message msg)
Add a message to the accumulated history for this station.
|
java.lang.StringBuilder |
appendAliasKV(java.lang.StringBuilder b)
Append the tactical alias for this station (or the undefinition if this station doesn't have an
alias).
|
void |
clearState()
Clear all accumulated inferred information about the station or object.
|
int |
compareTo(StationState ss)
Compares this object with the specified object for order.
|
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.
|
AX25Message |
get(int childIndex)
Get the Nth oldest message received from this station or object.
|
long |
getAge(long now)
Report the time since this station's information was updated.
|
int |
getAliasKVLength()
Return the length in characters of the tactical callsign exchange phrase for this station/object.
|
char |
getAltSymbolCode()
Return the currently defined local alias symbolCode reported for this station or object.
|
char |
getAltSymTableId()
Return the currently defined local alias identifier of the table containing the symbol reported for this station or object.
|
float |
getAmsl()
Get the last known altitude of the specified station or object.
|
java.lang.Object |
getAttachment(java.lang.Object key)
Get a named attachment for this station.
|
java.lang.Object[] |
getAttachmentKeys()
Get all the keys for attachments on this station or object.
|
float |
getBearing()
Get the last known course bearing for this station.
|
static int |
getDefaultMaxInactivityBeforeAlarm()
Get the current default value for how long a station or object can be inactive
before an inactive event is reported.
|
java.lang.String |
getIdentifier()
Get the identifying name of the station or object described by this StationState.
|
long |
getLastDigiTime()
Get the last time this station appeared as a digipeater.
|
long |
getLastPosTime()
Get the timestamp when the position was last updated.
|
double |
getLatitude()
Get the most recently reported or inferred latitude for this station or object.
|
java.lang.String |
getLocalAlias()
Get the current locally defined alias for this Station or Object.
|
double |
getLongitude()
Get the most recently reported or inferred longitude for this station or object.
|
int |
getMaxInactivityBeforeAlarm()
Get how long this station or object can be inactive before an inactive event is reported for it.
|
long |
getMostRecentPacketTime()
Get the last time a Message was received on behalf of this station or object or anything
this station digipeated.
|
PositionMessage |
getMostRecentPosition()
Get the last APRS position message reported for this station or object.
|
long |
getMostRecentRcptTimeOfSelf()
Get the last time a Message was received on behalf of this station or object.
|
AX25Message.Precedence |
getPrecedence()
Get the current Precedence state of this station or object.
|
static long |
getPurgeThresholdSecs()
Get the time in seconds that messages will be kept before purging.
|
float |
getRadiusOfConfidence()
Return the last reported position ambiguity,
|
java.lang.Object |
getRecordIdentifier()
Return the hashable and comparable identifier for the record.
|
StationState.SpecialState |
getSpecialState(long now,
long age)
Derive the background color for a given object.
|
float |
getSpeed()
Return the last known speed of travel of this station or object.
|
char |
getSymbolCode()
Return the last symbolCode reported for this station or object.
|
char |
getSymTableId()
Return the identifier of the table containing the symbol reported for this station or object.
|
java.util.Map<java.lang.Enum,java.lang.Object> |
getWeatherStateMap()
Get the map containing extracted weather and hurricane information.
|
int |
hashCode()
Returns a hash code value for the object.
|
boolean |
hasHurricane()
Report if this station is providing hurricane information.
|
boolean |
hasPlaybackMessages()
Report if this station or object has any messages from played-back log files.
|
boolean |
hasRealtimeMessages()
Report if this station has received any messages in real-time.
|
boolean |
hasWeather()
Report if this station is providing weather information.
|
boolean |
isActiveObject()
Indicates if this "station" is actually an Object or Item that is currently
active (not killed).
|
static boolean |
isDefaultIsViewableForNewStation()
Report whether newly created stations and object records are visible by default.
|
boolean |
isDirect(long oldestAllowed)
Report if the station has been directly heard by the local YAAC instance (without
being digipeated) recently.
|
static boolean |
isDoVicinityPlot()
Efficiently test if vicinity plotting should be done for stations not reporting position.
|
boolean |
isIGateOnly()
Indicate if the station has only been heard via a IGate connection to the APRS-IS backbone.
|
boolean |
isLocalRf(long oldestAllowed,
int maxDigis)
Indicate if the station is accessible over local RF.
|
boolean |
isObject()
Reports if this station was last reported as a non-transmitting object or item, as defined
by the APRS specifications.
|
boolean |
isObjectOnly()
Reports if this station is actually a non-transmitting object or item, as defined
by the APRS specifications.
|
boolean |
isOnlyOverrapidGpsFixes()
If entire history of this station is GpsRawMessages at too fast a rate for APRS messaging, than it must
be either a moron or a remote GPS (as defined in the SerialGpsConnector and SerialGpsPortEditor).
|
StationState.SpecialState |
isStationMoving(long now)
Test if the station monitored by this StationState appears to be moving or remaining in a
fixed location.
|
boolean |
isTimeInRange(long timestamp)
Test if this station has any messages meeting the specified time range.
|
boolean |
isTxOnlyTracker()
Indicate if this station is a transmit-only tracker.
|
java.util.Iterator<AX25Message> |
iterator()
Obtain an iterator to cycle through the messages accumulated for this station or object.
|
void |
persistLocalAlias(java.util.prefs.Preferences rootNode)
Checkpoint the current tactical name setting to Java Preferences
|
int |
pruneOldMessages(long then)
Delete all messages from this StationState object whose receive times are older than the
specified old age.
|
int |
pruneOldMessages(long then,
long now)
Delete all messages from this StationState object whose receive times are older than the
specified old age.
|
java.lang.Object |
putAttachment(java.lang.Object key,
java.lang.Object attachment)
Add an attachment to this station or object.
|
java.lang.Object |
removeAttachment(java.lang.Object key)
Remove an attachment from this station or object.
|
void |
setAltSymbolCode(char altSymbolCode)
Set the currently defined local alias symbolCode reported for this station or object.
|
void |
setAltSymTableId(char altSymTableId)
Set the currently defined local alias identifier of the table containing the symbol reported for this station or object.
|
void |
setAmsl(float amsl)
Overwrite the altitude for this station/object.
|
static void |
setDefaultIsViewableForNewStation(boolean defaultIsViewableForNewStation)
Specify whether newly created stations and object records are visible by default.
|
static void |
setDefaultMaxInactivityBeforeAlarm(int defaultMaxInactivityBeforeAlarm)
Set the default for how long a station or object can be inactive before an inactive event is reported for it.
|
static void |
setDoVicinityPlot(boolean doVicinityPlot)
Remember if vicinity plotting should be done for stations not reporting position.
|
void |
setLocalAlias(java.lang.String localAlias)
Set the current locally defined alias for this Station or Object.
|
void |
setLocation(double latitude,
double longitude,
long timestampMsec)
Set the location for this station or object.
|
void |
setMaxInactivityBeforeAlarm(int maxInactivityInMinutes)
Set how long this station or object can be inactive before an inactive event is reported for it.
|
static void |
setPurgeThresholdSecs(long purgeThresholdSecs)
Set the time in seconds before messages will be purged.
|
void |
setRadiusOfConfidence(float radiusOfConfidence)
Specify the radius of confidence (position ambiguity).
|
void |
setSymbol(char symTableId,
char symbolCode)
Change the symbol code associated with this station.
|
void |
setVelocity(float bearing,
float speedKts)
Set the speed and direction of motion for this station or object.
|
int |
size()
Get the number of messages associated with this station or object.
|
java.lang.String |
toString()
Return a string describing this object.
|
public static final long MINUTES_80
public java.lang.String identifier
public java.lang.String localAlias
protected char symTableId
protected char symbolCode
symTableId
protected char altSymTableId
protected char altSymbolCode
altSymTableId
public boolean isViewable
SendingStationFilter
public transient float rangeM
AlohaRanger
protected java.util.HashMap<java.lang.Object,java.lang.Object> miscAttachments
public static final java.util.Comparator<StationState> SORT_BY_IDENTIFIER
public StationState(java.lang.String callsign)
callsign
- String callsign or name of the station or objectpublic static boolean isDoVicinityPlot()
public static void setDoVicinityPlot(boolean doVicinityPlot)
doVicinityPlot
- boolean true if stations should be vicinity plotted relative to the original digipeating stationpublic static long getPurgeThresholdSecs()
public static void setPurgeThresholdSecs(long purgeThresholdSecs)
purgeThresholdSecs
- time in seconds before messages are purged (non-positive
time specifies no purging)public int getMaxInactivityBeforeAlarm()
public void setMaxInactivityBeforeAlarm(int maxInactivityInMinutes)
maxInactivityInMinutes
- maximum inactivity time in minutes, or <= 0 if no time limitpublic static int getDefaultMaxInactivityBeforeAlarm()
public static void setDefaultMaxInactivityBeforeAlarm(int defaultMaxInactivityBeforeAlarm)
defaultMaxInactivityBeforeAlarm
- maximum inactivity time in minutes, or <= 0 if no time limitpublic static boolean isDefaultIsViewableForNewStation()
public static void setDefaultIsViewableForNewStation(boolean defaultIsViewableForNewStation)
defaultIsViewableForNewStation
- boolean true if newly created StationState objects should be marked viewablepublic void clearState()
public int addMessage(AX25Message msg)
msg
- AX25Message to add to the history of this station statepublic int pruneOldMessages(long then)
then
- long time in milliseconds since Unix epoch that is the oldest time of messages not to be deletedpublic int pruneOldMessages(long then, long now)
then
- long time in milliseconds since Unix epoch that is the oldest time of messages not to be deletednow
- current time in milliseconds since epoch, used to check MessageWithExpireTime
nessagespublic boolean isOnlyOverrapidGpsFixes()
public boolean hasRealtimeMessages()
public boolean hasPlaybackMessages()
public boolean isTimeInRange(long timestamp)
timestamp
- border time in Java standard milliseconds since 1970 UTCpublic final long getAge(long now)
now
- the current time in Java standard milliseconds since 1970 UTCpublic float getAmsl()
public void setAmsl(float amsl)
amsl
- new altitude in meters above mean sea level relative to WGS84 geoidpublic java.lang.String getIdentifier()
public java.lang.Object getRecordIdentifier()
getRecordIdentifier
in interface SupportsExtraData
public double getLatitude()
public double getLongitude()
public long getLastPosTime()
public long getLastDigiTime()
public float getBearing()
public float getSpeed()
DistanceUnit.NM
public boolean isDirect(long oldestAllowed)
oldestAllowed
- the time in milliseconds after which this station must have
been locally heard to report truepublic boolean isLocalRf(long oldestAllowed, int maxDigis)
oldestAllowed
- oldest message time to check for local vs. non-localmaxDigis
- maximum number of digipeats to considerpublic boolean isIGateOnly()
public float getRadiusOfConfidence()
public void setRadiusOfConfidence(float radiusOfConfidence)
addMessage(AX25Message)
method.radiusOfConfidence
- position ambiguity in meters around the actual reported latitude/longitude, or a
negative value if the ambiguity has not been reported yetpublic final char getSymbolCode()
public final char getSymTableId()
public final char getAltSymbolCode()
public final char getAltSymTableId()
public final void setAltSymbolCode(char altSymbolCode)
altSymbolCode
- symbol character, or '\0' if no alias usedpublic final void setAltSymTableId(char altSymTableId)
altSymTableId
- symbol table ID character or overlay character if overlay used, or '\0' if no alias usedpublic boolean hasWeather()
public boolean hasHurricane()
public boolean isObjectOnly()
ObjectReport
public boolean isObject()
ObjectReport
public boolean isTxOnlyTracker()
public java.util.Iterator<AX25Message> iterator()
iterator
in interface java.lang.Iterable<AX25Message>
public java.util.Map<java.lang.Enum,java.lang.Object> getWeatherStateMap()
public java.lang.String toString()
toString
in class java.lang.Object
public AX25Message get(int childIndex)
childIndex
- int index into accumulated message historyjava.lang.IndexOutOfBoundsException
- if childIndex not in rangesize()
public int size()
public long getMostRecentRcptTimeOfSelf()
public long getMostRecentPacketTime()
public int compareTo(StationState ss)
compareTo
in interface java.lang.Comparable<StationState>
ss
- the StationState to be compared.java.lang.NullPointerException
- if the specified object is nulljava.lang.ClassCastException
- if the specified object's type prevents it
from being compared to this object.public StationState.SpecialState getSpecialState(long now, long age)
now
- time reference (in milliseconds since Jan 1 1970 UTC) to use to calculate ageage
- delta time since last received transmission from this station in millisecondspublic StationState.SpecialState isStationMoving(long now)
now
- current time in Java milliseconds since Jan 1 1970 UTCpublic AX25Message.Precedence getPrecedence()
public PositionMessage getMostRecentPosition()
public boolean isActiveObject()
public java.lang.String getLocalAlias()
public void setLocalAlias(java.lang.String localAlias)
localAlias
- the String local alias for this Station or Object, or null to clear the aliaspublic void persistLocalAlias(java.util.prefs.Preferences rootNode)
rootNode
- root Preferences node where Aliases subnode exists is persisting is to be donepublic void setSymbol(char symTableId, char symbolCode)
symTableId
- character for the symbol table and/or overlay for this station/objectsymbolCode
- character for the symbol within the specified table for this station/objectpublic void setLocation(double latitude, double longitude, long timestampMsec)
latitude
- latitude in degrees Northlongitude
- longitude in degrees EasttimestampMsec
- time in milliseconds since Jan 1 1970 UTC (epoch)public void setVelocity(float bearing, float speedKts)
bearing
- direction of travel in degrees from True NorthspeedKts
- sped of motion in knots (nautical miles per hour)public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.hashCode()
,
Hashtable
public int hashCode()
java.util.Hashtable
.hashCode
in class java.lang.Object
Object.equals(Object)
,
Hashtable
public java.lang.Object getAttachment(java.lang.Object key)
getAttachment
in interface SupportsExtraData
key
- Object identifying the particular attachmentpublic java.lang.Object putAttachment(java.lang.Object key, java.lang.Object attachment) throws java.lang.NullPointerException
putAttachment
in interface SupportsExtraData
key
- Object that will identify this particular attachmentattachment
- data to be attachedjava.lang.NullPointerException
- if a null attachment is specifiedpublic java.lang.Object removeAttachment(java.lang.Object key)
removeAttachment
in interface SupportsExtraData
key
- Object identifying the attachment to be removedpublic java.lang.Object[] getAttachmentKeys()
public int getAliasKVLength()
public java.lang.StringBuilder appendAliasKV(java.lang.StringBuilder b)
b
- StringBuilder to append to