feat(pid,dri): add risky-mode save guardrail and ECU module auto-disc… - #205
Merged
Merged
Conversation
…overy Adds two independent, UDS-safety-oriented features inspired by reviewing StelvioOBD's risk-assessment notes and its discover_ecus.py tool. Risky-mode save guardrail: EditPidBottomSheet's mode field is free text, so a user could previously save a custom PID with UDS mode 04 (clear DTCs), 08 (component/actuator control), 2E (write data by identifier) or 31 (routine control) with no warning at all. These modes can permanently alter ECU configuration or actuate hardware on a real vehicle. Saving now checks the chosen mode against a small risky-modes map and, if matched, shows a confirmation dialog with the specific reason before persisting; anything else keeps saving immediately as before. ECU module auto-discovery: every Diagnostic Request ID (DRI) entry used by multi-module DTC scanning previously had to be typed in by hand. This adds a sweep dialog, reachable from a new FAB on the DRI screen, that probes a configurable range of candidate CAN headers with a UDS TesterPresent (3E00) request and lets the user add whichever headers answer as new, unnamed DRI entries to be renamed afterward through the existing edit UI. The probe is dispatched through DataLoggerService/WorkflowOrchestrator the same way routines and DTC actions already are, and results are delivered back to the fragment via a broadcast event carrying a ModuleDiscoveryResult payload. This app-side change depends on the new discoverModule API added to obd-metrics 11.26.0-SNAPSHOT in a companion commit on that repo (which also fixes a bug where ObdCommandHandler silently dropped empty/NO_DATA replies for any command other than RoutineCommand, which would otherwise have prevented "not found" probes from ever reporting back). Verified via full app build: :datalogger:compileDebugKotlin, :app:compileGiuliaDebugKotlin, spotlessApply, and :app:assembleGiuliaDebug all pass. Not verified against real hardware in this environment - the 7E00 success-code assumption and default DA..F1 header convention follow the existing bundled profile files and the StelvioOBD reference tool, but have not been confirmed against a live adapter/vehicle.
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.
…overy
Adds two independent, UDS-safety-oriented features inspired by reviewing StelvioOBD's risk-assessment notes and its discover_ecus.py tool.
Risky-mode save guardrail: EditPidBottomSheet's mode field is free text, so a user could previously save a custom PID with UDS mode 04 (clear DTCs), 08 (component/actuator control), 2E (write data by identifier) or 31 (routine control) with no warning at all. These modes can permanently alter ECU configuration or actuate hardware on a real vehicle. Saving now checks the chosen mode against a small risky-modes map and, if matched, shows a confirmation dialog with the specific reason before persisting; anything else keeps saving immediately as before.
ECU module auto-discovery: every Diagnostic Request ID (DRI) entry used by multi-module DTC scanning previously had to be typed in by hand. This adds a sweep dialog, reachable from a new FAB on the DRI screen, that probes a configurable range of candidate CAN headers with a UDS TesterPresent (3E00) request and lets the user add whichever headers answer as new, unnamed DRI entries to be renamed afterward through the existing edit UI. The probe is dispatched through DataLoggerService/WorkflowOrchestrator the same way routines and DTC actions already are, and results are delivered back to the fragment via a broadcast event carrying a ModuleDiscoveryResult payload. This app-side change depends on the new discoverModule API added to obd-metrics 11.26.0-SNAPSHOT in a companion commit on that repo (which also fixes a bug where ObdCommandHandler silently dropped empty/NO_DATA replies for any command other than RoutineCommand, which would otherwise have prevented "not found" probes from ever reporting back).
Verified via full app build: :datalogger:compileDebugKotlin, :app:compileGiuliaDebugKotlin, spotlessApply, and :app:assembleGiuliaDebug all pass. Not verified against real hardware in this environment - the 7E00 success-code assumption and default DA..F1 header convention follow the existing bundled profile files and the StelvioOBD reference tool, but have not been confirmed against a live adapter/vehicle.