Module kiss_session

Module kiss_session 

Source
Expand description

KISS TNC session management for the TH-D75.

When the radio enters KISS mode (via TN 2,x), the serial port switches from ASCII CAT commands to binary KISS framing. CAT commands cannot be used until KISS mode is exited. The KissSession type enforces this at the type level: creating one consumes the Radio, and exiting returns it.

§Example

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

// Enter KISS mode (consumes the Radio).
let mut kiss = radio.enter_kiss(TncBaud::Bps1200).await.map_err(|(_, e)| e)?;

// Send and receive KISS frames.
use kiss_tnc::{KissFrame, CMD_DATA};
let frame = KissFrame { port: 0, command: CMD_DATA, data: vec![/* AX.25 */ ] };
kiss.send_frame(&frame).await?;

// Exit KISS mode (returns the Radio).
let radio = kiss.exit().await?;

Structs§

KissSession
A KISS TNC session that owns the radio transport.