modbus_reply_exception.txt 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. modbus_reply_exception(3)
  2. =========================
  3. NAME
  4. ----
  5. modbus_reply_exception - send an exception reponse
  6. SYNOPSIS
  7. --------
  8. *int modbus_reply_exception(modbus_t *'ctx', const uint8_t *'req', unsigned int 'exception_code');
  9. DESCRIPTION
  10. -----------
  11. The *modbus_reply_exception()* function shall send an exception response based
  12. on the 'exception_code' in argument.
  13. The libmodbus provides the following exception codes:
  14. * MODBUS_EXCEPTION_ILLEGAL_FUNCTION (1)
  15. * MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS (2)
  16. * MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE (3)
  17. * MODBUS_EXCEPTION_SLAVE_OR_SERVER_FAILURE (4)
  18. * MODBUS_EXCEPTION_ACKNOWLEDGE (5)
  19. * MODBUS_EXCEPTION_SLAVE_OR_SERVER_BUSY (6)
  20. * MODBUS_EXCEPTION_NEGATIVE_ACKNOWLEDGE (7)
  21. * MODBUS_EXCEPTION_MEMORY_PARITY (8)
  22. * MODBUS_EXCEPTION_NOT_DEFINED (9)
  23. * MODBUS_EXCEPTION_GATEWAY_PATH (10)
  24. * MODBUS_EXCEPTION_GATEWAY_TARGET (11)
  25. The initial request _req_ is required to build a valid response.
  26. RETURN VALUE
  27. ------------
  28. The function shall return the length of the response sent if
  29. successful. Otherwise it shall return -1 and set errno.
  30. ERRORS
  31. ------
  32. *EINVAL*::
  33. The exception code is invalid
  34. SEE ALSO
  35. --------
  36. linkmb:modbus_reply[3]
  37. linkmb:libmodbus[7]
  38. AUTHORS
  39. -------
  40. The libmodbus documentation was written by Stéphane Raimbault
  41. <stephane.raimbault@gmail.com>