Module client

Module client 

Source
Expand description

Integrated APRS client for the TH-D75.

Combines KISS session management, position beaconing (SmartBeaconing), reliable messaging (ack/retry via AprsMessenger), station tracking (StationList), and optional digipeater forwarding (DigipeaterConfig) into a single, easy-to-use async interface.

§Design

The AprsClient owns a KissSession and therefore the radio transport. Create it with AprsClient::start, which enters KISS mode, and tear it down with AprsClient::stop, which exits KISS mode and returns the Radio for other use. This is the same ownership pattern used by KissSession and MmdvmSession.

The main loop calls AprsClient::next_event repeatedly. Each call performs one cycle of I/O: send pending retries and beacons, receive an incoming packet (with a short timeout), parse it, update the station list, auto-ack if configured, and return a typed AprsEvent.

§Example

use kenwood_thd75::{Radio, AprsClient, AprsClientConfig};
use kenwood_thd75::transport::SerialTransport;

let transport = SerialTransport::open("/dev/cu.usbmodem1234", 115_200)?;
let radio = Radio::connect(transport).await?;

let config = AprsClientConfig::new("N0CALL", 7);
let mut client = AprsClient::start(radio, config).await.map_err(|(_, e)| e)?;

// Send a message
client.send_message("KQ4NIT", "Hello!").await?;

// Beacon position
client.beacon_position(35.25, -97.75, "On the road").await?;

// Process incoming packets (call in a loop)
while let Some(event) = client.next_event().await? {
    match event {
        kenwood_thd75::AprsEvent::StationHeard(entry) => {
            println!("Heard: {}", entry.callsign);
        }
        kenwood_thd75::AprsEvent::MessageReceived(msg) => {
            println!("Msg: {}", msg.text);
        }
        kenwood_thd75::AprsEvent::MessageDelivered(id) => {
            println!("Delivered: {id}");
        }
        kenwood_thd75::AprsEvent::MessageExpired(id) => {
            println!("Failed: {id}");
        }
        _ => {}
    }
}

// Clean shutdown — exits KISS mode, returns Radio for other use
let _radio = client.stop().await?;

Structs§

AprsClient
Complete APRS client for the TH-D75.
AprsClientConfig
Configuration for an AprsClient session.
AprsClientConfigBuilder
Fluent builder for AprsClientConfig.

Enums§

AprsEvent
An event produced by AprsClient::next_event.