Struct wte_mt_rx_parser::mt_structured::MtStructured
source · pub struct MtStructured {Show 16 fields
pub header: String,
pub id: String,
pub sequence_number: usize,
pub message_type: char,
pub format_flag: char,
pub beacon: [u8; 15],
pub signal_strength: [char; 2],
pub lat_degrees: u8,
pub lat_minutes: u8,
pub lat_seconds: u8,
pub n: char,
pub long_degrees: u16,
pub long_minutes: u8,
pub long_seconds: u8,
pub w: char,
pub checksum: u16,
}Expand description
MT Serial Out Packet Format.
Fields§
§header: StringHeader, should be MT1.
id: StringUUU - Three character MT-RX configurable ID – by default this is 001.
sequence_number: usizeNNN - Three decimal digit cycling packet sequence number from 000 to 511. This sequence number
message_type: charT - Single character message type ‘T’ or ‘A’ (test or distress alert)
format_flag: charF - Single character format flag S or L (short or long) – this relates to the 406 beacon transmission specification.
beacon: [u8; 15]15 character hex code used to define beacon owner and beacon capabilities as per the 406 beacon specification.
signal_strength: [char; 2]SS - Two character signal strength indication – 00 if not used.
lat_degrees: u811 - Two decimal character latitude degrees.
lat_minutes: u822 - Two decimal character latitude minutes.
lat_seconds: u833 - Two decimal character latitude seconds.
n: charN - is N or S.
long_degrees: u16444 - Three decimal character longitude degrees.
long_minutes: u822 - Two decimal character longitude minutes.
long_seconds: u855 - Two decimal character longitude seconds.
w: charW - is W or E.
checksum: u16YYYY - Four character checksum (calculated from M – the first character). If all location characters are ‘-’ then there is no location information available.
Implementations§
source§impl MtStructured
impl MtStructured
sourcepub fn is_mt(message: &str) -> bool
pub fn is_mt(message: &str) -> bool
Returns whether message is a valid MT(1) message.
§Examples
use wte_mt_rx_parser::mt_structured::MtStructured;
println!("is it MT1? {}", MtStructured::is_mt("MT1001000AL400C592753572B323433212S1723756E4706"));sourcepub fn parse(message: &str) -> Result<MtStructured, ParseError>
pub fn parse(message: &str) -> Result<MtStructured, ParseError>
Tries to parse a “MT Serial Out Packet Format” message.
§Notes
- Checksum is not calculated here.
§Examples
use wte_mt_rx_parser::mt_structured::MtStructured;
let parsed = MtStructured::parse("MT1001000AL400C592753572B323433212S1723756E4706").unwrap();
// ...§Message format
Data provided should be in the following format:
MT1UUUNNNTFHHHHHHHHHHHHHHHSS112233N4445566WYYYY
Trait Implementations§
source§impl Clone for MtStructured
impl Clone for MtStructured
source§fn clone(&self) -> MtStructured
fn clone(&self) -> MtStructured
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for MtStructured
impl Debug for MtStructured
source§impl PartialEq for MtStructured
impl PartialEq for MtStructured
source§fn eq(&self, other: &MtStructured) -> bool
fn eq(&self, other: &MtStructured) -> bool
self and other values to be equal, and is used
by ==.impl StructuralPartialEq for MtStructured
Auto Trait Implementations§
impl Freeze for MtStructured
impl RefUnwindSafe for MtStructured
impl Send for MtStructured
impl Sync for MtStructured
impl Unpin for MtStructured
impl UnwindSafe for MtStructured
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)