Skip to main content

Crate frap

Crate frap 

Source
Expand description

A pure Rust parser and encoder for APRS packets.

FRAP is a Rust port of Ham::APRS::FAP. It parses TNC2/APRS-IS packets from UTF-8 strings or raw byte slices without native dependencies. The original bytes are retained even when a payload contains text that is not valid UTF-8.

§Parsing

parse returns an owned Packet. Its Packet::body is a PacketBody variant describing the concrete APRS information field.

use frap::{PacketBody, parse};

let packet = parse("2W0FWJ>APRS:>FRAP example")?;
assert_eq!(packet.source, "2W0FWJ");
assert!(matches!(packet.body, PacketBody::Status { .. }));

Use parse_ref on hot paths to borrow envelope fields from the input. Call PacketRef::into_owned when the packet must outlive that input. ParseOptions enables strict AX.25 validation and damaged Mic-E recovery.

§Encoding and utilities

The crate encodes messages, objects, positions, and timestamps. It also provides KISS/TNC2 conversion, duplicate-detection helpers, geographic calculations, callsign validation, and APRS-IS passcode calculation.

§Optional APRS-IS client

Enable the aprs-is feature to expose AprsIsConnection, an asynchronous Tokio-based APRS-IS client. Parsing itself does not require an async runtime.

Structs§

AprsIsConnectionaprs-is
An asynchronous APRS-IS connection.
AprsTimestamp
A decoded APRS timestamp.
Digipeater
An owned digipeater path component.
DigipeaterRef
A digipeater path component that may borrow its callsign from the input.
EncodeObjectOptions
Options controlling APRS object information-field encoding.
EncodePositionOptions
Options controlling APRS position information-field encoding.
Message
An APRS message or telemetry metadata message.
Packet
Fully owned parsed APRS packet.
PacketRef
Parsed APRS packet borrowing envelope fields from its input where possible.
ParseError
A parse error with a stable code and a specific explanation.
ParseOptions
Options controlling parser validation and compatibility recovery.
PositionReport
Position-related data shared by locations, objects, and items.
Telemetry
Decoded APRS telemetry values.
Weather
Decoded APRS weather measurements.

Enums§

ErrorCode
Stable, machine-readable parse failure categories.
Format
Position encoding found in an APRS packet.
PacketBody
Parsed APRS information field, represented by its concrete wire type.
PacketType
High-level APRS packet classification.
TimestampFormat
APRS timestamp representation produced by encode_timestamp.

Functions§

aprs_duplicate_parts
Extract the innermost source, destination base call, and payload used for APRS duplicate detection.
aprs_passcode
Compute the APRS-IS authentication passcode for a callsign.
check_ax25_call
Validate and normalize an AX.25 callsign (CALL or CALL-SSID).
count_digihops
Estimate the number of digipeated hops represented by a TNC2 header.
direction
Initial bearing in degrees from the first position to the second.
distance
Great-circle distance in kilometres between two decimal-degree positions.
encode_message
Encode an APRS message information field.
encode_object
Encode an APRS object information field.
encode_position
Encode an APRS position information field.
encode_timestamp
Create a UTC APRS timestamp from Unix seconds.
kiss_to_tnc2
Convert a single-port KISS data frame to a TNC2 UI frame.
make_object
FAP-compatible name for encode_object.
make_position
FAP-compatible name for encode_position.
make_timestamp
FAP-compatible name for encode_timestamp.
mice_mbits_to_message
FAP-compatible name for mice_message. Convert Mic-E message bits to their standard status text.
mice_message
Convert Mic-E message bits to their standard status text.
parse
Parse a TNC2/APRS-IS packet into an owned Packet.
parse_ref
Parse a packet while borrowing input-backed fields whenever possible.
parse_ref_with_options
Parse a borrowed packet with explicit parser options.
parse_with_options
Parse a TNC2/APRS-IS packet into an owned Packet using options.
tnc2_to_kiss
Convert a TNC2 UI frame to a complete single-port KISS data frame.