Files
HC_APTBS/Services/IUnlockService.cs
LucianoDev 37d099cdbd feat: add Ford VP44 unlock progress dialog, K-Line fast unlock, localization, safety dialogs, and settings
Unlock progress UI:
- UnlockProgressDialog with dark-themed progress ring, phase indicator, elapsed
  time, and cancel/close buttons (non-modal, draggable borderless window)
- UnlockProgressViewModel with event-driven progress tracking via IUnlockService
- Triggers on pump selection (manual or K-Line auto-detect), not test start

UnlockService rewrite:
- Persistent CAN senders that outlive the unlock sequence (StopSenders on pump change)
- Concurrent K-Line fast unlock: awaits session Connected, sends RAM timer shortcut
  ({02 88 02 03 A8 01 00}), verifies via CAN TestUnlock before skipping wait
- Fix Type 1 verification (Value == 0 means unlocked, was inverted)

K-Line fast unlock support:
- IKwpService.TryFastUnlockAsync / KwpService implementation

Additional features:
- ILocalizationService with ES/EN resource dictionaries and runtime switching
- Safety dialogs: VoltageWarning, OilPumpConfirm, RpmSafetyWarning
- SettingsDialog for app configuration
- BenchService enhancements, ConfigurationService improvements, PDF report updates
- All UI strings localized via DynamicResource

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 13:22:48 +02:00

38 lines
1.5 KiB
C#

using System;
using System.Threading;
using System.Threading.Tasks;
using HC_APTBS.Models;
namespace HC_APTBS.Services
{
/// <summary>
/// Manages the immobilizer unlock sequence required by certain pump ECUs
/// (e.g. Ford VP44 models) before they respond to test commands.
/// </summary>
public interface IUnlockService
{
/// <summary>Raised with progress text during the unlock sequence.</summary>
event Action<string>? StatusChanged;
/// <summary>Raised when the unlock sequence completes. Argument is true if successful.</summary>
event Action<bool>? UnlockCompleted;
/// <summary>
/// Runs the immobilizer unlock sequence for the given pump.
/// Returns immediately if <see cref="PumpDefinition.UnlockType"/> is 0 (no unlock needed).
/// The persistent CAN senders remain active after this method returns;
/// call <see cref="StopSenders"/> when the pump is deselected.
/// </summary>
/// <param name="pump">Pump definition with unlock type and CAN parameters.</param>
/// <param name="ct">Cancellation token to abort the unlock sequence.</param>
Task UnlockAsync(PumpDefinition pump, CancellationToken ct);
/// <summary>
/// Stops the persistent CAN unlock senders. Call this when the pump is
/// deselected or the application is shutting down. Safe to call when no
/// senders are active.
/// </summary>
void StopSenders();
}
}