Skip to content

feat(android): Tesla BLE core - client, status source, VIN-matched scanner (2/3) - #207

Closed
dkneeland wants to merge 1 commit into
feat/vin-pipelinefrom
feat/tesla-ble-core
Closed

feat(android): Tesla BLE core - client, status source, VIN-matched scanner (2/3)#207
dkneeland wants to merge 1 commit into
feat/vin-pipelinefrom
feat/tesla-ble-core

Conversation

@dkneeland

Copy link
Copy Markdown
Collaborator

Part 2 of 3 of a stacked series that supersedes #201 (closed; work redistributed across this stack). Stacks on Part 1 (feat/vin-pipeline).

What & why

The Tesla app-channel BLE layer, hardened per the post-review audit of #201:

  • TeslaClient — commands incl. CMD_PROVISION. Payload built only after validating all 17 VIN chars and the complete MAC (length + hex + separators); preserves the required reversed NimBLE MAC byte order; the full VIN is never logged (generic rejection message instead).
  • Acknowledgement semantics: a successful GATT write is treated as dispatch only; TeslaLinkState.Staged is the provisioning acknowledgement.
  • TeslaStatus / TeslaStatusSource — notification parsing plus requestReset() plumbing with resetPending cleared on NeverEnrolled/Staged.
  • TeslaVehicleScanner — matches only advertisements derived from the supplied VIN: legacy S + first 8 bytes of SHA1(VIN) hex + every supported role suffix, and modern Tesla + 4-, 5-, and 6-char VIN tails. No generic "any Tesla name" discovery path.

No UI yet — Home/Settings are untouched until Part 3 wires the enrollment flow.

Tests

Provision payload byte-layout (opcode, ASCII VIN, address type, reversed MAC), invalid VIN/MAC rejection, legacy/modern name matching incl. all suffix/tail lengths, TeslaStatus parsing. Full testDebugUnitTest green at carve time.

Stack & merge order

Merge after Part 1. On merge of Part 1, this PR's base retargets to main (auto if Part 1's branch is deleted) — click Update branch so the diff collapses to just this PR's changes, then squash-merge. Part 3 stacks on this branch.

…anner


Introduce the Tesla app-channel BLE layer:

- TeslaClient commands incl. CMD_PROVISION with full 17-char VIN and
  MAC validation, reversed NimBLE byte order, and no full-VIN logging
- a GATT write is treated as dispatch only; Staged status is the
  provisioning acknowledgement
- TeslaStatus / TeslaStatusSource parsing with reset-request plumbing
- TeslaVehicleScanner matches only advertisements derived from the
  supplied VIN (legacy SHA-1 prefix with all role suffixes, modern
  4/5/6-char tails)

Unit coverage for payload bytes, invalid inputs, name matching.
@dkneeland
dkneeland force-pushed the feat/tesla-ble-core branch from 3f36db2 to 09f07fc Compare August 25, 2026 23:46
@dkneeland

Copy link
Copy Markdown
Collaborator Author

Re-created as part of the re-layered stack (GATT-subscribe-retry fix extracted to standalone bottom layer): successor being opened now - see #211 and the new stack: #210 (fix) -> #211 (VIN pipeline) -> this content -> enrollment UX.

@dkneeland dkneeland closed this Aug 25, 2026
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