Skip to main content

encode_frame

Function encode_frame 

Source
pub fn encode_frame(
    prefix: char,
    talker: &str,
    sentence_type: &str,
    fields: &[&str],
) -> String
Expand description

Encode fields into a valid NMEA 0183 sentence string.

Computes XOR checksum and appends *XX\r\n.

ยงExamples

use nmea_kit::encode_frame;

let sentence = encode_frame('$', "WI", "MWD", &["270.0", "T", "268.5", "M", "12.4", "N", "6.4", "M"]);
assert!(sentence.starts_with("$WIMWD,"));
assert!(sentence.ends_with("\r\n"));