Skip to main content

pamoja_modbus_client_read_coils

Function pamoja_modbus_client_read_coils 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_modbus_client_read_coils( client: *const PamojaModbusClient, unit: u8, start: u16, quantity: u16, out_values: *mut u8, out_error: *mut PamojaModbusClientError, ) -> PamojaStatus
Expand description

Reads coils, function 0x01.

§Arguments

  • client - the client.
  • unit - the device, 1 to 247.
  • start - the first coil’s address.
  • quantity - how many, 1 to 2000.
  • out_values - receives one byte per coil, 1 for on, in address order.
  • out_error - receives why the call failed, or null.

§Returns

PamojaStatus::Ok; PamojaStatus::InvalidArgument for a request that cannot be sent; PamojaStatus::Io for a port failure or a timeout; PamojaStatus::Codec for a reply that fails its checks; or PamojaStatus::Other for the device’s exception. The reason is in the last error message and, in detail, in out_error.

§Safety

client must be a live handle or null, out_values must point to quantity writable bytes, and out_error must be a writable pointer or null.