arduino / arduino/Arduino

Stream functions for detecting if an int or float is available.

Open
#4,924 0 comments 0 reactions 0 assignees View on GitHub
Component: Core feature request Print and Stream class
Dominant language
Java
Stars
14.6k
Forks
7k
PR merge metrics
No merged PRs in 30d

Description

That is, a function like intAvailable() or floatAvailable() that indicates whether or not a call to parseInt() or parseFloat() would succeed given the data currently in the stream's buffer. I'd suggest not applying the timeout to these (i.e. not waiting for additional characters to arrive), because part of the point would be to do other things while waiting for an int or float to arrive on the serial port.

This probably depends on having multi-byte look-ahead / peek (https://github.com/arduino/Arduino/issues/1910), which is a larger issue.

Contributor guide

Open the contributing guide

Research direction

Start by reading the Stream parseInt() and parseFloat() entry points and the multi-byte look-ahead/peek dependency described in issue #1910. Done means availability checks can inspect the current serial buffer without waiting for additional characters, while distinguishing whether parsing an int or float would succeed.

Written by the indexing model from the issue text.

Assessment

Domain
embedded-iot
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.