Files

125 lines
3.0 KiB
ObjectPascal

{
Copyright (C)
2026 - Uladzimir Karpenka, EW8BAK
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
}
unit UISync;
{$IFDEF FPC}
{$MODE Delphi}
{$ENDIF}
interface
uses
Classes, HPSDRNetwork;
type
TAddDeviceProc = procedure(const Dev: THPSDRDevice; const Entry: string) of object;
TUpdateStatusProc = procedure(FwdW, SWRV, SupplyV, SupplyA: Double;
PLLLock, HWPTT: Boolean; ADCOverload: Byte) of object;
TUpdateDDCSeqOrNoDeviceProc = procedure(DDCIdx: Integer; Seq: LongWord) of object;
TDeviceFoundSync = class
private
FCallback: TAddDeviceProc;
FDev: THPSDRDevice;
FEntry: string;
public
constructor Create(ACallback: TAddDeviceProc; const D: THPSDRDevice;
const E: string);
procedure Execute;
end;
TStatusUISync = class
private
FCallback: TUpdateStatusProc;
FFwdW: Double;
FSWRV: Double;
FSupplyV: Double;
FSupplyA: Double;
FPLLLock: Boolean;
FHWPTT: Boolean;
FADCOverload: Byte;
public
constructor Create(ACallback: TUpdateStatusProc;
FW, SW, SV, SA: Double; PLL, HWPTT: Boolean; ADCOverload: Byte);
procedure Execute;
end;
TDDCSeqSync = class
private
FCallback: TUpdateDDCSeqOrNoDeviceProc;
FDDCIdx: Integer;
FSeq: LongWord;
public
constructor Create(ACallback: TUpdateDDCSeqOrNoDeviceProc;
Idx: Integer; Seq: LongWord);
procedure Execute;
end;
implementation
constructor TDeviceFoundSync.Create(ACallback: TAddDeviceProc;
const D: THPSDRDevice; const E: string);
begin
inherited Create;
FCallback := ACallback;
FDev := D;
FEntry := E;
end;
procedure TDeviceFoundSync.Execute;
begin
FCallback(FDev, FEntry);
end;
constructor TStatusUISync.Create(ACallback: TUpdateStatusProc;
FW, SW, SV, SA: Double; PLL, HWPTT: Boolean; ADCOverload: Byte);
begin
inherited Create;
FCallback := ACallback;
FFwdW := FW;
FSWRV := SW;
FSupplyV := SV;
FSupplyA := SA;
FPLLLock := PLL;
FHWPTT := HWPTT;
FADCOverload := ADCOverload;
end;
procedure TStatusUISync.Execute;
begin
FCallback(FFwdW, FSWRV, FSupplyV, FSupplyA, FPLLLock, FHWPTT, FADCOverload);
end;
constructor TDDCSeqSync.Create(ACallback: TUpdateDDCSeqOrNoDeviceProc;
Idx: Integer; Seq: LongWord);
begin
inherited Create;
FCallback := ACallback;
FDDCIdx := Idx;
FSeq := Seq;
end;
procedure TDDCSeqSync.Execute;
begin
FCallback(FDDCIdx, FSeq);
end;
end.