Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for parsing packets consisting of arbitrary data followed only by a terminator. #89

Open
armadsen opened this issue Oct 7, 2015 · 3 comments
Assignees
Milestone

Comments

@armadsen
Copy link
Owner

armadsen commented Oct 7, 2015

ORSSerialPacketDescriptor's design was driven by a desire to design a system that is robust against dropped or corrupted data. As such, it currently only supports describing and parsing full-specified packets. That is packets whose start and end (at least) can be clearly determined from the data alone.

However, it is fairly common for serial data to come in line by line where the data is arbitrary bytes followed by a terminator. A complete packet in this case is just all the data that has come in since the last packet finished (ie. terminator was received). As it stands, ORSSerialPacketDescriptor and the packet parsing API can't handle this kind of data.

It may require adding a special case for this in the packet parsing logic.

@armadsen armadsen self-assigned this Oct 7, 2015
@armadsen armadsen added this to the 2.1 milestone Oct 7, 2015
@csann
Copy link

csann commented Oct 7, 2015

You might also consider allowing a packet to be described by a suffix and/or prefix and a fixed number of bytes. For example, 22 bytes starting with a prefix of <12 d3 6a>. This can be done with a PacketEvaluator however that requires a lot of code for such a simple requirement.

On Oct 7, 2015, at 1:43 PM, Andrew Madsen [email protected] wrote:

ORSSerialPacketDescriptor's design was driven by a desire to design a system that is robust against dropped or corrupted data. As such, it currently only supports describing and parsing full-specified packets. That is packets whose start and end (at least) can be clearly determined from the data alone.

However, it is fairly common for serial data to come in line by line where the data is arbitrary bytes followed by a terminator. A complete packet in this case is just all the data that has come in since the last packet finished (ie. terminator was received). As it stands, ORSSerialPacketDescriptor and the packet parsing API can't handle this kind of data.

It may require adding a special case for this in the packet parsing logic.


Reply to this email directly or view it on GitHub #89.

@armadsen
Copy link
Owner Author

armadsen commented Oct 7, 2015

Thanks for the comment, Clark. I agree. However I do want any solution for this to be more general. This issue was partly prompted by a user of ORSSerialPort writing an app that receives packets where the length is arbitrary.

@nathanntg
Copy link
Contributor

I'd definitely put in a plug for something along these lines. I've been interacting with an Arduino sketch that has a predetermined protocol, and it uses just a packet terminator (\r\n), so I have not been able to make it work with ORSSerialPacketDescriptor. I am going to try and implement a work around myself, which I will mention in a pull request, although it may not be the best solution. And I would totally understand if you opt not to merge it given your 3.0 rewrite.

(Thanks for the great framework!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants