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
SubRequestParamsentry reflects one returned record chunk. - Per Modbus spec, the response does not echo
file_numberorrecord_number; those fields are therefore reported as0in callback data and should not be used as identity.
Required Methods§
Sourcefn read_file_record_response(
&mut self,
txn_id: u16,
unit_id_slave_addr: UnitIdOrSlaveAddr,
data: &[SubRequestParams],
)
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 tcpslave_addr: if transport is serial
data: A slice containing the sub-request responses. Note thatfile_numberandrecord_number
are not returned by the server in the response PDU and will be set to 0 in the parameters.
Sourcefn write_file_record_response(
&mut self,
txn_id: u16,
unit_id_slave_addr: UnitIdOrSlaveAddr,
)
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 tcpslave_addr: if transport is serial