Added a client context parameter to the modbus_t context, and getter/setter methods.#646
Added a client context parameter to the modbus_t context, and getter/setter methods.#646JetForMe wants to merge 7 commits intostephane:masterfrom
Conversation
|
I'm reluctant to add any new field to _modbus struct (even more a free pointer not managed). |
|
Note that A common scenario in object-oriented languages like C++ or Swift is to wrap library data structures. In this case, I've defined a class This is a very common and widely-used pattern. |
|
@stephane Does that make sense? |
…bmodbus into rmann/add-context
|
I've added documentation for the new functions. |
|
Hi stephane and JetForMe. Are there any plans to merge that code with master? I haven't found the code from the pull request in the master branch. I have the same issue and the solution provided by JetForMe seems to be reasonable. |
When I use libgpiod to read/write the custom RTS IO, I need to at least keep track of the |
This commit adds
client_contextto the_modbusstructmodbus_set_client_context()modbus_get_client_context()The code otherwise ignores
_modbus.client_context. It is available to calling code for it to associate its own context with the callback (typically a pointer to an object).