Skip to content

Add backend-independent BLE CRTP framing - #613

Draft
rafael2reis wants to merge 1 commit into
bitcraze:masterfrom
rafael2reis:feat/ble-crtp-codec
Draft

rafael2reis wants to merge 1 commit into
bitcraze:masterfrom
rafael2reis:feat/ble-crtp-codec

Conversation

@rafael2reis

Copy link
Copy Markdown

Add backend-independent BLE CRTP framing as a small prerequisite for the experimental driver in #611.

The module encodes UP fragments and reassembles DOWN notifications using the documented length-minus-one/PID format. Invalid sizes, orphaned/mismatched continuations, overflow and a new start during an incomplete packet raise FrameError and discard partial state. It does not register a transport, import Bleak, configure logging or add flight/bench policy.

Validation:

  • Full cflib suite with this change alone: 204 tests passed on Python 3.14.5.
  • Six codec tests cover all 1–31 byte lengths at all four PIDs (124 round trips), malformed input, reset and recovery.
  • All repository pre-commit hooks passed.

This splits the wire-format component out for review first. The dependent driver PR carries identical codec files until this prerequisite can be incorporated upstream. The remaining driver changes can be inspected with a direct tree comparison between the fork branches feat/ble-crtp-codec and feat/ble-bench-driver.

Developed with OpenAI Codex assistance. Draft pending contributor and maintainer review.

Encode UP fragments and decode DOWN notifications with bounded length/PID validation. Add standalone round-trip, malformed-input and recovery tests before introducing a BLE backend or bench policy.

Assisted-by: OpenAI Codex

This branch has not been deployed

No deployments
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.

1 participant