Returns a description of the controller
int modbus_report_slave_id(modbus_t *ctx, uint8_t *dest);
The modbus_report_slave_id() function shall send a request to the controller to obtain a description of the controller.
The response stored in dest contains:
the byte count of the response
the slave ID, this unique ID is in reality not unique at all so it\(cqs not possible to depend on it to know how the information are packed in the response.
the run indicator status (0x00 = OFF, 0xFF = ON)
additional data specific to each controller. For example, libmodbus returns the version of the library as a string.
The modbus_report_slave_id() function shall return the number of read data if successful. Otherwise it shall return -1 and set errno.
uint8_t *tab_bytes; ... rc = modbus_report_slave_id(ctx, tab_bytes); if (rc > 1) { printf("Run Status Indicator: %s\n", tab_bytes[1] ? "ON" : "OFF"); }
The libmodbus documentation was written by St\('ephane Raimbault <\m[blue][email protected]\m[]\s-2\u[1]\d\s+2>
mailto:[email protected]