-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Introduce support for callback functions #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Hi Michael, I intend to add a callback support to libmodbus for years! I'll try to give feedback on your RFC in following weeks |
Hi Michael, Thank you for your branch. Kind regards, Daniel |
Hi Daniel, your are right, me too, I'm wondering whether this is the correct approach for a library. When I coded this PR, my main intension was to indicate the/my need for my particular requirement and to get a discussion started - as we do here :-) Best regards, |
Hi Michael, Yes, I would prefer a fixed function type for each callback. I have also I am currently working at the QModBus tool. There is a need for two Kind regards, Daniel 2013/11/5 Michael Heimpold notifications@github.com
|
Signed-off-by: Michael Heimpold <mhei@heimpold.de>
When a Modbus device supports vendor specific function codes, then the current length calculation is not sufficient. Allow the calling programm to register callback functions which can handle such cases. Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Beautiful. Would allow me to use libmodbus in https://github.com/dangowrt/tracertools/ ... Just that EP also uses a function code reserved for error handling (supposedly they miscalculated decimal 100 as 0xA0...) |
How unfortunate that I now have to roll my own because this is exactly what I needed.Considering this idea with a contributed patch has not made it since September 2013, there is no point to trying to convince anyone here or even contributing patches! Another example of hardware where this library does not work SeaLevel SeaI/O 462 The irritating part is that I almost got all the way there using the other inefficient methods. That is until I got ERROR Illegal data address at address 88 when using modbus_read_input_bits. I'll never get my 2 days back. |
I've a device which implements custom modbus functions. Receiving the response for this functions is only possible when libmodbus knows about the response length. As various device could implement the same function codes its up to the program using the modbus library to calculate/provide the response length correctly. So this two patches are a RFC to deal with such situations.