pub struct KissSession<T: Transport> { /* private fields */ }Expand description
A KISS TNC session that owns the radio transport.
While this session is active, the serial port speaks KISS binary framing
instead of ASCII CAT commands. The Radio is consumed on entry and
returned on exit.
§KISS commands supported by TH-D75
| Command | Code | Range | Default |
|---|---|---|---|
| Data Frame | 0x00 | AX.25 payload | — |
| TX Delay | 0x01 | 0-120 (10 ms units) | Menu 508 |
| Persistence | 0x02 | 0-255 | 128 |
| Slot Time | 0x03 | 0-250 (10 ms units) | 10 |
| TX Tail | 0x04 | 0-255 | 3 |
| Full Duplex | 0x05 | 0=half, nonzero=full | 0 |
| Set Hardware | 0x06 | 0/0x23=1200, 0x05/0x26=9600 | Menu 505 |
| Return | 0xFF | — | — |
Implementations§
Source§impl<T: Transport> KissSession<T>
impl<T: Transport> KissSession<T>
Sourcepub const fn set_receive_timeout(&mut self, duration: Duration)
pub const fn set_receive_timeout(&mut self, duration: Duration)
Set the timeout for receive_frame operations.
Defaults to 10 seconds. Set higher for quiet channels.
Sourcepub async fn send_wire(&mut self, wire: &[u8]) -> Result<(), Error>
pub async fn send_wire(&mut self, wire: &[u8]) -> Result<(), Error>
Write pre-encoded KISS wire bytes directly to the transport.
Use this when you already have a fully KISS-encoded frame (e.g.,
from build_aprs_message or
AprsMessenger::next_frame_to_send).
Unlike send_frame and
send_data, this does not perform any
additional encoding.
§Errors
Returns Error::Transport if the write fails.
Sourcepub async fn send_frame(&mut self, frame: &KissFrame) -> Result<(), Error>
pub async fn send_frame(&mut self, frame: &KissFrame) -> Result<(), Error>
Send a KISS frame to the TNC.
The frame is KISS-encoded (with FEND delimiters and byte stuffing) before transmission.
§Errors
Returns Error::Transport if the write fails.
Sourcepub async fn receive_frame(&mut self) -> Result<KissFrame, Error>
pub async fn receive_frame(&mut self) -> Result<KissFrame, Error>
Receive a KISS frame from the TNC.
Blocks until a complete KISS frame is received or the receive timeout expires. Accumulates bytes from the transport and extracts frames delimited by FEND bytes.
§Errors
Returns Error::Timeout if no complete frame arrives within the
configured receive timeout.
Returns Error::Transport if the read fails.
Sourcepub async fn set_tx_delay(&mut self, tens_of_ms: u8) -> Result<(), Error>
pub async fn set_tx_delay(&mut self, tens_of_ms: u8) -> Result<(), Error>
Set the TNC TX delay (KISS command 0x01).
The value is in units of 10 ms. The TH-D75 supports 0-120 (0 ms to 1200 ms). The default is configured via Menu No. 508.
§Errors
Returns Error::Transport if the write fails.
Sourcepub async fn set_persistence(&mut self, value: u8) -> Result<(), Error>
pub async fn set_persistence(&mut self, value: u8) -> Result<(), Error>
Set the CSMA persistence parameter (KISS command 0x02).
Range 0-255. The probability of transmitting when the channel is
clear is (persistence + 1) / 256. Default: 128 (50%).
§Errors
Returns Error::Transport if the write fails.
Sourcepub async fn set_slot_time(&mut self, tens_of_ms: u8) -> Result<(), Error>
pub async fn set_slot_time(&mut self, tens_of_ms: u8) -> Result<(), Error>
Set the CSMA slot time (KISS command 0x03).
The value is in units of 10 ms. Range 0-250. Default: 10 (100 ms).
§Errors
Returns Error::Transport if the write fails.
Sourcepub async fn set_tx_tail(&mut self, tens_of_ms: u8) -> Result<(), Error>
pub async fn set_tx_tail(&mut self, tens_of_ms: u8) -> Result<(), Error>
Set the TX tail time (KISS command 0x04).
The value is in units of 10 ms. Range 0-255. Default: 3 (30 ms).
§Errors
Returns Error::Transport if the write fails.
Sourcepub async fn set_full_duplex(&mut self, full_duplex: bool) -> Result<(), Error>
pub async fn set_full_duplex(&mut self, full_duplex: bool) -> Result<(), Error>
Set full or half duplex mode (KISS command 0x05).
true = full duplex, false = half duplex (default).
§Errors
Returns Error::Transport if the write fails.
Sourcepub async fn set_hardware_baud(&mut self, baud_1200: bool) -> Result<(), Error>
pub async fn set_hardware_baud(&mut self, baud_1200: bool) -> Result<(), Error>
Switch the TNC data speed via KISS hardware command (0x06).
On the TH-D75, true = 1200 bps (AFSK), false = 9600 bps (GMSK).
The hardware command values are: 0 or 0x23 for 1200, 0x05 or 0x26
for 9600.
§Errors
Returns Error::Transport if the write fails.