BLE: send the current state when the app subscribes
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- rust
- Domain
- embedded-iot
Research direction
Read the CCCD write handling for the device→app characteristic and trouble-host's attribute.rs, especially should_notify, to understand why notifications are dropped before subscription. Trace how the current basic and advanced state is sent, then check the WiCAN virtual-car pairing and reconnect flows described in the issue. Done means both flows receive the full state immediately after notifications are enabled; linked pull request #65 is already open.
Written by the indexing model from the issue text.
Description
Problem
The first state update after a BLE connection is usually lost:
- The firmware holds state updates until the link is encrypted, then sends the held one right away.
- The app subscribes to the device→app characteristic only after that (the pairing wizard subscribes once its bond-probe write succeeds; the dashboard transport subscribes after connecting).
- trouble-host's
notifysends nothing to a peer that hasn't subscribed and returnsOk(attribute.rs,should_notify), so the update is dropped silently.
The app then waits for the next periodic update (every 5 s on the virtual car; on E-GMP it depends on CAN traffic). The pairing wizard waits only a limited time for that first message, so pairing could time out even though the bond was made. That happened while testing #52 and OpenCarControls/mobile-app#41. The 500 ms sleep after encryption, which #52 removes (#28), used to hide this race most of the time.
OpenCarControls/mobile-app#41 makes the wizard wait 15 s as a safety margin; this issue is the actual fix.
Proposal
When the app writes the CCCD of the device→app characteristic to enable notifications, send the current full state (basic + advanced) to that connection. Pairing then gets its first message straight away, and the dashboard shows data at once on every reconnect.
Testing
On the WiCAN with the virtual car: pair from the app and check the wizard finishes within a second of the bond; reconnect and check the dashboard fills straight away.
- Dominant language
- Rust
- Stars
- 1
- Forks
- 0
- Avg merge
- 10h 56m
- Merged PRs (30d)
- 15
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OpenCarControls/firmware
-
Clean up E-GMP leftoversPossibly taken @Tichael claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
OpenCarControls/firmware#34 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
OpenCarControls/firmware#55 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
OpenCarControls/firmware#54 ·
Maintainers usually reply within 1 day
-
First-setup pairing window is too short and stays open after the first bondPossibly taken A pull request linked to this issue is open or already merged. Openenhancement
Difficulty 4/5 3-5 days Newbie friendliness 55/100
OpenCarControls/firmware#53 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
OpenCarControls/firmware#51 ·
Maintainers usually reply within 1 day
All issues in OpenCarControls/firmware
Similar issues
-
bug: workspace access hint suggests a --subject command that fails for hyphen-leading OIDC subjectsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
A-FFI C-Testing D-Straightforward S-Ready
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
docs priority:P3 size:XS
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Appimage ConventionsOpenenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day