MIGRATION 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. =============================
  2. Migration from the 2.0 series
  3. =============================
  4. modbus_init_listen_tcp() has been renamed to modbus_slave_listen_tcp() and
  5. requires a new argument, the maximal number of connections:
  6. int modbus_slave_init_tcp(modbus_param_t *mb_param, int nb_connection);
  7. New function modbus_slave_accept_tcp() to etablish a new connection (previously
  8. in modbus_init_listen_tcp()):
  9. int modbus_slave_accept_tcp(modbus_param_t *mb_param, int *socket);
  10. modbus_listen() has been renamed to modbus_slave_receive() and requires a new
  11. argument, the socket file descriptor to listen on. If the sockfd is -1, the
  12. internal fd of modbus_param_t is used:
  13. int modbus_slave_receive(modbus_param_t *mb_param, int sockfd,
  14. uint8_t *query, int *query_length);
  15. ===================================
  16. Migration notes from the 1.2 series
  17. ===================================
  18. Init
  19. ====
  20. modbus_init_tcp requires a third new argument, the port number.
  21. modbus_init_tcp(modbus_param_t *mb_param, char *ip_address, int port)
  22. Set the port to MODBUS_TCP_DEFAULT_PORT to use the default one
  23. (502). It's convenient to use a port number greater than or equal to
  24. 1024 because it's not necessary to be root to use this port number.
  25. Pointers of data
  26. ================
  27. The coil and input status are now stored in an array of type uint8_t
  28. (in 1.2.X series, array of type int was used). So now, you need to
  29. pass a pointer of type uint8_t to use read_coil_status(), for example.
  30. The holding and input registers are now stored in an array of type
  31. uint16_t.
  32. These changes reduce the memory consumption.
  33. New functions
  34. =============
  35. report_slave_id
  36. modbus_set_error_handling
  37. modbus_mapping_new
  38. modbus_mapping_free
  39. modbus_init_listen_tcp
  40. modbus_listen
  41. modbus_manage_query
  42. get_slave_query_tcp
  43. set_bits_from_byte
  44. set_bits_from_bytes
  45. get_byte_from_bits
  46. Read modbus.h for more informations.