Unified packet parsing to use BufferReader#309
Conversation
…r handling - Added storageUsedKb and storageTotalKb properties to MeshCoreConnector. - Updated battery and storage frame parsing with improved error handling. - Refactored log RX data handling to use BufferReader for better readability and error management. - Enhanced message parsing in ChannelMessage and Message classes to utilize BufferReader. - Introduced new text type for signed messages in meshcore_protocol.dart. - Updated BLE debug log screen to use BufferReader for payload parsing. - Refactored message retry service to handle ACK hashes as integers instead of Uint8List. - Improved message storage serialization and deserialization to accommodate new expectedAckHash type. - Added wasPulled property to Contact model for better state management.
… improve error handling
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 767dc1164e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…nd ChannelMessage
There was a problem hiding this comment.
Pull request overview
This PR refactors MeshCore binary parsing to use BufferReader more consistently (including C-string handling), updates ACK-hash handling to use uint32-style ints, and adds new UI flows for privacy/telemetry controls and clearing chats.
Changes:
- Refactors multiple protocol/frame parsers to
BufferReader+readCStringand adds utility helpers likeackHashToHex. - Changes ACK hash representation from
Uint8List(4)tointacross retry logic, message models, persistence, and tests. - Adds privacy/telemetry UI settings, per-contact telemetry flags, chat/channel clear actions, and telemetry screen updates.
Reviewed changes
Copilot reviewed 54 out of 54 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| test/services/retry_and_protocol_test.dart | Updates tests for ACK hash now represented as int + hex formatting. |
| lib/widgets/room_login_dialog.dart | Caches resolved contact index for faster lookups. |
| lib/widgets/repeater_login_dialog.dart | Caches resolved contact index for faster lookups. |
| lib/widgets/path_management_dialog.dart | Caches resolved contact index for faster lookups. |
| lib/storage/message_store.dart | Persists expectedAckHash as an int instead of base64 bytes. |
| lib/services/message_retry_service.dart | Migrates retry/ACK matching to int ACK hashes. |
| lib/screens/telemetry_screen.dart | Updates telemetry parsing/requests and adds chat-contact telemetry handling. |
| lib/screens/settings_screen.dart | Replaces privacy-mode toggle dialog with a richer privacy/telemetry settings dialog. |
| lib/screens/repeater_status_screen.dart | Caches resolved repeater index for faster lookups. |
| lib/screens/repeater_settings_screen.dart | Caches resolved repeater index for faster lookups. |
| lib/screens/repeater_hub_screen.dart | Updates TelemetryScreen navigation signature. |
| lib/screens/repeater_cli_screen.dart | Caches resolved repeater index for faster lookups. |
| lib/screens/neighbors_screen.dart | Caches resolved repeater index for faster lookups. |
| lib/screens/contacts_screen.dart | Switches favorite toggle to setContactFlags(...). |
| lib/screens/chat_screen.dart | Adds menu actions (info/settings/telemetry/clear chat) + contact settings UI. |
| lib/screens/channel_chat_screen.dart | Adds “clear chat” menu action for channels. |
| lib/screens/ble_debug_log_screen.dart | Refactors payload summaries to BufferReader parsing. |
| lib/models/message.dart | Updates expectedAckHash type and message parsing to BufferReader. |
| lib/models/contact.dart | Adds wasPulled and telemetry flag getters on Contact. |
| lib/models/channel_message.dart | Refactors channel message parsing to BufferReader. |
| lib/models/channel.dart | Refactors channel parsing to BufferReader/C-strings. |
| lib/l10n/app_en.arb | Adds strings for privacy/telemetry/contact settings UI. |
| lib/l10n/app_de.arb | Adds strings for privacy/telemetry/contact settings UI. |
| lib/l10n/app_es.arb | Adds strings for privacy/telemetry/contact settings UI. |
| lib/l10n/app_fr.arb | Adds strings for privacy/telemetry/contact settings UI. |
| lib/l10n/app_it.arb | Adds strings for privacy/telemetry/contact settings UI. |
| lib/l10n/app_nl.arb | Adds strings for privacy/telemetry/contact settings UI. |
| lib/l10n/app_pl.arb | Adds strings for privacy/telemetry/contact settings UI. |
| lib/l10n/app_pt.arb | Adds strings for privacy/telemetry/contact settings UI. |
| lib/l10n/app_ru.arb | Adds strings for privacy/telemetry/contact settings UI. |
| lib/l10n/app_sk.arb | Adds strings for privacy/telemetry/contact settings UI. |
| lib/l10n/app_sl.arb | Adds strings for privacy/telemetry/contact settings UI. |
| lib/l10n/app_sv.arb | Adds strings for privacy/telemetry/contact settings UI. |
| lib/l10n/app_uk.arb | Adds strings for privacy/telemetry/contact settings UI. |
| lib/l10n/app_zh.arb | Adds strings for privacy/telemetry/contact settings UI. |
| lib/l10n/app_bg.arb | Adds strings and updates placeholders (but see comment). |
| lib/l10n/app_localizations.dart | Exposes new localization keys in the base localization API. |
| lib/l10n/app_localizations_en.dart | Implements new localization keys (en). |
| lib/l10n/app_localizations_de.dart | Implements new localization keys (de). |
| lib/l10n/app_localizations_es.dart | Implements new localization keys (es). |
| lib/l10n/app_localizations_fr.dart | Implements new localization keys (fr). |
| lib/l10n/app_localizations_it.dart | Implements new localization keys (it). |
| lib/l10n/app_localizations_nl.dart | Implements new localization keys (nl). |
| lib/l10n/app_localizations_pl.dart | Implements new localization keys (pl). |
| lib/l10n/app_localizations_pt.dart | Implements new localization keys (pt). |
| lib/l10n/app_localizations_ru.dart | Implements new localization keys (ru). |
| lib/l10n/app_localizations_sk.dart | Implements new localization keys (sk). |
| lib/l10n/app_localizations_sl.dart | Implements new localization keys (sl). |
| lib/l10n/app_localizations_sv.dart | Implements new localization keys (sv). |
| lib/l10n/app_localizations_uk.dart | Implements new localization keys (uk). |
| lib/l10n/app_localizations_zh.dart | Implements new localization keys (zh). |
| lib/l10n/app_localizations_bg.dart | Implements new localization keys (bg). |
| lib/connector/meshcore_protocol.dart | Adds/updates protocol constants, parsing helpers, and telemetry request builder. |
| lib/connector/meshcore_connector.dart | Updates frame handling/parsing, adds storage/telemetry params, adds clear-chat helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This pull request refactors and improves binary frame parsing and error handling in the
MeshCoreConnectorclass, with a focus on safer, more consistent string extraction and robust parsing logic. It also introduces new fields for storage usage, improves error reporting, and updates protocol constants to support signed messages. The changes enhance code maintainability, reliability, and future extensibility.Parsing and String Extraction Improvements
readString()with the saferreadCString()method for extracting null-terminated strings, ensuring correct handling of C-style strings throughout the codebase. (lib/connector/meshcore_connector.dart,lib/connector/meshcore_protocol.dart) [1] [2] [3] [4] [5] [6] [7]BufferReaderfor sequential parsing, with explicit handling for signed messages and robust error catching. (lib/connector/meshcore_protocol.dart)Frame Parsing and Error Handling
BufferReaderfor sequential binary parsing, improving readability and reducing manual offset calculations. Added comprehensive try/catch blocks to log errors and gracefully handle malformed frames. (lib/connector/meshcore_connector.dart) [1] [2] [3] [4] [5] [6] [7] [8] [9]Protocol and Data Structure Updates
txtTypeSignedconstant and updating message parsing logic to handle signatures. Also addedsignatureSizeconstant. (lib/connector/meshcore_protocol.dart) [1] [2] [3]storageUsedKbandstorageTotalKbto track device storage usage. (lib/connector/meshcore_connector.dart) [1] [2] [3]Utility and Helper Changes
ackHashToHexutility function for consistency. (lib/connector/meshcore_connector.dart,lib/connector/meshcore_protocol.dart) [1] [2] [3] [4] [5]Miscellaneous
meshcore_protocol.dart. (lib/connector/meshcore_protocol.dart)