|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ka2ddo.ax25.AX25Callsign
public final class AX25Callsign
This class defines a single AX.25 callsign (address).
Field Summary | |
---|---|
static java.util.Comparator<AX25Callsign> |
CALLSIGN_COMPARATOR
A Comparator to use for callsigns when it is more efficient than using the Comparable interface to AX25Callsign. |
boolean |
h_c
Has_been_repeated flag (for digipeater callsigns) or command/response flags (for destination and source callsigns). |
boolean |
last
Flag bit in SSID byte indicating this is the last callsign in a digipeater sequence. |
boolean |
valid
Indicates whether the callsign in this object can be exported as a valid AX.25 binary protocol address. |
Constructor Summary | |
---|---|
AX25Callsign()
Construct an empty but assumed-valid callsign. |
|
AX25Callsign(byte[] buf,
int offset,
int length)
Extract an AX.25 callsign from a byte array in network byte order. |
|
AX25Callsign(java.lang.String textCallsign)
Construct a AX25Callsign from the string representation of the callsign. |
|
AX25Callsign(java.lang.String textCallsign,
int startPos,
int endPos)
Construct a AX25Callsign from the specified sub-string representation of the callsign. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Creates and returns a copy of this object. |
int |
compareTo(AX25Callsign o)
Compares this object with the specified object for order. |
void |
decrementSSID()
Decrement a non-zero SSID value, as is done for NewN-n paradigm digipeat aliases. |
AX25Callsign |
dup()
Create a shallow clone of this AX25Callsign, discarding any cached toString() value. |
boolean |
equals(java.lang.Object o)
Test if some other object is the same as this AX25Callsign. |
java.lang.String |
getBaseCallsign()
Gets the base callsign (without the AX.25 SSID extension). |
static byte |
getDefaultReserved()
Get the current default value for the reserved bits of the AX25 callsign SSID byte. |
byte |
getReserved()
Get the reserved bits of the 7th byte of the callsign (per the AX.25 specification). |
int |
getSSID()
Return the numeric SSID associated with this callsign. |
boolean |
hasBeenRepeated()
Report if the hasBeenRepeated flag in the callsign is set. |
int |
hashCode()
Returns a hash code for this callsign. |
boolean |
isNewNParadigmAlias()
Test if this callsign appears to be a valid New n-N digipeat alias. |
static boolean |
isNewNParadigmAlias(java.lang.String callsign)
Test if the parameter appears to be a valid New n-N digipeat alias. |
static boolean |
isRealCallsign(java.lang.String callsign)
Test if a callsign looks like a real callsign (at least one digit somewhere other than the last character, all letters uppercase). |
boolean |
isValid()
Indicates if this callsign has valid syntax to be transmitted in the header of an AX.25 frame. |
static void |
setDefaultReserved(byte defaultReserved)
Set the default value for the reserved bits of newly generated AX25 callsign SSID byte. |
void |
setReserved(byte reserved)
Set the reserved bits of the 7th byte of the callsign (per the AX.25 specification). |
void |
setSSID(int ssid)
Specify the numeric SSID associated with this callsign. |
java.lang.String |
toAnnotatedString()
Return a String representing this AX25Frame object, with an additional note if the reserved field in the SSID byte is not the default value. |
byte[] |
toByteArray()
Return the callsign as the actual byte sequence that would be transmitted over the air (without HDLC bit-stuffing). |
java.lang.String |
toString()
Return a String representing this AX25Callsign object. |
void |
write(java.io.OutputStream os,
boolean last)
Encode this AX25Callsign into binary radio transmission format on a stream. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public boolean h_c
public boolean last
public boolean valid
public static final java.util.Comparator<AX25Callsign> CALLSIGN_COMPARATOR
compareTo(AX25Callsign)
Constructor Detail |
---|
public AX25Callsign()
public AX25Callsign(java.lang.String textCallsign)
textCallsign
- String to parse into an AX.25-compliant callsignpublic AX25Callsign(java.lang.String textCallsign, int startPos, int endPos)
textCallsign
- String to parse into an AX.25-compliant callsignstartPos
- int position in string where callsign startsendPos
- int position in string where callsign endspublic AX25Callsign(byte[] buf, int offset, int length) throws java.lang.IndexOutOfBoundsException, java.lang.IllegalArgumentException
buf
- byte array containing the AX.25-encoded callsignoffset
- index into the array where the callsign beginslength
- bytes remaining in the array after the offset
java.lang.IndexOutOfBoundsException
- if not enough bytes left in the array to contain an AX.25 callsign
java.lang.IllegalArgumentException
- if the callsign has an invalid format, such as embedded whitespace in
the middle of a callsign with following non-blank charactersMethod Detail |
---|
public static boolean isRealCallsign(java.lang.String callsign)
callsign
- String callsign to test
public boolean isNewNParadigmAlias()
public static boolean isNewNParadigmAlias(java.lang.String callsign)
callsign
- String supposedly containing an AX.25 callsign
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- Object to compare against this callsign
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toAnnotatedString()
public int compareTo(AX25Callsign o)
compareTo
in interface java.lang.Comparable<AX25Callsign>
o
- the object to be compared.
java.lang.ClassCastException
- if the specified object's type prevents it
from being compared to this object.public void write(java.io.OutputStream os, boolean last) throws java.io.IOException
os
- the OutputStream to write the binary encoding tolast
- boolean true if this callsign should have the last bit set in
its last byte to indicate there will be no following callsigns
according to the AX.25 protocol specification
java.io.IOException
- if callsign could not be written to the streampublic byte[] toByteArray()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- if the object's class does not
support the Cloneable
interface. Will never be thrown by this class.public AX25Callsign dup()
public java.lang.String getBaseCallsign()
public int getSSID()
public void setSSID(int ssid)
ssid
- numeric SSID in the range 0 to 15public void decrementSSID()
public boolean hasBeenRepeated()
public byte getReserved()
public void setReserved(byte reserved)
reserved
- the new value of the reserved bits (masked to the range 0 to 3)public boolean isValid()
public static byte getDefaultReserved()
public static void setDefaultReserved(byte defaultReserved)
defaultReserved
- current default RR bit value
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |