public abstract class Message extends AX25Message implements CommentedMessage
AX25Message.Precedence
Modifier and Type | Field and Description |
---|---|
protected static boolean |
appendCR
Flag for APRS message generators as to whether a trailing carriage
return (CR or \\r character) should be appended to APRS packets.
|
protected static java.util.Set<ProtocolFamily> |
APRS_AND_OPENTRAC_AND_RAW
ProtocolFamily set providing all protocols.
|
protected static java.util.Set<ProtocolFamily> |
APRS_AND_RAW
Set of ProtocolFamily values for both APRS and raw AX.25.
|
protected java.lang.String |
comment
Free-text comment in this message.
|
protected byte |
msgType
APRS message type code (prefix character in the message text).
|
static java.lang.String |
S_PERMANENT
Reserved APRS timestamp string for permanent Objects.
|
static java.lang.String |
S_PERMANENT_UC
Reserved APRS timestamp string for permanent Objects, with uppercase timezone letter.
|
protected char |
symbolCode
The APRS symbol code within the specified table for the station originating this message.
|
protected char |
symTableId
The APRS symbol table ID (or overlay character) for the station originating this message.
|
APRS_AND_OPENTRAC, ax25Frame, extensions, invalid, originatingCallsign, originatingDest, PERMANENT, rcptTime, thirdParty, timestamp, UTC
Modifier | Constructor and Description |
---|---|
protected |
Message()
Create an uninitialized message.
|
protected |
Message(byte msgType,
java.lang.String thirdParty,
long rcptTime)
Set up this superclass's infrastructure for a particular message type at a particular receive time
with the specified third-party routing.
|
Modifier and Type | Method and Description |
---|---|
boolean |
bodyEquals(AX25Message o)
Compare the contents of the body of the message, reporting if they match.
|
int |
compareTo(AX25Message o)
Compares this object with the specified object for order.
|
protected int |
decodeDatestamp(byte[] body,
int pos)
Extract an APRS-standard 8-digit date/timestamp from a byte array presumably containing
a timestamped APRS message and store it in the timestamp field of this Message object.
|
protected int |
decodeHurricaneParams(byte[] body,
int offset)
Extract APRS-standard hurricane/tropical storm information from a message body.
|
protected int |
decodeTimestamp(byte[] body,
int pos,
long rcvTimestamp)
Extract an APRS-standard 6-digit timestamp from a byte array presumably containing
a timestamped APRS message and store it in the timestamp field of this Message object.
|
protected int |
decodeWeatherParams(byte[] body,
int offset)
Extract APRS-standard weather information from a message body.
|
protected int |
decodeWeatherParams(java.lang.String body,
int offset)
Extract APRS-standard weather information from a message body.
|
AX25Message |
dup()
Creates and returns a deep copy of this Message.
|
protected static java.lang.String |
encodeTimestamp(java.util.Date date,
long now)
Produce a APRS-standard 6-digit timestamp string for the specified date/time,
using the most precise format possible relative to the current time.
|
protected void |
extractComment(byte[] body,
int offset)
Extract the remaining text in the byte buffer as the free-text comment of this message.
|
protected void |
extractComment(byte[] body,
int startPos,
int endPos)
Extract the remaining text in the byte buffer as the free-text comment of this message.
|
static java.lang.String |
extractSymbol(java.lang.String dest)
Decode a symbol from the destination tocall (handling the case of old hardware and/or
software whose limited message set does not include messages with symbol codes in the message
body).
|
static java.lang.String |
formatBody(byte[] body,
int offset)
Convert a byte array into a UTF_8 printable string.
|
java.lang.String |
getComment()
Get the free-text comment of this message,
|
java.lang.String |
getExtensionString()
Build a formatted string of the weather data known to this message,
|
int |
getMsgType()
Get the APRS message type code for this message.
|
AX25Message.Precedence |
getPrecedence()
Report the traffic-handling precedence for this message instance.
|
java.util.Set<ProtocolFamily> |
getProtocols()
Get the protocol family or families that this message corresponds to, so
ports that don't support all protocols will not forward inappropriate packets.
|
char |
getSymbolCode()
Get the APRS symbol code for this Message.
|
char |
getSymTableId()
Get the APRS symbol table ID or overlay character for this Message.
|
boolean |
hasWeather()
Report if this Message contains weather information.
|
protected void |
inferSymbol(AX25Callsign src,
AX25Callsign dst)
Decode a symbol from the destination AX25Callsign (handling the case of old hardware and/or
software whose limited message set does not include messages with symbol codes in the message
body).
|
static boolean |
isAppendCR()
Indicate whether trailing CR should be appended to generated APRS packets.
|
boolean |
isSymbolInferred()
Report whether the non-null APRS symbol reported by this message is explicit or
inferred from destination or source callsign.
|
protected static boolean |
looksLikeLongFormatLatitude(byte[] body,
int pos,
int len)
Test the byte array to see if it looks like it contains a APRS text-format (long)
position indicator.
|
java.lang.String |
paramString()
Descriptive text about this message, to be included in the toString() method's response.
|
static void |
setAppendCR(boolean appendCR)
Specify whether trailing CR should be appended to generated APRS packets.
|
void |
setComment(java.lang.String comment)
Set the free-text comment for this Message.
|
void |
setSymbolCode(char symbolCode)
Set the APRS symbol code for this Message.
|
void |
setSymTableId(char symTableId)
Set the APRS symbol table ID or overlay character for this Message.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
equals, extractSource, getAx25Frame, getExtension, getFirstDigipeat, getLastDigipeat, getNthDigipeat, getOriginalDestination, getOriginalSource, getOriginatingCallsign, getOriginatingDest, getRcptTime, getReadOnlyExtensionMap, getTimestamp, hashCode, hasPosition, hasThisFirstDigi, indexOf, indexOf, isDirect, isInvalid, isRf, onlyDigits, onlyDigits, onlyDigitsOrMinus, onlyDigitsOrPeriod, onlyDigitsOrSpace, onlyDigitsPlus, onlyPeriods, setAx25Frame, setInvalid, setOriginatingCallsign, setRcptTime, setTimestamp, split, storeExtension
public static final java.lang.String S_PERMANENT
public static final java.lang.String S_PERMANENT_UC
protected static final java.util.Set<ProtocolFamily> APRS_AND_OPENTRAC_AND_RAW
protected static boolean appendCR
protected char symTableId
symbolCode
protected char symbolCode
symTableId
protected java.lang.String comment
protected byte msgType
protected static final java.util.Set<ProtocolFamily> APRS_AND_RAW
protected Message()
protected Message(byte msgType, java.lang.String thirdParty, long rcptTime)
msgType
- printable ASCII character identifying the APRS message typethirdParty
- String of third-party network routing data (may be null)rcptTime
- time in milliseconds since Jan 1 1970 UTC that message was received or createdpublic boolean bodyEquals(AX25Message o)
bodyEquals
in class AX25Message
o
- another AX25Message to compare againstpublic int compareTo(AX25Message o)
compareTo
in interface java.lang.Comparable<AX25Message>
compareTo
in class AX25Message
o
- the object to be compared.java.lang.ClassCastException
- if the specified object's type prevents it
from being compared to this object.public java.lang.String toString()
toString
in class AX25Message
public int getMsgType()
protected int decodeTimestamp(byte[] body, int pos, long rcvTimestamp)
body
- byte array containing the messagepos
- index into the array where the timestamp is supposed to startrcvTimestamp
- default time (in Java milliseconds since Jan 1 1970 UTC) to use if
timestamp field is all period charactersAX25Message.timestamp
protected int decodeDatestamp(byte[] body, int pos)
body
- byte array containing the messagepos
- index into the array where the timestamp is supposed to startAX25Message.timestamp
protected static java.lang.String encodeTimestamp(java.util.Date date, long now)
date
- Data object of the time to formatnow
- current time in Java milliseconds since 1970 UTC, to determine if 'date' is so far
away from current time that a format with the day in it is necessaryprotected static boolean looksLikeLongFormatLatitude(byte[] body, int pos, int len)
body
- byte array containing the APRS messagepos
- index into the byte array where lat/lon values are supposed to startlen
- remaining length of valid message bytes in the arrayprotected void extractComment(byte[] body, int offset)
body
- byte array containing the APRS messageoffset
- index into the byte array where the free-text comment beginsprotected void extractComment(byte[] body, int startPos, int endPos)
body
- byte array containing the APRS messagestartPos
- index into the byte array where the free-text comment beginsendPos
- index into the byte array after the free-text comment endspublic java.lang.String paramString()
paramString
in class AX25Message
toString()
,
getComment()
public static java.lang.String formatBody(byte[] body, int offset)
body
- byte arrayoffset
- start index into the arraypublic final char getSymbolCode()
public final char getSymTableId()
public void setSymbolCode(char symbolCode)
symbolCode
- char of the symbol code, or '\0' if this Message should not include a symbolpublic void setSymTableId(char symTableId)
symTableId
- char of the symbol table ID or overlay, or '\0' if this Message should not include a symbolprotected int decodeWeatherParams(byte[] body, int offset)
body
- byte array of message bodyoffset
- starting position for parsing weather dataprotected int decodeHurricaneParams(byte[] body, int offset)
body
- byte array of message bodyoffset
- starting position for parsing weather dataprotected int decodeWeatherParams(java.lang.String body, int offset)
body
- String of message bodyoffset
- starting position for parsing weather datapublic boolean hasWeather()
hasWeather
in class AX25Message
public AX25Message.Precedence getPrecedence()
getPrecedence
in class AX25Message
public java.lang.String getExtensionString()
public java.lang.String getComment()
getComment
in interface CommentedMessage
public void setComment(java.lang.String comment)
setComment
in interface CommentedMessage
comment
- String free-text comment to associate with this Messagepublic boolean isSymbolInferred()
protected void inferSymbol(AX25Callsign src, AX25Callsign dst)
src
- source AX25Callsign to parse (assuming this Message was not relayed through a third-party network),
or null to not use source SSID as final fallbackdst
- destination AX25Callsign to parse (assuming this Message was not relayed through a third-party network)public static java.lang.String extractSymbol(java.lang.String dest)
dest
- destination String to parsepublic AX25Message dup()
dup
in class AX25Message
Cloneable
public java.util.Set<ProtocolFamily> getProtocols()
getProtocols
in class AX25Message
public static boolean isAppendCR()
public static void setAppendCR(boolean appendCR)
appendCR
- boolean true if CR control character should be appended, false if not