Add support for structured append segments #228
+85
−3
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 change adds support for structured append segments (#178). Here's a usage example:
This generates the following QR code:
I confirmed functionality by testing the QR code with this reader and it found the following bytes:
3 - the mode indicator for structured append mode (0011)
0 - the current symbol position (indicating this is the 1st QR code)
3 - the total number of symbols (there are a total of 4 QR codes)
0A - the parity byte (as specified)
The parity byte is a little tricky because it's based on the total XOR sum of all the content bytes for the entire payload, spanning across multiple QR codes. There's no way to calculate it based on a single QR code's content, so the assumption here is that you would calculate the parity byte yourself before generating the QR codes, and just pass in whatever you found for the result.
Effectively, the parity byte doesn't really matter much because I think a lot of QR code readers don't actually verify it. I've seen implementations that just generate a random byte value rather than actually calculating what the value should be and they seem to work without issue.
Anyway, let me know if you notice any issues! 😃