Add Simple Protocol binary framing helpers and length-prefixed parsing (APIDocRev28) #20
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.
Motivation
SimpleProtoInitso callers can select ASCII/binary and CRC options.Description
SimpleProtocolFrameCodecand supporting types insrc/Internal/Protocol/SimpleProtocolFrame.cswithBuildBinaryFrame,TryParseBinaryFrame,TryParseBinaryFrames, andComputeCrc(CCITT reverse polynomial 0x8408) for length-prefixed frames with optional CRC.SimpleProtocolCommModeenum tosrc/Internal/DataAccess/Constants.cswith flags for ASCII/Binary and CRC modes and updates the Simple Protocol comment to reference APIDocRev28.ResponseParser.ParseUInt16LengthPrefixedByteArray()insrc/Internal/Parsing/ResponseParser.csto parse UInt16-prefixed payloads (LSB first).tests/Elatec.NET.Tests/ProtocolTests.cscovering frame construction (BuildBinaryFrame_IncludesLengthPrefixAndCrc), multi-frame parsing (TryParseBinaryFrames_ParsesMultiPartResponses) and the new parser helper (ParseUInt16LengthPrefixedByteArray_ReadsPayload).Testing
dotnet test tests/Elatec.NET.Tests/Elatec.NET.Tests.csprojand all tests passed (Passed: 17, Failed: 0).Codex Task