canboat_rs/pgns/
pgn_list_transmit_and_receive.rs1use crate::nmea_option::NmeaOption;
2use crate::pgn_types::PgnType;
3pub const LENGTH: usize = 1usize;
4pub const PGN: u32 = 126464u32;
5#[derive(Debug)]
6pub enum FunctionCode {
7 TransmitPGNlist,
8 ReceivePGNlist,
9}
10impl bitfield::Into<u8> for FunctionCode {
11 fn into(self) -> u8 {
12 match self {
13 Self::TransmitPGNlist => 0u8,
14 Self::ReceivePGNlist => 1u8,
15 }
16 }
17}
18impl bitfield::Into<NmeaOption<FunctionCode>> for u8 {
19 fn into(self) -> NmeaOption<FunctionCode> {
20 match self {
21 0u8 => NmeaOption::Some(FunctionCode::TransmitPGNlist),
22 1u8 => NmeaOption::Some(FunctionCode::ReceivePGNlist),
23 _ => NmeaOption::None,
24 }
25 }
26}
27use bitfield::bitfield;
28bitfield! {
29 #[doc = "PGN List (Transmit and Receive)"] pub struct
30 PgnListTransmitAndReceive([u8]); impl Debug; u32; pub u8, from into NmeaOption <
31 FunctionCode >, function_code, _ : 7usize, 0usize; pub pgn, _ : 31usize, 8usize;
32}
33impl PgnListTransmitAndReceive<&[u8]> {
34 pub fn is_match(&self, pgn: u32) -> bool {
35 126464u32 == pgn
36 }
37 pub fn get_pgn() -> u32 {
38 126464u32
39 }
40 pub fn get_message_type() -> PgnType {
41 PgnType::Fast
42 }
43}