1 modbus_report_slave_id(3)
2 =========================
7 modbus_report_slave_id - returns a description of the controller
12 *int modbus_report_slave_id(modbus_t *'ctx', int 'max_dest', uint8_t *'dest');*
17 The *modbus_report_slave_id()* function shall send a request to the controller
18 to obtain a description of the controller.
20 The response stored in _dest_ contains:
22 * the slave ID, this unique ID is in reality not unique at all so it's not
23 possible to depend on it to know how the information are packed in the
25 * the run indicator status (0x00 = OFF, 0xFF = ON)
26 * additional data specific to each controller. For example, libmodbus returns
27 the version of the library as a string.
29 The function write at most _max_dest_ bytes from the response to _dest_.
33 The function shall return the number of read data if successful.
35 If the output was truncated due to the _max_dest_ limit then the return value is
36 the number of bytes which would have been written to _dest_ if enough space had
37 been available. Thus, a return value greater than _max_dest_ means that the
38 response data was truncated.
40 Otherwise it shall return -1 and set errno.
46 uint8_t tab_bytes[MODBUS_MAX_PDU_LENGTH];
50 rc = modbus_report_slave_id(ctx, MODBUS_MAX_PDU_LENGTH, tab_bytes);
52 printf("Run Status Indicator: %s\n", tab_bytes[1] ? "ON" : "OFF");
59 The libmodbus documentation was written by Stéphane Raimbault
60 <stephane.raimbault@gmail.com>