1MODBUS_REPORT_SLAVE_(3) Libmodbus Manual MODBUS_REPORT_SLAVE_(3)
2
3
4
6 modbus_report_slave_id - returns a description of the controller
7
9 int modbus_report_slave_id(modbus_t *ctx, uint8_t *dest);
10
12 The modbus_report_slave_id() function shall send a request to the
13 controller to obtain a description of the controller.
14
15 The response stored in dest contains:
16
17 · the byte count of the response
18
19 · the slave ID, this unique ID is in reality not unique at all so
20 it’s not possible to depend on it to know how the information are
21 packed in the response.
22
23 · the run indicator status (0x00 = OFF, 0xFF = ON)
24
25 · additional data specific to each controller. For example, libmodbus
26 returns the version of the library as a string.
27
29 The modbus_report_slave_id() function shall return the number of read
30 data if successful. Otherwise it shall return -1 and set errno.
31
33 uint8_t *tab_bytes;
34
35 ...
36
37 rc = modbus_report_slave_id(ctx, tab_bytes);
38 if (rc > 1) {
39 printf("Run Status Indicator: %s\n", tab_bytes[1] ? "ON" : "OFF");
40 }
41
43 The libmodbus documentation was written by Stéphane Raimbault
44 <stephane.raimbault@gmail.com[1]>
45
47 1. stephane.raimbault@gmail.com
48 mailto:stephane.raimbault@gmail.com
49
50
51
52libmodbus 3.0.6 04/02/2014 MODBUS_REPORT_SLAVE_(3)