Non-blocking functionality

53 views
Skip to first unread message

Sebastian Psm

unread,
Sep 16, 2021, 4:40:43 AM9/16/21
to libmodbus
Hey,

I added non-blocking (client-)functions and unit tests to the library: see https://github.com/dspace-group/libmodbus/tree/nonblocking 

The existing API-functions hasn't changed, but the read, write and read/write functions got a non-blocking pondon. For example modbus_write_register_nb() is the non-blocking variant of modbus_write_register().

How does it work:
If a non-blocking pondon is called, then the request is transmitted immediately and the confirmation is queued. Therefore, it's now possible to call several non-blocking functions in a row without losing that much time.
Finally, if it can be expected, that the server has transmitted confirmations, then the confirmation queue can be processed altogether by calling the new modbus_process_all_rx().

Next step for me would be to write down the doc.

To finish my work I have some questions to the community:
  1. What do you prefer: Separate function documentation for the non-blocking functions or an additional text to the existing blocking functions?`
  2. The length of the confirmation queue (the storage where the confirmations are queued) has a default length of 25. Any thoughts on this? To short?
  3. Would like to hear if non-blocking is an issue at all^^
List of new functions:
  • modbus_write_register_nb
  • modbus_write_bit_nb
  • modbus_read_input_bits_nb
  • modbus_read_bits_nb
  • modbus_read_registers_nb
  • modbus_read_input_registers_nb
  • modbus_write_and_read_registers_nb
  • modbus_write_bits_nb
  • modbus_write_registers_nb
  • modbus_mask_write_register_nb
  • modbus_report_slave_id_nb
  • modbus_process_all_rx

Best greetings
Sebastian
Reply all
Reply to author
Forward
0 new messages