modbus_report_slave_id.txt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. modbus_report_slave_id(3)
  2. =========================
  3. NAME
  4. ----
  5. modbus_report_slave_id - returns a description of the controller
  6. SYNOPSIS
  7. --------
  8. *int modbus_report_slave_id(modbus_t *'ctx', uint8_t *'dest');*
  9. DESCRIPTION
  10. -----------
  11. The _modbus_report_slave_id()_ function shall send a request to the controller
  12. to obtain a description of the controller.
  13. The response stored in 'dest' contains:
  14. * the slave ID, this unique ID is in reality not unique at all so it's not
  15. possible to depend on it to know how the information are packed in the
  16. response.
  17. * the run indicator status (0x00 = OFF, 0xFF = ON)
  18. * additional data specific to each controller. For example, libmodbus returns
  19. the version of the library as a string.
  20. RETURN VALUE
  21. ------------
  22. The _modbus_report_slave_id()_ function shall return the number of read data if
  23. successful. Otherwise it shall return -1 and set errno.
  24. EXAMPLE
  25. -------
  26. [source,c]
  27. -------------------
  28. uint8_t *tab_bytes;
  29. ...
  30. rc = modbus_report_slave_id(ctx, tab_bytes);
  31. if (rc > 1) {
  32. printf("Run Status Indicator: %s\n", tab_bytes[1] ? "ON" : "OFF");
  33. }
  34. -------------------
  35. AUTHORS
  36. -------
  37. The libmodbus documentation was written by Stéphane Raimbault
  38. <stephane.raimbault@gmail.com>