pub trait ModbusClient: Send + Sync {
// Required methods
fn read_coils<'life0, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
quantity: u16,
) -> Pin<Box<dyn Future<Output = ModbusResult<Vec<bool>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn read_discrete_inputs<'life0, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
quantity: u16,
) -> Pin<Box<dyn Future<Output = ModbusResult<Vec<bool>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn read_holding_registers<'life0, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
quantity: u16,
) -> Pin<Box<dyn Future<Output = ModbusResult<Vec<u16>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn read_input_registers<'life0, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
quantity: u16,
) -> Pin<Box<dyn Future<Output = ModbusResult<Vec<u16>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn write_single_coil<'life0, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
value: bool,
) -> Pin<Box<dyn Future<Output = ModbusResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn write_single_register<'life0, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
value: u16,
) -> Pin<Box<dyn Future<Output = ModbusResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn write_multiple_coils<'life0, 'life1, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
values: &'life1 [bool],
) -> Pin<Box<dyn Future<Output = ModbusResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn write_multiple_registers<'life0, 'life1, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
values: &'life1 [u16],
) -> Pin<Box<dyn Future<Output = ModbusResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn is_connected(&self) -> bool;
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = ModbusResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_stats(&self) -> TransportStats;
}Expand description
High-level Modbus client trait
Required Methods§
Sourcefn read_coils<'life0, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
quantity: u16,
) -> Pin<Box<dyn Future<Output = ModbusResult<Vec<bool>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_coils<'life0, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
quantity: u16,
) -> Pin<Box<dyn Future<Output = ModbusResult<Vec<bool>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Read coils (function code 0x01)
Sourcefn read_discrete_inputs<'life0, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
quantity: u16,
) -> Pin<Box<dyn Future<Output = ModbusResult<Vec<bool>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_discrete_inputs<'life0, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
quantity: u16,
) -> Pin<Box<dyn Future<Output = ModbusResult<Vec<bool>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Read discrete inputs (function code 0x02)
Sourcefn read_holding_registers<'life0, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
quantity: u16,
) -> Pin<Box<dyn Future<Output = ModbusResult<Vec<u16>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_holding_registers<'life0, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
quantity: u16,
) -> Pin<Box<dyn Future<Output = ModbusResult<Vec<u16>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Read holding registers (function code 0x03)
Sourcefn read_input_registers<'life0, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
quantity: u16,
) -> Pin<Box<dyn Future<Output = ModbusResult<Vec<u16>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_input_registers<'life0, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
quantity: u16,
) -> Pin<Box<dyn Future<Output = ModbusResult<Vec<u16>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Read input registers (function code 0x04)
Sourcefn write_single_coil<'life0, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
value: bool,
) -> Pin<Box<dyn Future<Output = ModbusResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn write_single_coil<'life0, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
value: bool,
) -> Pin<Box<dyn Future<Output = ModbusResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Write single coil (function code 0x05)
Sourcefn write_single_register<'life0, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
value: u16,
) -> Pin<Box<dyn Future<Output = ModbusResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn write_single_register<'life0, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
value: u16,
) -> Pin<Box<dyn Future<Output = ModbusResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Write single register (function code 0x06)
Sourcefn write_multiple_coils<'life0, 'life1, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
values: &'life1 [bool],
) -> Pin<Box<dyn Future<Output = ModbusResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_multiple_coils<'life0, 'life1, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
values: &'life1 [bool],
) -> Pin<Box<dyn Future<Output = ModbusResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Write multiple coils (function code 0x0F)
Sourcefn write_multiple_registers<'life0, 'life1, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
values: &'life1 [u16],
) -> Pin<Box<dyn Future<Output = ModbusResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_multiple_registers<'life0, 'life1, 'async_trait>(
&'life0 mut self,
slave_id: SlaveId,
address: u16,
values: &'life1 [u16],
) -> Pin<Box<dyn Future<Output = ModbusResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Write multiple registers (function code 0x10)
Sourcefn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Check if client is connected
Sourcefn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = ModbusResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = ModbusResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Close the client connection
Sourcefn get_stats(&self) -> TransportStats
fn get_stats(&self) -> TransportStats
Get transport statistics