Bundles several feature streams that have been iterating on the working tree: - Developer Tools page (Debug-only via DEVELOPER_TOOLS symbol): hosts the identification card, manual KWP write + transaction log, ROM/EEPROM dump card with progress banner and completion message, persisted custom-commands library, persisted EEPROM passwords library. New service primitives: IKwpService.SendRawCustomAsync / ReadEepromAsync / ReadRomEepromAsync. Persistence mirrors the Clients XML pattern in two new files (custom_commands.xml, eeprom_passwords.xml). - Auto-test orchestrator (IAutoTestOrchestrator + AutoTestState): linear K-Line read -> unlock -> bench-on -> test sequence with snackbar UI and progress dialog VM, gated on dashboard alarms. - BIP-STATUS display: BipDisplayViewModel + BipDisplayView, RAM read at 0x0106 via IKwpService.ReadBipStatusAsync; status definitions in BipStatusDefinition. - Tests page redesign: TestSectionCard + PhaseTileView replacing the old TestPlanView/TestRunningView/TestDoneView/TestPreconditionsView/ TestSectionView controls and their VMs. - Pump command sliders: Fluent thick-track style with overhang thumb, click-anywhere-and-drag, mouse-wheel adjustment. - Window startup: app.manifest declares PerMonitorV2 DPI awareness, MainWindow installs a WM_GETMINMAXINFO hook in OnSourceInitialized and maximizes there (after the hook is in place) so the app fits the work area exactly on any display configuration. - Misc: PercentToPixelsConverter, seed_aliases.py one-shot pump-alias importer, tools/Import-BipStatus.ps1, kline_eeprom_spec.md and dump-functions reference docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
76 lines
3.2 KiB
C#
76 lines
3.2 KiB
C#
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using HC_APTBS.Models;
|
|
|
|
namespace HC_APTBS.Services
|
|
{
|
|
/// <summary>
|
|
/// Minimal host-side contract supplying runtime context that the
|
|
/// <see cref="IAutoTestOrchestrator"/> cannot derive on its own
|
|
/// (e.g. <see cref="CurrentPump"/>, which is owned by a ViewModel).
|
|
/// Implemented by <c>MainViewModel</c>.
|
|
/// </summary>
|
|
public interface IAutoTestHost
|
|
{
|
|
/// <summary>Currently selected pump, if any.</summary>
|
|
PumpDefinition? CurrentPump { get; }
|
|
|
|
/// <summary>
|
|
/// Ensures the oil-pump relay is energised before the auto-test proceeds.
|
|
/// <list type="bullet">
|
|
/// <item>Returns <c>true</c> immediately if the pump is already on.</item>
|
|
/// <item>When <paramref name="skipConfirmation"/> is <c>true</c>, silently
|
|
/// starts the pump and returns <c>true</c>.</item>
|
|
/// <item>Otherwise, presents the leak-check confirmation dialog on the UI
|
|
/// thread. Returns <c>true</c> if the operator accepts (and the pump
|
|
/// is started), <c>false</c> if the operator cancels.</item>
|
|
/// </list>
|
|
/// Safe to call from the orchestrator's background execution — the host
|
|
/// marshals to the UI thread internally.
|
|
/// </summary>
|
|
Task<bool> EnsureOilPumpOnAsync(bool skipConfirmation);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Orchestrates the Dashboard "Connect & Auto Test" sequence.
|
|
///
|
|
/// <para>Drives a linear state machine (<see cref="AutoTestState"/>) that
|
|
/// connects the K-Line, reads the pump identification, runs the immobilizer
|
|
/// unlock (if required), energises the bench, starts the oil pump, and then
|
|
/// launches <see cref="IBenchService.RunTestsAsync"/>. Monitors liveness and
|
|
/// alarm transitions throughout so the sequence aborts safely on any failure,
|
|
/// requesting an emergency stop once the bench is energised.</para>
|
|
/// </summary>
|
|
public interface IAutoTestOrchestrator
|
|
{
|
|
/// <summary>Current state of the sequence.</summary>
|
|
AutoTestState State { get; }
|
|
|
|
/// <summary>
|
|
/// Raised on every state transition. The optional <c>detail</c> argument
|
|
/// carries phase-specific information (progress percent, phase name, etc.).
|
|
/// Marshalling to the UI thread is the subscriber's responsibility.
|
|
/// </summary>
|
|
event Action<AutoTestState, string?>? StateChanged;
|
|
|
|
/// <summary>
|
|
/// Raised once when the sequence aborts, before <see cref="State"/> transitions
|
|
/// to <see cref="AutoTestState.Aborted"/>.
|
|
/// </summary>
|
|
event Action<AutoTestFailureReason, string>? Failed;
|
|
|
|
/// <summary>
|
|
/// Runs the full auto-test sequence. Returns <c>true</c> on success,
|
|
/// <c>false</c> on any abort (failure reason is delivered via <see cref="Failed"/>).
|
|
/// </summary>
|
|
Task<bool> RunAsync(CancellationToken ct);
|
|
|
|
/// <summary>
|
|
/// Requests a cooperative cancellation of the in-flight sequence.
|
|
/// Safe to call when <see cref="State"/> is <see cref="AutoTestState.Idle"/>.
|
|
/// </summary>
|
|
void Cancel();
|
|
}
|
|
}
|