unit uTestSpecAna;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, _GClass, AbLED, uRiff, uRiffIF;

type
  TfrmTestSpecAna = class(TForm)
    btnFileInUse: TButton;
    ledFileInUse: TAbLED;
    edFileName: TEdit;
    btnFileExist: TButton;
    ledFileExists: TAbLED;
    moSML: TMemo;
    btnSetSML: TButton;
    ledSetSML: TAbLED;
    btnSnapShot: TButton;
    procedure btnFileInUseClick(Sender: TObject);
    procedure btnFileExistClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure btnSetSMLClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure btnSnapShotClick(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmTestSpecAna: TfrmTestSpecAna;

implementation

{$R *.dfm}

uses uSpectrumAnalyzer, uSETICommon;

procedure TfrmTestSpecAna.btnFileExistClick(Sender: TObject);
begin
  if FileExists(edFileName.Text) then
  begin
    ledFileExists.LED.ColorOn := cllime;
    ledFileExists.Caption := 'Yes - File Exists';
  end
  else
  begin
    ledFileExists.LED.ColorOn := clRed;
    ledFileExists.Caption := 'No - File does not exist';
  end;
  ledFileExists.checked := true;
end;

procedure TfrmTestSpecAna.btnFileInUseClick(Sender: TObject);
var
  res: boolean;
begin
  If (uSETICommon.FileInUse(edFileName.Text)) then
  begin
    ledFileInUse.LED.ColorOn := clRed;
    ledFileInUse.Caption := 'Yes - In use';
  end

  else
  begin
    ledFileInUse.LED.ColorOn := cllime;
    ledFileInUse.Caption := 'No Ready to use';
  end;

  ledFileInUse.checked := true;
end;

procedure TfrmTestSpecAna.btnSetSMLClick(Sender: TObject);
var
  ansiSML: AnsiString;
  res: boolean;
begin
  { Jim Jim Jim - This is NOT calling the server its a direct call }
  frmSpecAna.WAVFileNameAtEOFrame := edFileName.Text;
  ansiSML := moSML.Text;
  res := frmSpecAna.setSML(ansiSML);
  ledSetSML.checked := res;
end;

procedure TfrmTestSpecAna.btnSnapShotClick(Sender: TObject);
begin

    frmSpecAna.setSnapShotRMT('x');
end;

procedure TfrmTestSpecAna.FormCreate(Sender: TObject);
begin
  ledFileInUse.checked := false;
  ledFileExists.checked := false;
  Caption := Caption + ' ' + intToStr(SizeOf(Pointer) * 8) + ' Bit Platform';
{$IF Defined( EUREKALOG )}
  Caption := Caption + (' + EurekaLog  , ');

{$IFEND}
end;

procedure TfrmTestSpecAna.FormClose(Sender: TObject; var Action: TCloseAction);
begin

  frmSpecAna.Close;
end;

end.
