Skip to main content

pamoja_modbus_server_answer

Function pamoja_modbus_server_answer 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_modbus_server_answer( server: *const PamojaModbusServer, frame: *const u8, len: usize, out_buffer: *mut *mut PamojaBuffer, ) -> PamojaStatus
Expand description

Answers one RTU frame, as the device on the line does.

§Arguments

  • server - the device.
  • frame - the frame as it came off the line, CRC included.
  • len - its length.
  • out_buffer - receives the frame to send back, or null when the device stays silent: the frame failed its CRC, is for another unit, or is a broadcast, whose write the device still carries out.

§Returns

PamojaStatus::Ok, or PamojaStatus::InvalidArgument for a null argument.

§Safety

server must be a live handle or null, frame must point to len readable bytes, and out_buffer must be a writable pointer or null. A returned buffer is the caller’s to release with pamoja_buffer_free.