On 05/12/2017 12:23 PM, Victor Aprea wrote:
> So if you want to write a class that gets passed a Stream, you have no
> way of knowing that the write() you're about to do into that Stream
> will get overflow the Stream's buffer.
Indeed, the long term solution will (probably) define
availableForWrite() as a virtual function in the Stream class. Until
that day comes, you can't use it from a library that takes a generic
Stream pointer or reference.
But availableForWrite() is still young. It's 3rd Arduino birthday
coming up July 18. I don't know when it'll be mature enough for Arduino
to officially adopt it in Stream, but hopefully that day will come
eventually?