Struct sawp_modbus::Message[][src]

pub struct Message {
    pub transaction_id: u16,
    pub protocol_id: u16,
    pub unit_id: u8,
    pub function: Function,
    pub access_type: Flags<AccessType>,
    pub category: Flags<CodeCategory>,
    pub data: Data,
    pub error_flags: Flags<ErrorFlags>,
    // some fields omitted
}

Breakdown of the parsed modbus bytes

Fields

transaction_id: u16protocol_id: u16unit_id: u8function: Functionaccess_type: Flags<AccessType>category: Flags<CodeCategory>data: Dataerror_flags: Flags<ErrorFlags>

Implementations

impl Message[src]

pub fn matches(&mut self, other: &Message) -> bool[src]

Matches this message with another. Used to validate requests with responses.

pub fn get_write_value_at_address(&self, address: &u16) -> Option<u16>[src]

Gets the register/coil/input value at the given address, if it has been modified in the transaction. Returns the value as Some(u16) if it is found, otherwise returns None. The address passed in must be offset by 1 to reflect the actual coil/register and not the address found in the PDU. See the protocol reference for more information on addresses.

pub fn get_address_range(&self) -> Option<RangeInclusive<u16>>[src]

Gets the address and quantity in the read/write data. If the data does not match and they can’t be found, None is returned. The range returned is offset by 1 to account to reflect the coils/registers that start at 1 instead of in the PDU numbers where they start at 0. More details can be found in the protocol reference

Trait Implementations

impl Debug for Message[src]

impl PartialEq<Message> for Message[src]

impl StructuralPartialEq for Message[src]

Auto Trait Implementations

impl RefUnwindSafe for Message

impl Send for Message

impl Sync for Message

impl Unpin for Message

impl UnwindSafe for Message

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.