Struct KissFrame
pub struct KissFrame {
pub port: u8,
pub command: u8,
pub data: Vec<u8>,
}Expand description
A decoded KISS frame.
The type indicator byte is split into port (high nibble) and
command (low nibble). For the TH-D75, port is always 0. Typed
accessors are available via Self::port_typed and
Self::command_typed.
Fields§
§port: u8TNC port number (high nibble of type byte). Always 0 for TH-D75.
command: u8KISS command (low nibble of type byte).
data: Vec<u8>Frame payload (e.g. AX.25 frame for data commands).
Implementations§
§impl KissFrame
impl KissFrame
pub const fn port_typed(&self) -> Option<KissPort>
pub const fn port_typed(&self) -> Option<KissPort>
Return the port as a validated [KissPort] newtype.
Returns None if the stored port is outside the nibble range
(should never happen for frames produced by [decode_kiss_frame]).
pub const fn command_typed(&self) -> Option<KissCommand>
pub const fn command_typed(&self) -> Option<KissCommand>
Return the command as a typed [KissCommand] if recognised.
pub const fn with_typed(
port: KissPort,
command: KissCommand,
data: Vec<u8>,
) -> KissFrame
pub const fn with_typed( port: KissPort, command: KissCommand, data: Vec<u8>, ) -> KissFrame
Build a new frame with typed parameters.
Convenience constructor equivalent to setting port and
command via their raw-byte equivalents.
pub const fn return_command() -> KissFrame
pub const fn return_command() -> KissFrame
Build a KISS Return frame (exit command, 0xFF).