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 an optional behaviour to flush all pending data in the internal b… #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

doudou
Copy link
Member

@doudou doudou commented May 18, 2016

…uffer on timeout

This is required in cases where it is expected that corrupted data
would come in (i.e. corrupting medium). Otherwise, the driver might get
stuck at a broken packet, trying forever for data.

The behaviour, when enabled, is to try and read packets from the
immediately available data, discarding everything that is not a full
packet -- it would for instance discard a partial packet.

src/Driver.hpp Outdated
@@ -358,6 +407,13 @@ class Driver
*/
int readPacket(uint8_t* buffer, int bufsize, int packet_timeout, int first_byte_timeout = -1);

/** @overload @deprecated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this function deprecated already ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I copy/pasted the documentation from the readPacket above (which is deprecated). I'm going to refactor that stuff to overload the non-deprecated readPacket that uses base::Time for timeouts) and update.

@jmachowinski
Copy link
Contributor

Okay, so we wait with the merge until the final refactoring ?

@doudou
Copy link
Member Author

doudou commented Jun 7, 2016

Okay, so we wait with the merge until the final refactoring ?

Well ... that's the whole point of pull requests, ain't it ?

…uffer on timeout

This is required in cases where it is expected that corrupted data
would come in (i.e. corrupting medium). Otherwise, the driver might get
stuck at a broken packet, trying forever for data.

The behaviour, when enabled, is to try and read packets from the
immediately available data, discarding everything that is not a full
packet -- it would for instance discard a partial packet.
And deprecate the ones that were still using integers (milliseconds).
Timeout::timeLeft has been renamed into remaining in the Time-using
API to keep backward compatibility.
@doudou doudou force-pushed the flush_read_buffer_on_timeout branch from 401cec7 to 404eac1 Compare August 15, 2017 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants