add modbus gateway approach (slave tcp - master serial) #8
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.
This example demonstrates using of FreeModbus stack port implementation for ESP32 targets as a TCP gateway device.
This implementation is able to read/write requests from external TCP Master and translate them to the slave devices connected into Modbus segment. The Modbus data dictionary is not used but the mapping areas are defined in the Modbus TCP Slave to reflect the values in its memory (this can be disabled). The Gateway gets requests from Slave TCP instance and translates the request to installed Modbus Master instance previously configured. The translation and mapping technique uses the approach with wrapped callback read/write functions to make the adapter to translate the data between instances. This example is prepared from scratch to just demonstrate possible approach for the gateway. Other approaches can be used to override the component sources and realize the gateway object for data translation. The adapter functionality is located in mb_lib library which exposes some internals of installed modbus library.