Skip to main content

DiagnosticSubFunction

Enum DiagnosticSubFunction 

Source
#[repr(u16)]
pub enum DiagnosticSubFunction {
Show 15 variants ReturnQueryData = 0, RestartCommunicationsOption = 1, ReturnDiagnosticRegister = 2, ChangeAsciiInputDelimiter = 3, ForceListenOnlyMode = 4, ClearCountersAndDiagnosticRegister = 10, ReturnBusMessageCount = 11, ReturnBusCommunicationErrorCount = 12, ReturnBusExceptionErrorCount = 13, ReturnServerMessageCount = 14, ReturnServerNoResponseCount = 15, ReturnServerNakCount = 16, ReturnServerBusyCount = 17, ReturnBusCharacterOverrunCount = 18, ClearOverrunCounterAndFlag = 20,
}
Expand description

Sub-function codes for Function Code 0x08 (Diagnostics).

Serial line only. See Modbus Application Protocol Specification V1.1b3, Section 6.8.

These values are 16-bit and encoded big-endian inside the PDU data field.

Variants§

§

ReturnQueryData = 0

0x0000 — Return Query Data (Loopback test)

§

RestartCommunicationsOption = 1

0x0001 — Restart Communications Option

§

ReturnDiagnosticRegister = 2

0x0002 — Return Diagnostic Register

§

ChangeAsciiInputDelimiter = 3

0x0003 — Change ASCII Input Delimiter

§

ForceListenOnlyMode = 4

0x0004 — Force Listen Only Mode

§

ClearCountersAndDiagnosticRegister = 10

0x000A — Clear Counters and Diagnostic Register

§

ReturnBusMessageCount = 11

0x000B — Return Bus Message Count

§

ReturnBusCommunicationErrorCount = 12

0x000C — Return Bus Communication Error Count

§

ReturnBusExceptionErrorCount = 13

0x000D — Return Bus Exception Error Count

§

ReturnServerMessageCount = 14

0x000E — Return Server Message Count

§

ReturnServerNoResponseCount = 15

0x000F — Return Server No Response Count

§

ReturnServerNakCount = 16

0x0010 — Return Server NAK Count

§

ReturnServerBusyCount = 17

0x0011 — Return Server Busy Count

§

ReturnBusCharacterOverrunCount = 18

0x0012 — Return Bus Character Overrun Count

§

ClearOverrunCounterAndFlag = 20

0x0014 — Clear Overrun Counter and Flag

Implementations§

Source§

impl DiagnosticSubFunction

Source

pub fn to_be_bytes(self) -> [u8; 2]

Converts the DiagnosticSubFunction enum variant into its 2-byte big-endian representation.

Trait Implementations§

Source§

impl Clone for DiagnosticSubFunction

Source§

fn clone(&self) -> DiagnosticSubFunction

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DiagnosticSubFunction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<DiagnosticSubFunction> for u16

Source§

fn from(sub_func: DiagnosticSubFunction) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for DiagnosticSubFunction

Source§

fn eq(&self, other: &DiagnosticSubFunction) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<u16> for DiagnosticSubFunction

Source§

type Error = MbusError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u16) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Copy for DiagnosticSubFunction

Source§

impl Eq for DiagnosticSubFunction

Source§

impl StructuralPartialEq for DiagnosticSubFunction

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.