Struct can_type_rs::j1939::Pgn
source · pub struct Pgn(/* private fields */);Expand description
Bitfield representation of 18-bit Parameter Group Number (PGN).
§Repr: u32
| Field | Size (bits) |
|---|---|
| Padding bits (private) | 14 |
| Reserved bits | 1 |
| Data page bits | 1 |
| PDU format bits | 8 |
| PDU specific bits | 8 |
Implementations§
source§impl Pgn
impl Pgn
sourcepub const fn pdu_format(&self) -> PduFormat
pub const fn pdu_format(&self) -> PduFormat
Returns the PDU format based on the parsed bits.
§Returns
PduFormat::Pdu1(bits)if the PDU format value is less than 240.PduFormat::Pdu2(bits)otherwise.
sourcepub const fn group_extension(&self) -> GroupExtension
pub const fn group_extension(&self) -> GroupExtension
Returns the group extension based on the parsed bits.
§Returns
GroupExtension::Noneif the PDU format isPdu1.GroupExtension::Some(bits)if the PDU format isPdu2.
sourcepub const fn destination_address(&self) -> DestinationAddress
pub const fn destination_address(&self) -> DestinationAddress
Returns the destination address based on the parsed PDU format.
§Returns
DestinationAddress::Some(bits)if the PDU format isPdu1.DestinationAddress::Noneif the PDU format isPdu2.
sourcepub const fn communication_mode(&self) -> CommunicationMode
pub const fn communication_mode(&self) -> CommunicationMode
Returns the communication mode based on the parsed PDU format.
§Returns
CommunicationMode::P2Pif the PDU format isPdu1.CommunicationMode::Broadcastif the PDU format isPdu2.
sourcepub const fn is_p2p(&self) -> bool
pub const fn is_p2p(&self) -> bool
Checks if the communication mode is point-to-point (P2P).
§Returns
trueif the communication mode isP2P.falseif the communication mode isBroadcast.
sourcepub const fn is_broadcast(&self) -> bool
pub const fn is_broadcast(&self) -> bool
Checks if the communication mode is broadcast.
§Returns
trueif the communication mode isBroadcast.falseif the communication mode isP2P.
sourcepub fn pdu_assignment(&self) -> PduAssignment
pub fn pdu_assignment(&self) -> PduAssignment
Determines the PDU assignment based on the parsed bits.
§Returns
PduAssignment::Sae(bits)for known SAE-defined PDU assignments.PduAssignment::Manufacturer(bits)for manufacturer-defined PDU assignments.PduAssignment::Unknown(bits)for unrecognized PDU assignments.
Trait Implementations§
source§impl Conversion for Pgn
impl Conversion for Pgn
impl Copy for Pgn
impl Eq for Pgn
impl StructuralPartialEq for Pgn
Auto Trait Implementations§
impl Freeze for Pgn
impl RefUnwindSafe for Pgn
impl Send for Pgn
impl Sync for Pgn
impl Unpin for Pgn
impl UnwindSafe for Pgn
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
Mutably borrows from an owned value. Read more
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)