-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
There is no stream.available for rx #1930
Comments
Yes, I've long wanted to add Stream::ready() |
Hi Paul thanks for agreeing on the concern. Some more background why I need this (and this would be the perfect time for the Arudino core team to make me do the work ;-) ) |
I have implemented the previous solution and I didn't like it (again :-( )
this is 100% compatible with existing libraries and sketches and allows for extension of availableInSendQueue() with a consistent naming. my hardware serial class definition looks like
and the code
I have an idea about the growth path (getting rid of available) but due to lack of interest I won't bother to explain. |
can this please be taken into consideration? |
It is a duplicate but if you only fi it in hardware serial the fix of the duplicate is not good enough for me. |
I like this solution better than any of the other solutions I've seen so far and MUCH |
@bperrybap |
Really interesting! @jantje |
This question was also asked by matthijskooijman in #1408 |
Oh, I see, missed that, thanks.
mmhh, may I ask why you feel the need to specify that there is a "queue"? Now, since we are going to handle input and output, I expect that |
On 07/13/2014 11:13 AM, Cristian Maglie wrote:
I like names being consistent and to have a name that can help I don't have particularly strong feelings on the names BTW, I realize this next part below is pretty far off topic for the "available" discussion, Maybe "flush" could use an update as well? Currently, since flush() is in Stream, When might having "flush" without Stream be useful? I probably should start a new thread on the developers list for this, I only brought it up here because, timing wise, --- bill |
as I stated before. Available just doesn't say anything. As to availableForRead()/availableForWrite() There is lots of confusion and doubt on my side. I think the word "available" is part of the problem.
Note that that is a "different calculation" on a "different queue". I think this should be reflected in the names: |
On 07/13/2014 04:57 PM, jantje wrote:
The existing available() function in Stream is for the read side and
I thought everyone was in agreement that those 2 functions are what is needed And I thought this was the current proposal: #1 is availableForRead() would be the same as the existing available() and Those names seem fairly consistent and descriptive to me as both are returning I think of it as |
As I stated: I get/got very confused by the dual meaning of the word available in a buffer (available to read versus available to write).
|
Please do, this question deserves his own thread.
I always asked myself why the flush() method was in Stream instead of Print. Now I know the reason. |
This is again confusingly worded. New try: The two meanings I see for available in one queue |
Fixed with #2193 |
As explained in http://arduino.cc/en/Reference/StreamAvailable#.UyDJNvFl7PE
available tells how much data is available for receiving in the stream.
There is however no method how much is available or waiting for sending.
This lack makes it impossible for a sketch to be smart about what it sends.
The text was updated successfully, but these errors were encountered: