arduino / arduino/ArduinoCore-API
Ambiguous timeout return value of `Stream::parseInt` and `Stream::parseFloat`
- 主要言語
- C++
- スター
- 306
- フォーク
- 150
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
### Describe the problem
The parsing functions of the `Stream` class have a timeout mechanism. If the operation does not complete prior to the expiration of the timeout, the functions return `0`:
`Stream::parseInt`:
https://github.com/arduino/ArduinoCore-API/blob/0f4e57ea193a00163ae59f0f0ff478feae7eb5db/api/Stream.cpp#L141
`Stream::parseFloat`:
https://github.com/arduino/ArduinoCore-API/blob/0f4e57ea193a00163ae59f0f0ff478feae7eb5db/api/Stream.cpp#L172
🐛 The function does not provide the user with an unambiguous indicator that the parsing failed.
### ArduinoCore-API version
Last verified with: 0f4e57ea193a00163ae59f0f0ff478feae7eb5db
### Additional context
I suggest that these functions be changed to return `(int)NAN` or `(float)NAN` on timeout.
#### Additional reports
- https://github.com/arduino/Arduino/issues/1796
- https://github.com/arduino/Arduino/issues/7177
#### Related
- https://github.com/arduino/ArduinoCore-API/issues/70
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
まず Stream.cpp の issue でリンクされている parseInt と parseFloat の実装から始め、互換性のコンテキストを把握するために、関連する issue #70 と追加の Arduino レポートを読んでください。タイムアウトの挙動を有効なゼロの結果と比較し、両方の解析関数について、完了を曖昧さのないタイムアウト結果として定義し、関連する API 呼び出し元全体で挙動を確認してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- cpp
- 領域
- api, embedded-iot
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100