feat(android): Tesla BLE core - client, status source, VIN-matched scanner (3/4) - #212
Merged
Conversation
dkneeland
force-pushed
the
feat/tesla-ble-core
branch
from
August 26, 2026 15:43
09f07fc to
d5a6647
Compare
wpmed92
force-pushed
the
feat/tesla-ble-core
branch
from
August 27, 2026 07:51
d5a6647 to
2063430
Compare
…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.
wpmed92
force-pushed
the
feat/tesla-ble-core
branch
from
August 27, 2026 09:08
2063430 to
980ccf7
Compare
…internals
- Extract DashKitBleManager.writeCommand() and route both VehicleControl.send
and the TeslaClient app-channel writes through it, removing the duplicated
gatt/service/characteristic resolution and API-33 write branch.
- Validate MACs with a regex and parse octets via split(":"), replacing the
hand-rolled index-modulo loop and substring arithmetic (payload bytes
unchanged, pinned by TeslaClientProvisionTest).
- Drop TeslaStatusSource.statusChar: onDescriptorWrite already receives the
characteristic via descriptor.characteristic.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YHug6438BcFaMQ2hwPdtCY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 3 of 4 of a stacked series that supersedes #201 (closed; work redistributed across this stack). Base is the VIN CAN pipeline (layer 2).
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).TeslaLinkState.Stagedis the provisioning acknowledgement.TeslaStatus/TeslaStatusSource— notification parsing plusrequestReset()plumbing withresetPendingcleared onNeverEnrolled/Staged.TeslaVehicleScanner— matches only advertisements derived from the supplied VIN: legacyS+ first 8 bytes ofSHA1(VIN)hex + every supported role suffix, and modernTesla+ 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,
TeslaStatusparsing. FulltestDebugUnitTestgreen at carve time.Stack & merge order
Merge third in the stack (after layers 1-2); GitHub's managed stack handles retarget/rebase automatically.