Phase 3 (WA2d): move web Band/XvtrBand handlers into the adapter

Now that RestoreBand and XVTR enter/exit are full controller commands, the web
Band and XvtrBand handlers carry no MainForm orchestration — move them to
TWebAdapter.OnBand/OnXvtrBand (validation + SaveCurrentBand/persist + command).
CAT Ctx.DoBandByIndex and CAT band up/down repointed to FWebAdapter.OnBand.

Remaining host-coupled web handlers: Freq/FreqA (ApplyVfoA channel orchestration),
Run/Connect/device CRUD (daemon entry).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Uladzimir Karpenka
2026-06-09 10:09:06 +03:00
co-authored by Claude Opus 4.8
parent cc8380ae85
commit 7630172e50
2 changed files with 44 additions and 54 deletions
+39 -1
View File
@@ -19,7 +19,7 @@ interface
uses
Classes, SysUtils,
RadioController, WebServer, WDSPEngine, HPSDRNetwork, HPSDRProtocol, BoardUtils;
RadioController, WebServer, WDSPEngine, HPSDRNetwork, HPSDRProtocol, BoardUtils, Settings;
type
// UI/оркестрационные операции, которые адаптер дёргает у хозяина (пока не
@@ -47,6 +47,8 @@ type
procedure SyncVolume;
procedure SyncDrive;
procedure SyncSpan;
procedure SyncBand;
procedure SyncXvtrBand;
procedure SyncWfAGC;
procedure SyncWfNF;
procedure SyncMute;
@@ -74,6 +76,8 @@ type
procedure OnVolume(V: Integer);
procedure OnDrive(V: Integer);
procedure OnSpan(Hz: Integer);
procedure OnBand(Idx: Integer);
procedure OnXvtrBand(Idx: Integer);
procedure OnWfAGC(On_: Boolean);
procedure OnWfNF(On_: Boolean);
procedure OnMute(On_: Boolean);
@@ -160,6 +164,40 @@ begin FSyncInt := V; FController.Invoke(@SyncDrive); end;
procedure TWebAdapter.SyncDrive;
begin FController.SetDrive(FSyncInt); end; // rfDrive снимет память канала (ChannelController)
procedure TWebAdapter.OnBand(Idx: Integer);
begin FSyncInt := Idx; FController.Invoke(@SyncBand); end;
procedure TWebAdapter.SyncBand;
// Смена HF-диапазона из web/CAT. Выход из XVTR (если активен) + persist + restore.
begin
if (FSyncInt < 0) or (FSyncInt >= CFG_BAND_COUNT) then Exit;
if FController.FCurrentXvtr >= 0 then
begin
FController.SetXvtrBand(-1); // выход в HF (DeactivateXvtr несёт HF-возврат)
if FSyncInt = FController.FCurrentBand then Exit;
end
else if FSyncInt = FController.FCurrentBand then
Exit;
if FController.FDevConnected then
begin FController.SaveCurrentBand; FController.FSettings.Save; end;
FController.FCurrentBand := FSyncInt;
FController.RestoreBand(FController.FCurrentBand);
end;
procedure TWebAdapter.OnXvtrBand(Idx: Integer);
begin FSyncInt := Idx; FController.Invoke(@SyncXvtrBand); end;
procedure TWebAdapter.SyncXvtrBand;
begin
if FSyncInt < 0 then begin FController.SetXvtrBand(-1); Exit; end;
if FSyncInt >= CFG_XVTR_COUNT then Exit;
if not FController.FXvtrSettings.Entries[FSyncInt].Enabled then Exit;
if FSyncInt = FController.FCurrentXvtr then Exit;
if FController.FDevConnected then
begin FController.SaveCurrentBand; FController.FSettings.Save; end;
FController.SetXvtrBand(FSyncInt); // ActivateXvtr (рендер/wideband/web — rfXvtr)
end;
procedure TWebAdapter.OnSpan(Hz: Integer);
begin FSyncInt := Hz; FController.Invoke(@SyncSpan); end;