|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ka2ddo.ax25.AX25Message
public abstract class AX25Message
This class defines the common infrastructure for one decoded AX.25 message. Subclasses implement the details for different layer 3 and above protocols.
Nested Class Summary | |
---|---|
static class |
AX25Message.Precedence
This enum defines the allowed traffic precedence levels for messages. |
Field Summary | |
---|---|
AX25Frame |
ax25Frame
The AX.25 frame object from which this Message was extracted. |
protected boolean |
invalid
Indicates whether message was correctly formatted or otherwise parseable. |
static java.nio.charset.Charset |
ISO_8859_1
ISO-Latin-1 character set for converting byte arrays into Unicode Strings. |
java.lang.String |
originatingCallsign
Callsign of the station originating this message. |
static long |
PERMANENT
Reserved constant for non-expiring objects' timestamp. |
long |
rcptTime
The time the message was received by the system in Java standard milliseconds since 1970 UTC. |
java.lang.String |
thirdParty
The entire third-party routing path for this AX25Message, or null if this AX25message is still on its original network. |
long |
timestamp
Message timestamp in Java standard milliseconds since 1970 UTC. |
static java.util.TimeZone |
UTC
TimeZone object for Greenwich Mean Time (or Universal Coordinated Time), used for converting text string times and dates into binary. |
static java.nio.charset.Charset |
UTF8
UTF-8 character set for converting byte arrays into Unicode Strings. |
Constructor Summary | |
---|---|
protected |
AX25Message()
Constructor for partially initialized AX25Message. |
protected |
AX25Message(java.lang.String thirdParty,
long rcptTime)
Constructor for AX25Message specifying the third-party network routing and receive time of the message. |
Method Summary | |
---|---|
protected abstract boolean |
bodyEquals(AX25Message other)
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. |
AX25Message |
dup()
Creates and returns a copy of this AX25Message. |
boolean |
equals(java.lang.Object o)
Test if the Object o is a duplicate of this Message. |
void |
extractSource()
Extract the originating station callsign for this AX25Message. |
AX25Frame |
getAx25Frame()
Get the AX.25 frame from which this Message was extracted. |
java.lang.String |
getFirstDigipeat(AX25Callsign[] digipeaters)
Return the callsign of the first digipeat station for this message. |
java.lang.String |
getLastDigipeat(AX25Callsign[] digipeaters)
Return the callsign of the last digipeat station for this message. |
static java.lang.String |
getOriginalDestination(AX25Callsign dest,
java.lang.String thirdParty)
Extract the callsign of the original destination of this message. |
static java.lang.String |
getOriginalSource(AX25Callsign src,
java.lang.String thirdParty)
Extract the callsign of the original destination of this message. |
java.lang.String |
getOriginatingCallsign()
Get the callsign of the station that originated this message (not of any Tx-Igate relay). |
AX25Message.Precedence |
getPrecedence()
Report the traffic-handling precedence for this message instance. |
long |
getRcptTime()
Get the timestamp this AX25Message was received in milliseconds since 1 Jan 1970 UTC. |
long |
getTimestamp()
Get the timestamp associated with this Message in milliseconds since 1 Jan 1970 UTC. |
int |
hashCode()
Returns a hash code for this Message. |
boolean |
hasPosition()
Report if this AX25Message contains position data. |
boolean |
hasThisFirstDigi(AX25Callsign[] digipeaters,
java.lang.String digiCallsign)
Test if the specified callsign is the first digipeat station for this message. |
abstract boolean |
hasWeather()
Report if this AX25Message contains weather information. |
static int |
indexOf(byte[] buf,
int bufLen,
char matchCh,
int startPos)
Search a byte array (assumed to be an ASCII string) for a matching character. |
static int |
indexOf(byte[] buf,
int bufLen,
java.lang.String matchStr,
int startPos)
Search a byte array (assumed to be an ASCII string) for a matching ASCII string. |
boolean |
isInvalid()
Test if this message was flagged as invalid. |
static boolean |
onlyDigits(byte[] body,
int pos,
int len)
Test if the specified part of the message body is strictly only ASCII digits. |
static boolean |
onlyDigits(java.lang.String body,
int pos,
int len)
Test if the specified part of the message body is strictly only ASCII digits. |
static boolean |
onlyDigitsOrPeriod(java.lang.String body,
int pos,
int len)
Test if the specified part of the message body is strictly only ASCII digits. |
protected static boolean |
onlyDigitsOrSpace(byte[] body,
int pos,
int len)
Test if the specified part of the message body is strictly only ASCII digits or space characters. |
protected static boolean |
onlyDigitsPlus(byte[] body,
int pos,
int len)
Test if the specified part of the message body is only ASCII digits or characters just after the digits (to support base+offset message codes in APRS). |
protected static boolean |
onlyPeriods(byte[] body,
int pos,
int len)
Test if the specified part of the message body is strictly only period characters. |
java.lang.String |
paramString()
Descriptive text about this message, to be included in the toString() method's response. |
void |
setAx25Frame(AX25Frame ax25Frame)
Attach the AX.25 frame from which this Message was extracted. |
void |
setInvalid(boolean invalid)
Mark if this message is invalid or not. |
void |
setOriginatingCallsign(java.lang.String originatingCallsign)
Set the originating callsign for this AX25Message. |
void |
setRcptTime(long rcptTime)
Change the receive time of this message. |
void |
setTimestamp(long timestamp)
Change the timestamp of this message. |
static java.lang.String[] |
split(java.lang.String line,
char separator)
This is a more optimized version of String.split() that doesn't require compiling and evaluating regular expression patterns to do it, thereby saving chunks of transient heap (and probably some CPU time as well). |
java.lang.String |
toString()
Returns a string representation of the object. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final long PERMANENT
public AX25Frame ax25Frame
public java.lang.String originatingCallsign
AX25Frame.sender
public java.lang.String thirdParty
public long timestamp
public long rcptTime
protected boolean invalid
public static final java.nio.charset.Charset ISO_8859_1
public static final java.nio.charset.Charset UTF8
public static final java.util.TimeZone UTC
Constructor Detail |
---|
protected AX25Message()
protected AX25Message(java.lang.String thirdParty, long rcptTime)
thirdParty
- The entire third-party routing path for this AX25Message, or null if this AX25message
is still on its original network.rcptTime
- The time the message was received by the system in Java standard milliseconds since 1970 UTC.Method Detail |
---|
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- Object to compare against this message.
protected abstract boolean bodyEquals(AX25Message other)
other
- another AX25Message to compare against
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(AX25Message o)
compareTo
in interface java.lang.Comparable<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 static boolean onlyDigits(java.lang.String body, int pos, int len)
body
- String containing the message bodypos
- starting index in the array to testlen
- number of bytes to test
public static boolean onlyDigitsOrPeriod(java.lang.String body, int pos, int len)
body
- String containing the message bodypos
- starting index in the array to testlen
- number of bytes to test
public static boolean onlyDigits(byte[] body, int pos, int len)
body
- byte array containing the message bodypos
- starting index in the array to testlen
- number of bytes to test
protected static boolean onlyDigitsPlus(byte[] body, int pos, int len)
body
- byte array containing the message bodypos
- starting index in the array to testlen
- number of bytes to test
protected static boolean onlyDigitsOrSpace(byte[] body, int pos, int len)
body
- byte array containing the message bodypos
- starting index in the array to testlen
- number of bytes to test
protected static boolean onlyPeriods(byte[] body, int pos, int len)
body
- byte array containing the message bodypos
- starting index in the array to testlen
- number of bytes to test
public static int indexOf(byte[] buf, int bufLen, char matchCh, int startPos)
buf
- byte array to searchbufLen
- index of end of used part of buffermatchCh
- character value to search for in a forward searchstartPos
- zero-based index to start searching at
public static int indexOf(byte[] buf, int bufLen, java.lang.String matchStr, int startPos)
buf
- byte array to searchbufLen
- index of end of used part of buffermatchStr
- String value to search for in a forward searchstartPos
- zero-based index to start searching at
public java.lang.String paramString()
toString()
public java.lang.String toString()
toString
in class java.lang.Object
public void extractSource()
public final AX25Frame getAx25Frame()
public final void setAx25Frame(AX25Frame ax25Frame)
ax25Frame
- AX25Frame object containing the encoding of this Messagepublic static java.lang.String getOriginalSource(AX25Callsign src, java.lang.String thirdParty)
src
- AX25Callsign of the source of the original AX25FramethirdParty
- String of the third-party routing of this message, or null if not routed over another network
public static java.lang.String getOriginalDestination(AX25Callsign dest, java.lang.String thirdParty)
dest
- AX25Callsign of the destination (tocall) of the original AX25FramethirdParty
- String of the third-party routing of this message, or null if not routed over another network
public java.lang.String getLastDigipeat(AX25Callsign[] digipeaters)
digipeaters
- array of AX25Callsign digipeater addresses in AX.25 frame
public java.lang.String getFirstDigipeat(AX25Callsign[] digipeaters)
digipeaters
- array of AX25Callsign digipeater addresses in AX.25 frame
public boolean hasThisFirstDigi(AX25Callsign[] digipeaters, java.lang.String digiCallsign)
digipeaters
- array of AX25Callsign digipeater addresses in AX.25 framedigiCallsign
- String callsign/SSID of digipeater
public long getTimestamp()
public abstract boolean hasWeather()
public boolean hasPosition()
public void setTimestamp(long timestamp)
timestamp
- new time in Java milliseconds since epochpublic void setOriginatingCallsign(java.lang.String originatingCallsign)
originatingCallsign
- String of the originating station callsign of this messagepublic java.lang.String getOriginatingCallsign()
public long getRcptTime()
public void setRcptTime(long rcptTime)
rcptTime
- new time in Java milliseconds since epochpublic boolean isInvalid()
public void setInvalid(boolean invalid)
invalid
- boolean true if message should be considered invalid or incorrect syntaxpublic AX25Message.Precedence getPrecedence()
public AX25Message dup()
Cloneable
public static java.lang.String[] split(java.lang.String line, char separator)
line
- the String to split at occurrences of the separatorseparator
- the String delimiting substrings of the line
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |