Skip to main content

ClientRequest

Enum ClientRequest 

Source
pub enum ClientRequest {
Show 20 variants ReadMultipleCoils { unit: UnitIdOrSlaveAddr, address: u16, quantity: u16, }, WriteSingleCoil { unit: UnitIdOrSlaveAddr, address: u16, value: bool, }, WriteMultipleCoils { unit: UnitIdOrSlaveAddr, address: u16, coils: Coils, }, ReadHoldingRegisters { unit: UnitIdOrSlaveAddr, address: u16, quantity: u16, }, ReadInputRegisters { unit: UnitIdOrSlaveAddr, address: u16, quantity: u16, }, WriteSingleRegister { unit: UnitIdOrSlaveAddr, address: u16, value: u16, }, WriteMultipleRegisters { unit: UnitIdOrSlaveAddr, address: u16, values: Vec<u16, { mbus_core::data_unit::common::MAX_PDU_DATA_LEN }>, }, ReadWriteMultipleRegisters { unit: UnitIdOrSlaveAddr, read_address: u16, read_quantity: u16, write_address: u16, write_values: Vec<u16, { mbus_core::data_unit::common::MAX_PDU_DATA_LEN }>, }, MaskWriteRegister { unit: UnitIdOrSlaveAddr, address: u16, and_mask: u16, or_mask: u16, }, ReadDiscreteInputs { unit: UnitIdOrSlaveAddr, address: u16, quantity: u16, }, ReadFifoQueue { unit: UnitIdOrSlaveAddr, address: u16, }, ReadFileRecord { unit: UnitIdOrSlaveAddr, sub_request: SubRequest, }, WriteFileRecord { unit: UnitIdOrSlaveAddr, sub_request: SubRequest, }, ReadDeviceIdentification { unit: UnitIdOrSlaveAddr, read_device_id_code: ReadDeviceIdCode, object_id: ObjectId, }, EncapsulatedInterfaceTransport { unit: UnitIdOrSlaveAddr, mei_type: EncapsulatedInterfaceType, data: Vec<u8, { mbus_core::data_unit::common::MAX_PDU_DATA_LEN }>, }, ReadExceptionStatus { unit: UnitIdOrSlaveAddr, }, Diagnostics { unit: UnitIdOrSlaveAddr, sub_function: DiagnosticSubFunction, data: Vec<u16, { mbus_core::data_unit::common::MAX_PDU_DATA_LEN }>, }, GetCommEventCounter { unit: UnitIdOrSlaveAddr, }, GetCommEventLog { unit: UnitIdOrSlaveAddr, }, ReportServerId { unit: UnitIdOrSlaveAddr, },
}
Expand description

User-supplied parameters for a single Modbus request.

Each variant corresponds to one function code (or a closely related group). The task assigns the transaction id; callers never supply it here.

Variants§

§

ReadMultipleCoils

Read multiple coils (FC 01).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

§address: u16

Starting address.

§quantity: u16

Number of coils to read.

§

WriteSingleCoil

Write a single coil (FC 05).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

§address: u16

Address to write.

§value: bool

Value to write.

§

WriteMultipleCoils

Write multiple coils (FC 15 / 0F).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

§address: u16

Starting address.

§coils: Coils

Coils values to write.

§

ReadHoldingRegisters

Read holding registers (FC 03).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

§address: u16

Starting address.

§quantity: u16

Number of registers to read.

§

ReadInputRegisters

Read input registers (FC 04).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

§address: u16

Starting address.

§quantity: u16

Number of registers to read.

§

WriteSingleRegister

Write a single register (FC 06).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

§address: u16

Address to write.

§value: u16

Value to write.

§

WriteMultipleRegisters

Write multiple registers (FC 16 / 10).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

§address: u16

Starting address.

§values: Vec<u16, { mbus_core::data_unit::common::MAX_PDU_DATA_LEN }>

Register values to write.

§

ReadWriteMultipleRegisters

Read and write multiple registers (FC 23 / 17).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

§read_address: u16

Address to read from.

§read_quantity: u16

Number of registers to read.

§write_address: u16

Address to write to.

§write_values: Vec<u16, { mbus_core::data_unit::common::MAX_PDU_DATA_LEN }>

Register values to write.

§

MaskWriteRegister

Mask write register (FC 22 / 16).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

§address: u16

Address to write.

§and_mask: u16

AND mask to apply.

§or_mask: u16

OR mask to apply.

§

ReadDiscreteInputs

Read discrete inputs (FC 02).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

§address: u16

Starting address.

§quantity: u16

Number of inputs to read.

§

ReadFifoQueue

Read FIFO queue (FC 18).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

§address: u16

FIFO queue address.

§

ReadFileRecord

Read file record (FC 14).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

§sub_request: SubRequest

Sub request details.

§

WriteFileRecord

Write file record (FC 15).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

§sub_request: SubRequest

Sub request details.

§

ReadDeviceIdentification

Read device identification (FC 43/14).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

§read_device_id_code: ReadDeviceIdCode

Read Device ID Code.

§object_id: ObjectId

Object ID to request.

§

EncapsulatedInterfaceTransport

Encapsulated interface transport (FC 43).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

§mei_type: EncapsulatedInterfaceType

MEI Type.

§data: Vec<u8, { mbus_core::data_unit::common::MAX_PDU_DATA_LEN }>

MEI request data.

§

ReadExceptionStatus

Read exception status (FC 07).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

§

Diagnostics

Diagnostics sub-function execution (FC 08).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

§sub_function: DiagnosticSubFunction

Diagnostic sub-function code.

§data: Vec<u16, { mbus_core::data_unit::common::MAX_PDU_DATA_LEN }>

Sub-function data.

§

GetCommEventCounter

Get communication event counter (FC 11 / 0B).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

§

GetCommEventLog

Get communication event log (FC 12 / 0C).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

§

ReportServerId

Report server ID (FC 17 / 11).

Fields

§unit: UnitIdOrSlaveAddr

Unit or slave address of the Modbus device.

Trait Implementations§

Source§

impl Debug for ClientRequest

Source§

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

Formats the value using the given formatter. Read more

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> 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, 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.