Trait libmodbus_rs::ModbusClient
[−]
[src]
pub trait ModbusClient { fn read_bits(
&self,
address: u16,
num: u16,
dest: &mut [u8]
) -> Result<u16, Error>; fn read_input_bits(
&self,
address: u16,
num: u16,
dest: &mut [u8]
) -> Result<u16, Error>; fn read_registers(
&self,
address: u16,
num: u16,
dest: &mut [u16]
) -> Result<u16, Error>; fn read_input_registers(
&self,
address: u16,
num: u16,
dest: &mut [u16]
) -> Result<u16, Error>; fn report_slave_id(
&self,
max_dest: usize,
dest: &mut [u8]
) -> Result<u16, Error>; fn write_bit(&self, address: u16, status: bool) -> Result<(), Error>; fn write_bits(
&self,
address: u16,
num: u16,
src: &[u8]
) -> Result<u16, Error>; fn write_register(&self, address: u16, value: u16) -> Result<(), Error>; fn write_registers(
&self,
address: u16,
num: u16,
src: &[u16]
) -> Result<u16, Error>; fn write_and_read_registers(
&self,
write_address: u16,
write_num: u16,
src: &[u16],
read_address: u16,
read_num: u16,
dest: &mut [u16]
) -> Result<u16, Error>; fn mask_write_register(
&self,
address: u16,
and_mask: u16,
or_mask: u16
) -> Result<(), Error>; fn send_raw_request(
&self,
raw_request: &mut [u8],
lenght: usize
) -> Result<u16, Error>; fn receive_confirmation(&self, response: &mut [u8]) -> Result<u16, Error>; }
The Modbus protocol defines different data types and functions to read and write them from/to remote devices. The following functions are used by the clients to send Modbus requests:
- Read data
- Write data
- Write and read data
- Raw requests
- Reply an exception
Required Methods
fn read_bits(
&self,
address: u16,
num: u16,
dest: &mut [u8]
) -> Result<u16, Error>
&self,
address: u16,
num: u16,
dest: &mut [u8]
) -> Result<u16, Error>
fn read_input_bits(
&self,
address: u16,
num: u16,
dest: &mut [u8]
) -> Result<u16, Error>
&self,
address: u16,
num: u16,
dest: &mut [u8]
) -> Result<u16, Error>
fn read_registers(
&self,
address: u16,
num: u16,
dest: &mut [u16]
) -> Result<u16, Error>
&self,
address: u16,
num: u16,
dest: &mut [u16]
) -> Result<u16, Error>
fn read_input_registers(
&self,
address: u16,
num: u16,
dest: &mut [u16]
) -> Result<u16, Error>
&self,
address: u16,
num: u16,
dest: &mut [u16]
) -> Result<u16, Error>
fn report_slave_id(
&self,
max_dest: usize,
dest: &mut [u8]
) -> Result<u16, Error>
&self,
max_dest: usize,
dest: &mut [u8]
) -> Result<u16, Error>
fn write_bit(&self, address: u16, status: bool) -> Result<(), Error>
fn write_bits(&self, address: u16, num: u16, src: &[u8]) -> Result<u16, Error>
fn write_register(&self, address: u16, value: u16) -> Result<(), Error>
fn write_registers(
&self,
address: u16,
num: u16,
src: &[u16]
) -> Result<u16, Error>
&self,
address: u16,
num: u16,
src: &[u16]
) -> Result<u16, Error>
fn write_and_read_registers(
&self,
write_address: u16,
write_num: u16,
src: &[u16],
read_address: u16,
read_num: u16,
dest: &mut [u16]
) -> Result<u16, Error>
&self,
write_address: u16,
write_num: u16,
src: &[u16],
read_address: u16,
read_num: u16,
dest: &mut [u16]
) -> Result<u16, Error>
fn mask_write_register(
&self,
address: u16,
and_mask: u16,
or_mask: u16
) -> Result<(), Error>
&self,
address: u16,
and_mask: u16,
or_mask: u16
) -> Result<(), Error>
fn send_raw_request(
&self,
raw_request: &mut [u8],
lenght: usize
) -> Result<u16, Error>
&self,
raw_request: &mut [u8],
lenght: usize
) -> Result<u16, Error>
fn receive_confirmation(&self, response: &mut [u8]) -> Result<u16, Error>
Implementors
impl ModbusClient for Modbus