Skip to content

Add compact chunked client API payload#980

Open
kernel-oops wants to merge 2 commits into
meshtastic:masterfrom
kernel-oops:garmin-ble-chunked-phoneapi
Open

Add compact chunked client API payload#980
kernel-oops wants to merge 2 commits into
meshtastic:masterfrom
kernel-oops:garmin-ble-chunked-phoneapi

Conversation

@kernel-oops

@kernel-oops kernel-oops commented Jul 7, 2026

Copy link
Copy Markdown

Summary

Add a compact ChunkedPayload message for Meshtastic client API transports that need to carry serialized ToRadio / FromRadio protobuf packets over small BLE characteristic reads and writes.

This is intended for constrained BLE centrals such as Garmin Connect IQ devices, where public BLE writes are limited to 20 bytes and ATT long reads are not available.

Related firmware implementation PR: meshtastic/firmware#10928

What Changed

  • Add ToRadio.chunked_payload = 8.
  • Add FromRadio.chunked_payload = 20.
  • Add compact ordered ChunkedPayload:
    • payload_size = 1, uint32, nanopb int_size:16.
    • payload_chunk = 2, nanopb max_size:228.

Transport Behavior

  • The first chunk carries payload_size and payload_chunk.
  • Continuation chunks carry only payload_chunk.
  • Ordered delivery is assumed by the transport implementation.
  • This avoids per-chunk IDs/counts/indexes for transports that already serialize reads/writes on one connection.

Compatibility

  • Existing clients ignore the new fields.
  • Chunked support remains opt-in at the transport/client implementation layer.

Testing

  • Regenerated firmware nanopb header cleanly from this schema.
  • Verified wrapper sizes for representative payloads remain within 20-byte BLE chunks when used by the corresponding PhoneAPI implementation.

Summary by CodeRabbit

  • New Features

    • Added support for chunked payloads in the client API over the device communication stream.
    • Improved handling of larger messages by transmitting payload data in chunks with total size information.
  • Changes

    • Updated the chunked payload format to use a simpler structure, making message transfer more efficient and consistent for supported clients.

@CLAassistant

CLAassistant commented Jul 7, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c70f4bbd-c5fb-492d-8702-faf66abec786

📥 Commits

Reviewing files that changed from the base of the PR and between 1ae3be3 and 90d0af5.

📒 Files selected for processing (2)
  • meshtastic/mesh.options
  • meshtastic/mesh.proto

📝 Walkthrough

Walkthrough

This PR modifies the ChunkedPayload protobuf message in mesh.proto, removing payload_id, chunk_count, and chunk_index fields and replacing them with payload_size and payload_chunk. New chunked_payload fields are added to FromRadio and ToRadio oneofs. Corresponding nanopb option sizing updates are made in mesh.options.

Changes

ChunkedPayload schema and wiring

Layer / File(s) Summary
ChunkedPayload message schema redesign
meshtastic/mesh.proto, meshtastic/mesh.options
ChunkedPayload removes payload_id, chunk_count, chunk_index fields and replaces them with payload_size (field 1) and payload_chunk (field 2); nanopb options updated to reflect payload_size int_size:16 instead of the removed chunk fields.
FromRadio/ToRadio oneof wiring
meshtastic/mesh.proto
New chunked_payload field added to FromRadio.payload_variant (field 20) for opt-in clients and to ToRadio.payload_variant (field 8) reassembled via normal PhoneAPI path.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

Not applicable — this PR consists of protobuf schema field changes without observable multi-component runtime flow.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately describes the main change: adding a compact chunked client API payload.
Description check ✅ Passed The description covers the change, behavior, compatibility, and testing, though it omits the template's issue link and checklist.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@kernel-oops

Copy link
Copy Markdown
Author

Compatibility note for reviewers: this intentionally reuses and reshapes the existing ChunkedPayload message rather than adding a second request/response pair. My understanding is that ChunkedPayload was not used by firmware/client API runtime paths yet, so changing its field layout should be acceptable, but that is the main compatibility point to confirm in review.

@kernel-oops
kernel-oops marked this pull request as ready for review July 7, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants