public abstract class PositionMessage extends Message implements PositionSrc
AX25Message.Precedence
Modifier and Type | Field and Description |
---|---|
protected byte |
abc
The Mic-E status code ordinal, where 0 is Emergency and -1 means that no Mic-E status
code is defined by this message.
|
int |
altitude
The altitude of this position in meters above mean sea level, or Integer.MIN_VALUE for unknown.
|
DistanceUnit |
altitudeUnit
The unit for the altitude measurement.
|
static float |
COMPRESSED_LAT_SCALING
Conversion scaling constant for encoding latitude in APRS compressed-text format.
|
static float |
CONV_MPH_TO_METERS_PER_SEC
Convenience constant to convert statute miles-per-hour to meters-per-second.
|
protected static java.lang.String |
DHM
Date format to parse day and hours:minutes (in UTC) for a longer delta into the past.
|
protected boolean |
enabledForTransmit
Indicate whether or not this position message is transmittable by this station.
|
protected boolean |
encodeCompressed
True if encoding to transmittable format should use compressed format.
|
protected double |
fLatitude
Latitude in fractional degrees North, or NaN if not filled in yet.
|
protected float |
fLatPrecision
The ambiguity level of the latitude in fractional degrees,
|
protected double |
fLongitude
Longitude in fractional degrees East, or NaN if not filled in yet.
|
protected static java.text.DecimalFormat |
fmtMonitorFreq
Format string for APRS-standard frequency format.
|
protected static java.lang.String |
HMS
Date format to decode hours/minutes/seconds timestamp string.
|
static float |
HUNDREDTH_MINUTE_F
Ambiguity value for hundredth-of-a-minute resolution.
|
protected boolean |
isCustom
If true, indicates that the Mic-E status code should be treated as a custom value rather
than the common standard meanings for the ordinal values 1 to 7.
|
protected java.lang.String |
latitude
The latitude of this position in APRS text format DDMM.MMn.
|
protected static double |
LN_BASE1_08
Scaling factor for encoding speed with compressed position.
|
protected java.lang.String |
longitude
The longitude of this position in APRS text format DDDMM.MMw.
|
static float |
ONE_DEGREE_F
Ambiguity value for one-degree resolution.
|
static float |
ONE_MINUTE_F
Ambiguity value for one-minute resolution.
|
static float |
TEN_MINUTES_F
Ambiguity value for ten-minute resolution.
|
static float |
TENTH_MINUTE_F
Ambiguity value for tenth-of-a-minute resolution.
|
appendCR, APRS_AND_OPENTRAC_AND_RAW, APRS_AND_RAW, comment, msgType, S_PERMANENT, S_PERMANENT_UC, symbolCode, symTableId
APRS_AND_OPENTRAC, ax25Frame, extensions, invalid, originatingCallsign, originatingDest, PERMANENT, rcptTime, thirdParty, timestamp, UTC
Modifier | Constructor and Description |
---|---|
protected |
PositionMessage()
Create an uninitialized PositionMessage (let the subclass initialize it).
|
protected |
PositionMessage(byte msgType,
java.lang.String tp,
long rcptTime)
Create a partially-initialized PositionMessage.
|
Modifier and Type | Method and Description |
---|---|
protected static void |
appendAreaParameters(java.lang.StringBuilder b,
java.util.Map<java.lang.Enum,java.lang.Object> extensionMap)
Appends the area "symbol" parameters to a StringBuilder for producing a transmittable
version of this position message.
|
protected void |
appendRepeaterParameters(java.lang.StringBuilder b)
Appends the repeater parameters (if any) to a StringBuilder for producing a transmittable
version of this position message.
|
protected static void |
appendSignpostParameters(java.lang.StringBuilder b,
java.util.Map<java.lang.Enum,java.lang.Object> extensionMap)
Appends the signpost parameters (if any) to a StringBuilder for producing a transmittable
version of this position message.
|
boolean |
bodyEquals(AX25Message o)
Compare the contents of the body of the message, reporting if they match.
|
ObjectReport |
createObjectFromThisPosition()
Create an ObjectReport from this PositionMessage.
|
int |
decodeDataExtension(byte[] body,
int pos)
Decode data extension if it exists.
|
double |
decodeLatitude()
Get the latitude from this PositionMessage in decimal degrees North.
|
double |
decodeLongitude()
Get the longitude from this PositionMessage in decimal degrees East.
|
static double |
decodeOnlyLatitude(java.lang.String latitude)
Decode standard long-format latitude without caring about the accuracy.
|
static double |
decodeOnlyLongitude(java.lang.String longitude)
Decode the specified String as a standard-format longitude "dddmm.mmE".
|
static java.lang.String |
encodeLatitudeCompressed(double latitude)
Convert a double-precision fractional degrees North latitude into APRS-standard compressed string format.
|
static java.lang.String |
encodeLatitudePlainText(double latitude)
Convert a double-precision fractional degrees North latitude into APRS-standard string format.
|
static java.lang.String |
encodeLongitudeCompressed(double longitude)
Convert a double-precision fractional degrees East longitude into APRS-standard compressed string format.
|
static java.lang.String |
encodeLongitudePlainText(double longitude)
Convert a double-precision fractional degrees East longitude into APRS-standard string format.
|
protected java.lang.String |
extractCompressedLatitude(byte[] body,
int offset)
Decode a compressed format latitude from a byte array.
|
protected java.lang.String |
extractCompressedLongitude(byte[] body,
int offset)
Decode a compressed format longitude from a byte array.
|
protected int |
extractLatitude(byte[] body,
int pos)
Service method to decode a fragment of an AX.25 frame that is supposed to contain
an APRS-standard non-compressed latitude expression.
|
protected int |
extractLongitude(byte[] body,
int pos)
Service method to decode a fragment of an AX.25 frame that is supposed to contain
an APRS-standard non-compressed longitude expression.
|
byte |
getAbc()
Returns the decoded MicE status (if any) from this PositionMessage.
|
int |
getAltitude()
Get the altitude of this position relative to mean sea level.
|
DistanceUnit |
getAltitudeUnit()
Get the size unit for altitude in this position message.
|
double |
getHorizontalAccuracy()
Return the position's horizontal accuracy.
|
java.lang.String |
getLatitude()
Get the string format latitude of this message.
|
float |
getLatitudeAccuracy()
Computes the precision of the latitude value in fractional degrees
|
java.lang.String |
getLongitude()
Get the string format longitude of this message.
|
float |
getPositionAltitude()
Return the position's altitude.
|
double |
getPositionLatitude()
Return the position's latitude.
|
double |
getPositionLongitude()
Return the position's longitude.
|
long |
getPositionTime()
Return when this position was determined.
|
boolean |
hasPosition()
Report if this AX25Message contains position data.
|
boolean |
isCustom()
Indicate whether the MicE status code is a standard code or a custom code.
|
boolean |
isEnabled()
Test if message should still be transmitted.
|
boolean |
isShowDate()
Test whether a transmission of this message should include the timestamp.
|
boolean |
isUsingCompressedFormat()
Indicates whether this PositionMessage is using compressed-mode (but not Mic-E) encoding of latitude and longitude,
because this affects what are legal symbol overlay codes.
|
protected static boolean |
looksLikeFrequency(byte[] body,
int pos)
Check if the ASCII character sequence in a byte array contains something that
looks like an APRS frequency value.
|
protected static int |
looksLikeFrequency(java.lang.String name)
Check if the character sequence in a String contains something that
looks like an APRS frequency value as would appear in an Object name for
a repeater.
|
java.lang.String |
paramString()
Descriptive text about this message, to be included in the toString() method's response.
|
void |
setAbc(byte abc)
Set the encoded MicE status (if any) for this PositionMessage.
|
void |
setAmbiguity(float ambiguityDeg)
Set the ambiguity of position for this position report.
|
void |
setCustom(boolean isCustom)
Specify whether the MicE status code is a standard code or a custom code.
|
void |
setLatitude(java.lang.String latitude)
Set the string format latitude of this message.
|
void |
setLocation(double latitude,
double longitude)
Set the latitude and longitude of this PositionMessage to the desired coordinates.
|
void |
setLongitude(java.lang.String longitude)
Set the string format longitude of this message.
|
void |
setShowDate(boolean showDate)
Specify whether this message should include the timestamp when transmitted or displayed.
|
protected static boolean |
testIfValidCompressedLocation(byte[] body,
int offset)
Test if the passed APRS byte array looks like a valid compressed-mode APRS position.
|
compareTo, decodeDatestamp, decodeHurricaneParams, decodeTimestamp, decodeWeatherParams, decodeWeatherParams, dup, encodeTimestamp, extractComment, extractComment, extractSymbol, formatBody, getComment, getExtensionString, getMsgType, getPrecedence, getProtocols, getSymbolCode, getSymTableId, hasWeather, inferSymbol, isAppendCR, isSymbolInferred, looksLikeLongFormatLatitude, setAppendCR, setComment, setSymbolCode, setSymTableId, toString
equals, extractSource, getAx25Frame, getExtension, getFirstDigipeat, getLastDigipeat, getNthDigipeat, getOriginalDestination, getOriginalSource, getOriginatingCallsign, getOriginatingDest, getRcptTime, getReadOnlyExtensionMap, getTimestamp, hashCode, hasThisFirstDigi, indexOf, indexOf, isDirect, isInvalid, isRf, onlyDigits, onlyDigits, onlyDigitsOrMinus, onlyDigitsOrPeriod, onlyDigitsOrSpace, onlyDigitsPlus, onlyPeriods, setAx25Frame, setInvalid, setOriginatingCallsign, setRcptTime, setTimestamp, split, storeExtension
protected static final java.lang.String DHM
protected static final java.lang.String HMS
protected static final java.text.DecimalFormat fmtMonitorFreq
public static final float COMPRESSED_LAT_SCALING
public static final float ONE_DEGREE_F
public static final float TEN_MINUTES_F
public static final float ONE_MINUTE_F
public static final float TENTH_MINUTE_F
public static final float HUNDREDTH_MINUTE_F
public static final float CONV_MPH_TO_METERS_PER_SEC
protected static final double LN_BASE1_08
protected java.lang.String latitude
protected java.lang.String longitude
protected double fLatitude
protected double fLongitude
protected float fLatPrecision
public int altitude
public DistanceUnit altitudeUnit
protected byte abc
protected boolean encodeCompressed
protected boolean isCustom
protected boolean enabledForTransmit
protected PositionMessage()
protected PositionMessage(byte msgType, java.lang.String tp, long rcptTime)
msgType
- msgType character (should correspond to the subclass being created)tp
- third-party routing string, or null if this message is still on its original networkrcptTime
- time in Java milliseconds in 1 Jan 1970 UTC when this message was receivedprotected int extractLatitude(byte[] body, int pos) throws java.lang.IllegalArgumentException
body
- byte array containing the messagepos
- int into array where latitude expression should startjava.lang.IllegalArgumentException
- if the pointed string is not a valid latitude expressionlatitude
public double decodeLatitude()
public static double decodeOnlyLatitude(java.lang.String latitude)
latitude
- String in standard ddmm.mmN latitude formatpublic float getLatitudeAccuracy()
protected static boolean testIfValidCompressedLocation(byte[] body, int offset)
body
- byte array supposedly containing an APRS positionoffset
- int array index into body where the position expression startsprotected java.lang.String extractCompressedLatitude(byte[] body, int offset)
body
- byte array containing the latitude informationoffset
- index into the byte array where the latitude information startspublic static java.lang.String encodeLatitudePlainText(double latitude)
latitude
- the floating-point latitude valuepublic static java.lang.String encodeLatitudeCompressed(double latitude)
latitude
- the floating-point latitude valueprotected int extractLongitude(byte[] body, int pos) throws java.lang.IllegalArgumentException
body
- byte array containing the messagepos
- int into array where longitude expression should startjava.lang.IllegalArgumentException
- if the pointed string is not a valid longitude expressionlongitude
protected java.lang.String extractCompressedLongitude(byte[] body, int offset)
body
- byte array containing the longitude informationoffset
- index into the byte array where the longitude information startspublic double decodeLongitude()
public static double decodeOnlyLongitude(java.lang.String longitude)
longitude
- String to decode as a longitudepublic static java.lang.String encodeLongitudePlainText(double longitude)
longitude
- the floating-point longitude valuepublic static java.lang.String encodeLongitudeCompressed(double longitude)
longitude
- the floating-point longitude valuepublic void setLocation(double latitude, double longitude)
latitude
- latitude in fractional degrees Northlongitude
- longitude in fractional degrees Eastpublic void setAmbiguity(float ambiguityDeg)
ambiguityDeg
- ambiguity of position in fractional degreessetLocation(double, double)
public int decodeDataExtension(byte[] body, int pos)
body
- byte array containing the messagepos
- starting index in arrayprotected static boolean looksLikeFrequency(byte[] body, int pos)
body
- byte array to searchpos
- zero-based index into array to start pattern matchprotected static int looksLikeFrequency(java.lang.String name)
name
- String object name to searchpublic java.lang.String paramString()
paramString
in class Message
Message.toString()
public boolean isShowDate()
public void setShowDate(boolean showDate)
showDate
- boolean true to show the timestamp (separate from the receive time)public boolean hasPosition()
hasPosition
in class AX25Message
public java.lang.String getLatitude()
public java.lang.String getLongitude()
public void setLatitude(java.lang.String latitude) throws java.lang.IllegalArgumentException
latitude
- String latitude to usejava.lang.IllegalArgumentException
- if string has illegal formatpublic void setLongitude(java.lang.String longitude) throws java.lang.IllegalArgumentException
longitude
- String longitude to usejava.lang.IllegalArgumentException
- if string has illegal formatpublic int getAltitude()
getAltitudeUnit()
public DistanceUnit getAltitudeUnit()
protected static void appendAreaParameters(java.lang.StringBuilder b, java.util.Map<java.lang.Enum,java.lang.Object> extensionMap)
b
- StringBuilder to add area parameters toextensionMap
- Map of message extensions containing the area informationprotected static void appendSignpostParameters(java.lang.StringBuilder b, java.util.Map<java.lang.Enum,java.lang.Object> extensionMap)
b
- StringBuilder to add area parameters toextensionMap
- Map of message extensions containing the signpost informationprotected void appendRepeaterParameters(java.lang.StringBuilder b)
b
- StringBuilder to add repeater/monitor parameters topublic byte getAbc()
public void setAbc(byte abc)
abc
- MicE status code, or -1 if this PositionMessage should not contain a MicE status codepublic boolean isCustom()
public void setCustom(boolean isCustom)
isCustom
- boolean true if custom MicE status, boolean false if standard MicE status or
this message does not have MicE status (ignored if status is EMERGENCY)public boolean isEnabled()
public ObjectReport createObjectFromThisPosition()
public boolean isUsingCompressedFormat()
public boolean bodyEquals(AX25Message o)
bodyEquals
in class Message
o
- another AX25Message to compare againstpublic double getPositionLatitude()
getPositionLatitude
in interface PositionSrc
public double getPositionLongitude()
getPositionLongitude
in interface PositionSrc
public float getPositionAltitude()
getPositionAltitude
in interface PositionSrc
public double getHorizontalAccuracy()
getHorizontalAccuracy
in interface PositionSrc
public long getPositionTime()
getPositionTime
in interface PositionSrc