Files
HC_APTBS/Models/BipStatusDefinition.cs
LucianoDev 0280a2fad1 feat: page-based navigation shell + Tests page wizard
Replace the monolithic MainWindow with a SelectedPage-driven shell
(Dashboard / Pump / Bench / Tests / Results / Settings). The Tests
page gets the Plan -> Preconditions -> Running -> Done wizard from
ui-structure.md \u00a74, backed by a 7-item precondition gate and
shared sub-views (PhaseCardView / TestSectionView / GraphicIndicatorView)
extracted from the now-deleted monolithic TestPanelView.

New VMs / views:
- Tests wizard: TestPreconditions, PhaseCard, GraphicIndicator,
  TestSection, TestPlan, TestRunning, TestDone
- Dashboard panels: DashboardConnection, DashboardReadings,
  DashboardAlarms, InterlockBanner, ResultHistory
- Pump / bench panels: PumpIdentificationPanel, PumpLiveData,
  UnlockPanel, BenchDriveControl, BenchReadings, RelayBank,
  TemperatureControl, DtcList, AuthGate
- Dialogs: generic ConfirmDialog, UserManageDialog, UserPromptDialog

Supporting changes:
- IsOilPumpOn exposed on MainViewModel for precondition evaluation
- RequiresAuth added to TestDefinition (XML round-trip)
- BipStatusDefinition + CompletedTestRun models
- ~35 new Test.* localization keys (en + es)
- Settings moved from modal dialog to full page
- Pause / Retry / Skip stubs in TestRunningView; full spec in
  docs/gap-test-running-controls.md for follow-up implementation
- docs/ui-structure.md captures the wizard design

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-18 13:11:34 +02:00

63 lines
2.5 KiB
C#

using System.Collections.Generic;
using System.Linq;
namespace HC_APTBS.Models
{
// BIP (Begin of Injection Period) status definitions.
// Applies only to pre-injection PSG5-PI pumps (Type 2 T15xxx / Type 3 T18xxx Ford).
// Null on standard VP44 pumps.
//
// Data model only in this revision: runtime polling of a BIP capture source
// (KWP RAM read of ADR-S_BIP_HW_UW / 0x0106, or a dedicated CAN frame) is not
// yet wired. PumpBipDefinition.Match(ushort) is the seam for future work.
/// <summary>
/// One BIP-STATUS entry: a 16-bit HEX pattern matched against the captured BIP
/// status word, together with the reaction to apply on a match.
/// </summary>
public class BipStatusDefinition
{
/// <summary>Whether this definition participates in pattern matching.</summary>
public bool Enabled { get; set; } = true;
/// <summary>
/// 16-bit nibble pattern compared against the captured BIP status word.
/// Legacy examples: 0x0000 = BIP OK, 0x000F = no BIP in window,
/// 0x00F0 = no BIP + MV off, 0x0F00 = no MV drive, 0xF00F = deviation too large.
/// </summary>
public ushort HexPattern { get; set; }
/// <summary>
/// Reaction code applied on match:
/// 0 = none, 1 = abort (emergency stop), 2 = warning, 3 = log-only.
/// </summary>
public int Reaction { get; set; } = 0;
/// <summary>
/// Special-function marker from legacy CFG:
/// 9 = standard handling, 0xB = Ford timing-correction (Type 3 only).
/// </summary>
public int SpecialFunction { get; set; } = 9;
/// <summary>Human-readable description shown on match.</summary>
public string Description { get; set; } = string.Empty;
}
/// <summary>
/// Per-pump BIP status container. Holds up to 8 <see cref="BipStatusDefinition"/>
/// entries (max by legacy convention; not validated).
/// </summary>
public class PumpBipDefinition
{
/// <summary>Ordered BIP status definitions (max 8).</summary>
public List<BipStatusDefinition> Bits { get; set; } = new();
/// <summary>
/// Returns the first enabled definition whose <see cref="BipStatusDefinition.HexPattern"/>
/// exactly equals <paramref name="value"/>, or null if none match.
/// </summary>
public BipStatusDefinition? Match(ushort value) =>
Bits.FirstOrDefault(b => b.Enabled && b.HexPattern == value);
}
}