pub struct Callsign { /* private fields */ }Expand description
An APRS callsign with an optional SSID.
The SSID is usually a numeric 0–15 (as in AX.25) but APRS-IS and D-STAR
gateways also use short alphanumeric SSIDs such as -S or -B. Both the
base call and SSID are stored as uppercase ASCII in fixed-size inline
buffers — no heap allocation.
Implementations§
Source§impl Callsign
impl Callsign
Sourcepub fn decode_textual(input: &[u8]) -> Result<Self, AprsError>
pub fn decode_textual(input: &[u8]) -> Result<Self, AprsError>
Parse a textual callsign (e.g. W1AW-9, or a D-STAR K0HRV-S).
Sourcepub fn decode_ax25(bytes: &[u8]) -> Result<(Self, bool), AprsError>
pub fn decode_ax25(bytes: &[u8]) -> Result<(Self, bool), AprsError>
Decode a 7-byte AX.25 address field.
AX.25 stores each character left-shifted by one bit. The SSID byte encodes
the SSID in bits 1–4 and the end-of-address (EOA) flag in bit 0.
Returns (callsign, eoa).
pub fn as_str(&self) -> &str
Sourcepub fn ssid(&self) -> Option<&str>
pub fn ssid(&self) -> Option<&str>
The SSID in textual form (e.g. "9", "S"), or None for no SSID.
Sourcepub fn ssid_numeric(&self) -> Option<u8>
pub fn ssid_numeric(&self) -> Option<u8>
The SSID as a number, if it is numeric (0–15). Returns None for no SSID
or for an alphanumeric (e.g. D-STAR) SSID.
Sourcepub fn encode_textual(&self, out: &mut Vec<u8>)
pub fn encode_textual(&self, out: &mut Vec<u8>)
Write this callsign in textual APRS format.
Sourcepub fn encode_ax25(&self, out: &mut Vec<u8>, eoa: bool)
pub fn encode_ax25(&self, out: &mut Vec<u8>, eoa: bool)
Write this callsign as a 7-byte AX.25 address field.
AX.25 can only represent numeric SSIDs 0–15; an alphanumeric SSID (only valid in textual/APRS-IS form) is encoded as SSID 0.