Trait ModbusClient

Source
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§

Source

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)

Source

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)

Source

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)

Source

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)

Source

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)

Source

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)

Source

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)

Source

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)

Source

fn is_connected(&self) -> bool

Check if client is connected

Source

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

Source

fn get_stats(&self) -> TransportStats

Get transport statistics

Implementors§