Repository navigation
Document ordering and count guarantees of read results - #206
Merged
Merged
Conversation
Modbus read responses don't encode per-value addresses, so the index in Indexed<T> (and bit_value/register_value in the bindings) is computed by the library as a convenience. Document that successful reads always return exactly range.count values in ascending, contiguous address order, and fix the guide's incorrect claim that the iterator is empty on error.
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.
Addresses #197.
Modbus read responses contain only a byte count and the values in address order — there are no per-value addresses on the wire. The
indexinIndexed<T>(andbit_value/register_valuein the bindings) is computed by the library fromrange.startas a convenience. This was never documented, which led users to defensively handle arbitrary orderings.This PR documents that a successful read always returns exactly
range.countvalues in ascending, contiguous address order starting atrange.start, and that a response with too few or too many values fails the request.Indexed<T>: canonical explanation;BitIterator/RegisterIteratorlink to itChannel,CallbackSession,FfiChannelread_*methods: one-line guarantee + linkbit_value/register_value,bit_read_callback/register_read_callback(also fixes a "reading reading" typo)Docs only; no code changes.