Open
Conversation
Contributor
Author
|
Updated with Julien Blanc's ideas and improved error handling |
Main Author Julien Blanc This patch is a first try at implementing a mechanism to provide storage backends in replacement of the default one. This is done through the modbus_storage_backend_vfptable which defines all functions that needs to be implemented by the callbacks. The structure passed to modbus_reply is otherwise opaque and passed back to the callbacks. The default backend has been updated to be compatible with these changes. Note : this patch breaks the ABI but tries to keep source compatibility Error handling moved to the custom request handler as suggested by Daniel Kirkham.
Contributor
Author
|
Is there anything I can do to get this pull request pulled? We are quite happy with the functionality but if anything needs to be done I'm happy to fix code style issues and such. |
Owner
|
Related to #323 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Major contributers to this pull request are
After a couple of iterations I've at something that might work regarding the callback functions discussed in the libmodbus google group.
The purpose of this pull request is to have something to discuss and continue to work on, I don't think this is in a mergable state just yet.
Purpose
To allow the user to have custom handlers for registers and coils. This allows them to make libmodbus read/write into existing settings-structures.
I have designed this to make the user defined handler do as little as possible, basically just fetch a register/bit value. It should be very backwards compatible, if no handlers are specified the library uses default handlers that will work just as previous versions.
The error checks are moved to the handlers allowing user to use structures with gaps in the addressing space for example holding register 1-100 are defined and 982 - 999 are also defined. the default (and previous) implementation does not allow for this but nothing hinders the user to define an handler that verifies the address against a list of valid addresses.
Any comments, insights and/or corrections are welcome =)