Skip to main content

FileRecordResponse

Trait FileRecordResponse 

Source
pub trait FileRecordResponse {
    // Required methods
    fn read_file_record_response(
        &mut self,
        txn_id: u16,
        unit_id_slave_addr: UnitIdOrSlaveAddr,
        data: &[SubRequestParams],
    );
    fn write_file_record_response(
        &mut self,
        txn_id: u16,
        unit_id_slave_addr: UnitIdOrSlaveAddr,
    );
}
Expand description

Trait defining the expected response handling for File Record Modbus operations.

§When Each Callback Is Fired

  • read_file_record_response: after successful FC 0x14 response parsing.
  • write_file_record_response: after successful FC 0x15 acknowledgement.

§Data Semantics

  • For read responses, each SubRequestParams entry reflects one returned record chunk.
  • Per Modbus spec, the response does not echo file_number or record_number; those fields are therefore reported as 0 in callback data and should not be used as identity.

Required Methods§

Source

fn read_file_record_response( &mut self, txn_id: u16, unit_id_slave_addr: UnitIdOrSlaveAddr, data: &[SubRequestParams], )

Handles a Read File Record response.

§Parameters
  • txn_id: Transaction ID of the original request. While Modbus Serial (RTU/ASCII) does not natively use transaction IDs, the stack preserves the ID provided in the request and returns it here to allow for asynchronous tracking.
  • unit_id_slave_addr: The target Modbus unit ID or slave address.
    • unit_id: if transport is tcp
    • slave_addr: if transport is serial
  • data: A slice containing the sub-request responses. Note that file_number and record_number

are not returned by the server in the response PDU and will be set to 0 in the parameters.

Source

fn write_file_record_response( &mut self, txn_id: u16, unit_id_slave_addr: UnitIdOrSlaveAddr, )

Handles a Write File Record response, confirming the write was successful.

§Parameters
  • txn_id: Transaction ID of the original request. While Modbus Serial (RTU/ASCII) does not natively use transaction IDs, the stack preserves the ID provided in the request and returns it here to allow for asynchronous tracking.
  • unit_id_slave_addr: The target Modbus unit ID or slave address.
    • unit_id: if transport is tcp
    • slave_addr: if transport is serial

Implementors§