Skip to content

feat(bmw): BMW F-series backend, --brand router and Vehicle trait - #4

Merged
JoeeDeveloper merged 9 commits into
mainfrom
feat/bmw-backend
Nov 24, 2026
Merged

JoeeDeveloper merged 9 commits into
mainfrom
feat/bmw-backend

Conversation

@JoeeDeveloper

Copy link
Copy Markdown
Owner

Summary

  • Add opendiag-bmw crate: HSFZ/ENET transport, discovery, read-only ident
  • ECU scan, DTC read and guarded clear, raw DID live logging
  • Guarded raw block write and restore (durable backup, exact-diff confirmation, read-back)
  • --brand router, bmw serve, and name-based coding from our own synthetic format
  • Extract the Vehicle trait in opendiag-services, shared by the VAG and BMW backends
  • Design doc for coding decode, Vehicle trait and launcher (docs/design-bmw-coding-and-launcher.md)
  • Ignore /builds/

Notes

  • Simulator-tested only; nothing has talked to a real car.
  • Real-file coding decode (design step 4) is not started; it is blocked on local files and a car or capture.
  • No BMW proprietary data is bundled.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xe1HmJJjhbWaBGaF6FKosA

JoeeDeveloper and others added 8 commits November 15, 2026 15:19
UdsClient is now generic over MessageLink (send, recv, describe). IsoTpLink
implements it, so VAG behaviour is unchanged; this lets transports that carry
whole UDS messages (BMW HSFZ) reuse the client.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…read-only ident

HSFZ framing, TCP gateway session with per-ECU MessageLinks, UDP discovery,
VIN / I-level / FA reads, a mock gateway served over localhost sockets, and an
`opendiag bmw` subcommand (discover, ident, did). Flash/programming services
are refused at the link. Simulator-tested only; unverified protocol details are
flagged in code and docs/bmw.md.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- scan: probe addresses with TesterPresent, count fault codes (read-only)
- BmwEcu implements FaultAccess/Module: raw hex DTCs, clear through the
  existing plan_clear/apply_clear flow (snapshot, typed YES, re-read)
- clear over HSFZ added to write_safety.rs under corrupted bytes
- live: log DIDs as raw hex CSV on a fixed grid
- small unverified ECU address table (labels only)
- mock: more ECUs, in-memory LoopbackStream
- CLI: opendiag bmw scan | dtc read|clear | live

Simulator-tested only; never run against a real car.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- services::block: BlockAccess, plan/apply_block_change, plan_block_restore.
  Confirmation bound to the change, re-read, flushed full-block backup,
  write, read-back verify; length changes, no-ops and 0xF1xx refused
- BackupRecord gains block/old_hex/new_hex (older records still load)
- BmwEcu implements BlockAccess; opt-in extended session, never programming
- CLI: opendiag bmw block read|write|restore; backup list shows blocks
- block write added to write_safety.rs under corrupted bytes
- mock: writable blocks, one that acknowledges but does not keep a write

DID is supplied by the user; no coding DID is assumed. Simulator-tested only.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Design only. BMW data is read from a user-supplied local path, never
bundled; the decoder sits behind a trait and cannot write; the Vehicle
trait is extracted from the two implementations; brand is chosen at launch.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…our own format

- global --brand vag|bmw|auto: no flag changes nothing; bmw routes serve;
  auto uses one ENET discovery broadcast and prints its choice
- opendiag bmw serve (read-only web page for one ECU); serve loop shared
- new crate opendiag-bmw-coding: strict opendiag-bmw-coding/0 definitions
  with provenance, decode, encode_change (only the field's bits change)
- opendiag bmw coding show|set: refuses unknown fields/values, wrong length,
  software-level mismatch and unstable reads; set uses the guarded block flow
- synthetic example in docs/examples; BMW's own files are not read

Simulator-tested only.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ckends

- services::vehicle: Vehicle (identify, scan, ecu as Module, keep_alive),
  SingleModule for VAG connections, VehicleModule to present one ECU of any
  vehicle as a Module; identification lines carry a verified flag
- bmw::BmwVehicle over the HSFZ gateway, one BmwEcu per address
- serve runs both brands through the same path; bmw scan/ident use the trait
- no connect() on the trait: connecting shares nothing between brands

Behaviour unchanged; full suite passes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@JoeeDeveloper JoeeDeveloper added enhancement New feature or request area:bmw BMW F-series over ENET/HSFZ area:services Services layer and guarded write flow area:cli Command line interface labels Nov 24, 2026
@JoeeDeveloper JoeeDeveloper added this to the Phase B - BMW F-series milestone Nov 24, 2026
@JoeeDeveloper
JoeeDeveloper merged commit 4289a1c into main Nov 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:bmw BMW F-series over ENET/HSFZ area:cli Command line interface area:services Services layer and guarded write flow enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant