kopia lustrzana https://github.com/Hamlib/Hamlib
Initial commit of Kylix binding
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@862 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.1.3
rodzic
8ee1060e33
commit
c83b6359b1
|
@ -0,0 +1,426 @@
|
|||
unit HamlibComponents;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Types, Classes, QGraphics, QControls, QForms, QDialogs,
|
||||
hamlib_rigapi, hamlib_rotapi;
|
||||
|
||||
|
||||
type
|
||||
TFrequencyEvent = procedure(Sender: TObject; vfo: vfo_t; Freq: freq_t) of object;
|
||||
TVfoEvent = procedure(Sender: TObject; vfo: vfo_t) of object;
|
||||
TModeEvent = procedure(Sender: TObject; vfo: vfo_t; mode: rmode_t) of object;
|
||||
|
||||
TRigComponent = class(TComponent)
|
||||
private
|
||||
{ Private declarations }
|
||||
FRig: PRig;
|
||||
FOnFrequency: TFrequencyEvent;
|
||||
FOnVfo : TVfoEvent;
|
||||
FOnMode : TModeEvent;
|
||||
function GetModel: integer;
|
||||
function GetModelName: string;
|
||||
function GetMfgName: string;
|
||||
function GetTrn: integer;
|
||||
procedure SetTrn(Value: integer);
|
||||
protected
|
||||
{ Protected declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
constructor CreateRig(AOwner: TComponent; AModel: integer);
|
||||
destructor Destroy; override;
|
||||
|
||||
procedure OpenRig;
|
||||
procedure CloseRig;
|
||||
|
||||
procedure SetTransceive(trn: integer);
|
||||
function GetFreq(vfo: vfo_t): freq_t;
|
||||
procedure SetFreq(vfo: vfo_t; freq: freq_t);
|
||||
|
||||
function checkMagic: boolean;
|
||||
published
|
||||
{ Published declarations }
|
||||
property Model: integer read GetModel;
|
||||
property ModelName: string read GetModelName;
|
||||
property MfgName: string read GetMfgName;
|
||||
|
||||
property Transceive: integer read GetTrn write SetTrn default RIG_TRN_OFF;
|
||||
|
||||
property OnFrequency: TFrequencyEvent read FOnFrequency write FOnFrequency;
|
||||
property OnVFO: TVfoEvent read FOnVfo write FOnVfo;
|
||||
property OnMode: TModeEvent read FOnMode write FOnMode;
|
||||
end;
|
||||
|
||||
type
|
||||
TRotatorComponent = class(TComponent)
|
||||
private
|
||||
{ Private declarations }
|
||||
FRot: PRot;
|
||||
procedure SetMinAzim(const Value: float);
|
||||
procedure SetMaxAzim(const Value: float);
|
||||
procedure SetMinElev(const Value: float);
|
||||
procedure SetMaxElev(const Value: float);
|
||||
function GetMinAzim: float;
|
||||
function GetMaxAzim: float;
|
||||
function GetMinElev: float;
|
||||
function GetMaxElev: float;
|
||||
function GetModel: integer;
|
||||
protected
|
||||
{ Protected declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
constructor Create(AOwner : TComponent); override;
|
||||
constructor CreateRotator(AOwner : TComponent; AModel : Integer);
|
||||
destructor Destroy; override;
|
||||
|
||||
procedure OpenRotator;
|
||||
procedure CloseRotator;
|
||||
|
||||
procedure GetPosition(var Az: azimuth_t; var El: elevation_t);
|
||||
procedure SetPosition(var Az: azimuth_t; var El: elevation_t);
|
||||
procedure Stop;
|
||||
procedure Park;
|
||||
procedure Reset;
|
||||
|
||||
published
|
||||
{ Published declarations }
|
||||
property Model: integer read GetModel;
|
||||
property MinAzimuth: float read GetMinAzim write SetMinAzim;
|
||||
property MaxAzimuth: float read GetMaxAzim write SetMaxAzim;
|
||||
property MinElevation: float read GetMinElev write SetMinElev;
|
||||
property MaxElevation: float read GetMaxElev write SetMaxElev;
|
||||
end;
|
||||
|
||||
type
|
||||
ERigException = class(Exception);
|
||||
ERotatorException = class(Exception);
|
||||
|
||||
procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents('User', [TRigComponent, TRotatorComponent]);
|
||||
end;
|
||||
|
||||
constructor TRotatorComponent.Create(AOwner: TComponent);
|
||||
begin
|
||||
CreateRotator(AOwner, 1);
|
||||
end;
|
||||
|
||||
constructor TRotatorComponent.CreateRotator(AOwner: TComponent; AModel: rot_model_t);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
|
||||
{* Initialize the library for the spesified model *}
|
||||
FRot := rot_init(AModel);
|
||||
if (FRot = nil)
|
||||
then raise ERotatorException.Create('Rig initialization error');
|
||||
|
||||
with FRot^ do
|
||||
begin
|
||||
state.obj := Self; { Pointer back to TRotatorComponent }
|
||||
//callbacks.position_event := @position_callback; // TODO: have to implement this
|
||||
end;
|
||||
end;
|
||||
|
||||
destructor TRotatorComponent.Destroy;
|
||||
begin
|
||||
rot_cleanup(FRot);
|
||||
FRot := nil;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TRotatorComponent.OpenRotator;
|
||||
var
|
||||
retval: integer;
|
||||
begin
|
||||
retval := rot_open(FRot);
|
||||
if (retval <> RIG_OK)
|
||||
then raise ERotatorException.Create('rot_open: ' + StrPas(rigerror(retval)));
|
||||
end;
|
||||
|
||||
procedure TRotatorComponent.CloseRotator;
|
||||
var
|
||||
retval: integer;
|
||||
begin
|
||||
retval := rot_close(FRot);
|
||||
if (retval <> RIG_OK)
|
||||
then raise ERotatorException.Create('rot_close: ' + StrPas(rigerror(retval)));
|
||||
end;
|
||||
|
||||
procedure TRotatorComponent.GetPosition;
|
||||
var
|
||||
retval: integer;
|
||||
begin
|
||||
retval := rot_get_position(FRot, az, el);
|
||||
if (retval <> RIG_OK)
|
||||
then raise ERotatorException.Create('rot_get_position: ' + StrPas(rigerror(retval)));
|
||||
end;
|
||||
|
||||
procedure TRotatorComponent.SetPosition;
|
||||
var
|
||||
retval: integer;
|
||||
begin
|
||||
retval := rot_set_position(FRot, az, el);
|
||||
if (retval <> RIG_OK)
|
||||
then raise ERotatorException.Create('rot_set_position: ' + StrPas(rigerror(retval)));
|
||||
end;
|
||||
|
||||
procedure TRotatorComponent.Stop;
|
||||
var
|
||||
retval: integer;
|
||||
begin
|
||||
retval := rot_stop(FRot);
|
||||
if (retval <> RIG_OK)
|
||||
then raise ERotatorException.Create('rot_stop: ' + StrPas(rigerror(retval)));
|
||||
end;
|
||||
|
||||
procedure TRotatorComponent.Park;
|
||||
var
|
||||
retval: integer;
|
||||
begin
|
||||
retval := rot_park(FRot);
|
||||
if (retval <> RIG_OK)
|
||||
then raise ERotatorException.Create('rot_park: ' + StrPas(rigerror(retval)));
|
||||
end;
|
||||
|
||||
procedure TRotatorComponent.Reset;
|
||||
var
|
||||
retval: integer;
|
||||
begin
|
||||
retval := rot_reset(FRot, 0);
|
||||
if (retval <> RIG_OK)
|
||||
then raise ERotatorException.Create('rot_reset: ' + StrPas(rigerror(retval)));
|
||||
end;
|
||||
|
||||
function TRotatorComponent.GetModel: integer;
|
||||
begin
|
||||
with FRot^ do
|
||||
result := Caps^.rot_model;
|
||||
end;
|
||||
|
||||
function TRotatorComponent.GetMinAzim: float;
|
||||
begin
|
||||
with FRot^ do
|
||||
result := State.min_az;
|
||||
end;
|
||||
|
||||
function TRotatorComponent.GetMaxAzim: float;
|
||||
begin
|
||||
with FRot^ do
|
||||
result := State.max_az;
|
||||
end;
|
||||
|
||||
function TRotatorComponent.GetMinElev: float;
|
||||
begin
|
||||
with FRot^ do
|
||||
result := State.min_el;
|
||||
end;
|
||||
|
||||
function TRotatorComponent.GetMaxElev: float;
|
||||
begin
|
||||
with FRot^ do
|
||||
result := State.max_el;
|
||||
end;
|
||||
|
||||
procedure TRotatorComponent.SetMinAzim(const Value: float);
|
||||
begin
|
||||
with FRot^ do
|
||||
State.min_az := Value;
|
||||
end;
|
||||
|
||||
procedure TRotatorComponent.SetMaxAzim(const Value: float);
|
||||
begin
|
||||
with FRot^ do
|
||||
State.max_az := Value;
|
||||
end;
|
||||
|
||||
procedure TRotatorComponent.SetMinElev(const Value: float);
|
||||
begin
|
||||
with FRot^ do
|
||||
State.min_el := Value;
|
||||
end;
|
||||
|
||||
procedure TRotatorComponent.SetMaxElev(const Value: float);
|
||||
begin
|
||||
with FRot^ do
|
||||
State.max_el := Value;
|
||||
end;
|
||||
|
||||
(*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* TRigComponent
|
||||
*
|
||||
*)
|
||||
|
||||
function freq_callback(rig: PRig; vfo: vfo_t; freq: freq_t): integer; cdecl;
|
||||
var
|
||||
component: TRigComponent;
|
||||
begin
|
||||
rig_debug(RIG_DEBUG_TRACE, 'Inside the callback: freq_callback...'+chr($a));
|
||||
component := rig^.state.obj;
|
||||
with component do
|
||||
begin
|
||||
if Assigned(FOnFrequency)
|
||||
then FOnFrequency(component, vfo, freq);
|
||||
end;
|
||||
result := 1;
|
||||
end;
|
||||
|
||||
{* These callback still have to be implemented
|
||||
*
|
||||
function mode_callback(rig: PRig; vfo: vfo_t; mode: rmode; width: pbwidth_t): integer; cdecl;
|
||||
function vfo_callback(rig: PRig; vfo: vfo_t; freq_t: freq_t): integer; cdecl;
|
||||
function ptt_callback(rig: PRig; mode: ptt_t): integer; cdecl;
|
||||
function dcd_callback(rig: PRig; mode: dcd_t): integer; cdecl;
|
||||
*
|
||||
*}
|
||||
|
||||
constructor TRigComponent.CreateRig(AOwner: TComponent; AModel: integer);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
|
||||
{* Initialize the library for the spesified model *}
|
||||
FRig := rig_init(AModel);
|
||||
if (FRig = nil)
|
||||
then raise ERigException.Create('Rig initialization error');
|
||||
|
||||
with FRig^ do
|
||||
begin
|
||||
state.obj := Self; { Pointer back to TRigComponent }
|
||||
callbacks.freq_event := @freq_callback;
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TRigComponent.Create(AOwner: TComponent);
|
||||
begin
|
||||
CreateRig(AOwner, 1); { Use Dummy by default }
|
||||
end;
|
||||
|
||||
|
||||
destructor TRigComponent.Destroy;
|
||||
begin
|
||||
rig_cleanup(FRig);
|
||||
FRig := nil;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
{*
|
||||
* Because FRig is initialized with constructor and cleared with the
|
||||
* destructor, all methods will assume that FRig != NIL during the life
|
||||
* of the object.
|
||||
*}
|
||||
|
||||
procedure TRigComponent.OpenRig;
|
||||
var
|
||||
retval: integer;
|
||||
begin
|
||||
retval := rig_open(FRig);
|
||||
if (retval <> RIG_OK)
|
||||
then raise ERigException.Create('rig_open: ' + StrPas(rigerror(retval)));
|
||||
end;
|
||||
|
||||
procedure TRigComponent.CloseRig;
|
||||
var
|
||||
retval: integer;
|
||||
begin
|
||||
retval := rig_close(FRig);
|
||||
if (retval <> RIG_OK)
|
||||
then raise ERigException.Create('rig_close: ' + StrPas(rigerror(retval)));
|
||||
end;
|
||||
|
||||
function TRigComponent.GetModel: integer;
|
||||
begin
|
||||
result := FRig^.caps^.rig_model;
|
||||
end;
|
||||
|
||||
function TRigComponent.GetModelName: string;
|
||||
begin
|
||||
result := StrPas(FRig^.caps^.model_name);
|
||||
end;
|
||||
|
||||
function TRigComponent.GetMfgName: string;
|
||||
begin
|
||||
result := StrPas(FRig^.caps^.mfg_name);
|
||||
end;
|
||||
|
||||
function TRigComponent.GetTrn: integer;
|
||||
var
|
||||
retval : integer;
|
||||
trn : integer;
|
||||
begin
|
||||
retval := rig_get_trn(FRig, trn);
|
||||
if (retval <> RIG_OK)
|
||||
then raise ERigException.Create('rig_get_trn: ' + StrPas(rigerror(retval)));
|
||||
result := trn;
|
||||
end;
|
||||
|
||||
procedure TRigComponent.SetTrn(Value: integer);
|
||||
var
|
||||
retval: integer;
|
||||
begin
|
||||
retval := rig_set_trn(FRig, Value);
|
||||
if (retval <> RIG_OK) and (retval <> -RIG_ENAVAIL)
|
||||
then raise ERigException.Create('rig_set_trn: ' + StrPas(rigerror(retval)));
|
||||
end;
|
||||
|
||||
function TRigComponent.GetFreq(vfo: vfo_t): freq_t;
|
||||
var
|
||||
freq: freq_t;
|
||||
retval: integer;
|
||||
begin
|
||||
freq := 0;
|
||||
|
||||
retval := rig_get_freq(FRig, vfo, freq);
|
||||
if (retval <> RIG_OK)
|
||||
then raise ERigException.Create('rig_get_freq: ' + StrPas(rigerror(retval)));
|
||||
|
||||
result := freq;
|
||||
end;
|
||||
|
||||
procedure TRigComponent.SetFreq(vfo: vfo_t; freq: freq_t);
|
||||
var
|
||||
retval: integer;
|
||||
begin
|
||||
retval := rig_set_freq(FRig, vfo, freq);
|
||||
if (retval <> RIG_OK)
|
||||
then raise ERigException.Create('rig_set_freq: ' + StrPas(rigerror(retval)));
|
||||
end;
|
||||
|
||||
procedure TRigComponent.SetTransceive(trn: integer);
|
||||
var
|
||||
retval: integer;
|
||||
begin
|
||||
retval := rig_set_trn(FRig, trn);
|
||||
if (retval <> RIG_OK)
|
||||
then raise ERigException.Create('rig_set_trn: ' + StrPas(rigerror(retval)));
|
||||
|
||||
{ Note: This will cause a SIGIO interruption. The application will handle
|
||||
the SIGIO. Please disable SIGIO handling in the debugger, else the
|
||||
debugger will interrupt the program.
|
||||
Menu: Tools|Debugger Options|Signals
|
||||
}
|
||||
end;
|
||||
|
||||
function TRigComponent.checkMagic: boolean;
|
||||
begin
|
||||
{$IFDEF HAVE_MAGIC_NUMBERS}
|
||||
result := rigapi_check_magic(FRig) = 0;
|
||||
{$ELSE}
|
||||
result := true;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
|
||||
end.
|
|
@ -0,0 +1,31 @@
|
|||
hamlib for Borland's Kylix
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This is a Kylix binding for use with Hamlib. Binding consists of three files:
|
||||
|
||||
hamlib_rigapi.pas :
|
||||
|
||||
This file have the same function as `rig.h' for the C language. This
|
||||
file should also be kept synchronized with `rig.h`.
|
||||
|
||||
hamlib_rotapi.pas
|
||||
|
||||
This file have the same function as `rotator.h' for the C language. This
|
||||
file should be kept synchronized with 'rotator.h'.
|
||||
|
||||
HamlibComponents.pas
|
||||
|
||||
This file contain two components that encapsulate the rig and rotator
|
||||
frontends. It is very simular to the C++ class.
|
||||
|
||||
|
||||
A simple test program is included in the tests/ directory. It implements
|
||||
a selection dialog and a very simple Radio Control dialog.
|
||||
|
||||
This binding was develop with Borland Kylix Open Edition Ver 2.0. Open Edition
|
||||
is freely downloadable from Borland's website for use with GPL projects.
|
||||
http://www.borland.com/kylix/
|
||||
|
||||
Contributors:
|
||||
Francois Retief <fgretief@sun.ac.za>
|
||||
|
Plik diff jest za duży
Load Diff
|
@ -0,0 +1,246 @@
|
|||
unit hamlib_rotapi;
|
||||
|
||||
interface
|
||||
|
||||
Uses
|
||||
hamlib_rigapi;
|
||||
|
||||
{$MINENUMSIZE 4}
|
||||
{* The $MINENUMSIZE directive controls the
|
||||
* minimum storage size of enumerated types. *}
|
||||
|
||||
{$UNDEF HAVE_MAGIC_NUMBERS}
|
||||
|
||||
{$IFDEF HAVE_MAGIC_NUMBERS}
|
||||
const
|
||||
ROT_MAGIC = $12348889;
|
||||
ROT_MAGIC_CAPS = $12348899;
|
||||
ROT_MAGIC_STATE = $12348999;
|
||||
ROT_MAGIC_CALLBACKS = $12349999;
|
||||
{$ENDIF}
|
||||
|
||||
const
|
||||
ROT_FLAG_AZIMUTH = (1 shl 1);
|
||||
ROT_FLAG_ELEVATION = (1 shl 2);
|
||||
ROT_TYPE_OTHER = 0;
|
||||
|
||||
type
|
||||
elevation_t = float;
|
||||
azimuth_t = float;
|
||||
|
||||
rot_model_t = integer;
|
||||
rot_reset_t = integer;
|
||||
|
||||
PRot = ^TRot; // forward decleration
|
||||
|
||||
rot_caps = packed record
|
||||
rot_model : rot_model_t;
|
||||
model_name : PChar;
|
||||
mfg_name : PChar;
|
||||
version : PChar;
|
||||
copyright : PChar;
|
||||
status : rig_status_e;
|
||||
|
||||
rot_type : integer;
|
||||
port_type : rig_port_e;
|
||||
|
||||
serial_rate_min : integer;
|
||||
serial_rate_max : integer;
|
||||
serial_stop_bits : integer;
|
||||
serial_parity : serial_parity_e;
|
||||
serial_handshake_e : serial_handshake_e;
|
||||
|
||||
write_delay : integer;
|
||||
post_write_delay : integer;
|
||||
timeout : integer;
|
||||
retry : integer;
|
||||
|
||||
{*
|
||||
* Movement range, az is relative to North
|
||||
* negative values allowed for overlap
|
||||
*}
|
||||
min_az : azimuth_t;
|
||||
max_az : azimuth_t;
|
||||
min_el : elevation_t;
|
||||
max_el : elevation_t;
|
||||
|
||||
cfgparams : PConfparms;
|
||||
priv : rig_ptr_t;
|
||||
|
||||
{*
|
||||
* Rot Admin API
|
||||
*
|
||||
*}
|
||||
|
||||
rot_init : function(rot: PRot): integer; cdecl;
|
||||
rot_cleanup : function(rot: PRot): integer; cdecl;
|
||||
rot_open : function(rot: PRot): integer; cdecl;
|
||||
rot_close : function(rot: PRot): integer; cdecl;
|
||||
|
||||
set_conf : function(rot: PRot; token: token_t; val : PChar): integer; cdecl;
|
||||
get_conf : function(rot: PRot; token: token_t; val : PChar): integer; cdecl;
|
||||
|
||||
{*
|
||||
* General API commands, from most primitive to least.. :()
|
||||
* List Set/Get functions pairs
|
||||
*}
|
||||
set_position : function(rot: PRot; az: azimuth_t; el: elevation_t): integer; cdecl;
|
||||
get_position : function(rot: PRot; var az: azimuth_t; var el: elevation_t): integer; cdecl;
|
||||
|
||||
stop : function(rot: PRot): integer; cdecl;
|
||||
park : function(rot: PRot): integer; cdecl;
|
||||
|
||||
reset : function(rot: PRot; reset: rot_reset_t): integer; cdecl;
|
||||
|
||||
{* get firmware info, etc. *}
|
||||
get_info : function(rot: PRot): PChar; cdecl;
|
||||
|
||||
{* more to come... *}
|
||||
{$IFDEF HAVE_MAGIC_NUMBERS}
|
||||
magic : cardinal;
|
||||
{$ENDIF}
|
||||
end;
|
||||
TRotCaps = rot_caps;
|
||||
PRotCaps = ^TRotCaps;
|
||||
|
||||
{*
|
||||
* Rotator state
|
||||
*
|
||||
* This struct contains live data, as well as a copy of capability fields
|
||||
* that may be updated (ie. customized)
|
||||
*
|
||||
* It is fine to move fields around, as this kind of struct should
|
||||
* not be initialized like caps are.
|
||||
*}
|
||||
rot_state = packed record
|
||||
{*
|
||||
* overridable fields
|
||||
*}
|
||||
min_az : azimuth_t;
|
||||
max_az : azimuth_t;
|
||||
min_el : elevation_t;
|
||||
max_el : elevation_t;
|
||||
|
||||
{*
|
||||
* non overridable fields, internal use
|
||||
*}
|
||||
rotport : port_t;
|
||||
|
||||
comm_state : integer; {* opened or not *}
|
||||
{*
|
||||
* Pointer to private data
|
||||
*}
|
||||
priv : pointer;
|
||||
{*
|
||||
* internal use by hamlib++ & Kylix for event handling
|
||||
*}
|
||||
obj : pointer;
|
||||
|
||||
{* etc... *}
|
||||
|
||||
{$IFDEF HAVE_MAGIC_NUMBERS}
|
||||
magic: cardinal;
|
||||
{$ENDIF}
|
||||
end;
|
||||
TRotState = rot_state;
|
||||
PRotState = ^TRotState;
|
||||
|
||||
rot_callbacks = packed record
|
||||
position_event : function(rot: PRot; azim: azimuth_t; elev: elevation_t): integer; cdecl;
|
||||
|
||||
{ more to come }
|
||||
|
||||
{$IFDEF HAVE_MAGIC_NUMBERS}
|
||||
magic: cardinal;
|
||||
{$ENDIF}
|
||||
end;
|
||||
TRotCallbacks = rot_callbacks;
|
||||
PRotCallbacks = ^TRotCallbacks;
|
||||
|
||||
{*
|
||||
* struct rot is the master data structure,
|
||||
* acting as a handle for the controlled rotator.
|
||||
*}
|
||||
rot = packed record
|
||||
caps : PRotCaps;
|
||||
state : TRotState;
|
||||
callbacks : TRotCallbacks;
|
||||
{$IFDEF HAVE_MAGIC_NUMBERS}
|
||||
magic: cardinal;
|
||||
{$ENDIF}
|
||||
end;
|
||||
TRot = rot;
|
||||
//PRot = ^TRot; // declared above.
|
||||
|
||||
{* --------------- API function prototypes -----------------*}
|
||||
|
||||
function rot_init(rot_model: rot_model_t): PRot; cdecl;
|
||||
function rot_open(rot: PRot): integer; cdecl;
|
||||
function rot_close(rot: PRot): integer; cdecl;
|
||||
function rot_cleanup(rot: PRot): integer; cdecl;
|
||||
|
||||
function rot_set_conf(rot: PRot; token: token_t; val : PChar): integer; cdecl;
|
||||
function rot_get_conf(rot: PRot; token: token_t; val : PChar): integer; cdecl;
|
||||
|
||||
{*
|
||||
* General API commands, from most primitive to least.. )
|
||||
* List Set/Get functions pairs
|
||||
*}
|
||||
|
||||
function rot_set_position(rot: PRot; az: azimuth_t; el: elevation_t): integer; cdecl;
|
||||
function rot_get_position(rot: PRot; var az: azimuth_t; var el: elevation_t): integer; cdecl;
|
||||
|
||||
function rot_stop(rot: PRot): integer; cdecl;
|
||||
function rot_park(rot: PRot): integer; cdecl;
|
||||
function rot_reset(rot: PRot; reset: rot_reset_t): integer; cdecl;
|
||||
function rot_get_info(rot: PRot): PChar; cdecl;
|
||||
|
||||
function rot_register(caps: PRotCaps): integer; cdecl;
|
||||
function rot_unregister(rot_model: rot_model_t): integer; cdecl;
|
||||
|
||||
type __cfunc_1 = function(const _caps: TRotCaps; _data: pointer): integer; cdecl;
|
||||
function rot_list_foreach(cfunc : __cfunc_1; data: pointer): integer; cdecl;
|
||||
|
||||
function rot_load_backend(be_name: PChar): integer; cdecl;
|
||||
function rot_check_backend(rot_model: rot_model_t): integer; cdecl;
|
||||
function rot_load_all_backends: integer; cdecl;
|
||||
function rot_probe_all(p: port_t): rot_model_t; cdecl;
|
||||
|
||||
type __cfunc_2 = function(const _conf: TConfparms; _data: pointer): integer; cdecl;
|
||||
function rot_token_foreach(rot : PRot; cfunc: __cfunc_2; data: pointer): integer; cdecl;
|
||||
|
||||
function rot_confparam_lookup(rot: PRot; name: PChar): PConfparms; cdecl;
|
||||
function rot_token_lookup(rot: PRot; name: PChar): token_t; cdecl;
|
||||
|
||||
function rot_get_caps(rot_model: rot_model_t): PRotCaps; cdecl;
|
||||
|
||||
implementation
|
||||
|
||||
{* Note: hamlib_modulename is defined in hamlib_rigapi.pas *}
|
||||
|
||||
function rot_init; external hamlib_modulename name 'rot_init';
|
||||
function rot_open; external hamlib_modulename name 'rot_open';
|
||||
function rot_close; external hamlib_modulename name 'rot_close';
|
||||
function rot_cleanup; external hamlib_modulename name 'rot_cleanup';
|
||||
function rot_set_conf; external hamlib_modulename name 'rot_set_conf';
|
||||
function rot_get_conf; external hamlib_modulename name 'rot_get_conf';
|
||||
function rot_set_position; external hamlib_modulename name 'rot_set_position';
|
||||
function rot_get_position; external hamlib_modulename name 'rot_get_position';
|
||||
function rot_stop; external hamlib_modulename name 'rot_stop';
|
||||
function rot_park; external hamlib_modulename name 'rot_park';
|
||||
function rot_reset; external hamlib_modulename name 'rot_reset';
|
||||
function rot_get_info; external hamlib_modulename name 'rot_get_info';
|
||||
function rot_register; external hamlib_modulename name 'rot_register';
|
||||
function rot_unregister; external hamlib_modulename name 'rot_unregister';
|
||||
function rot_list_foreach; external hamlib_modulename name 'rot_list_foreach';
|
||||
function rot_load_backend; external hamlib_modulename name 'rot_load_backend';
|
||||
function rot_check_backend; external hamlib_modulename name 'rot_check_backend';
|
||||
function rot_load_all_backends; external hamlib_modulename name 'rot_load_all_backends';
|
||||
function rot_probe_all; external hamlib_modulename name 'rot_probe_all';
|
||||
function rot_token_foreach; external hamlib_modulename name 'rot_token_foreach';
|
||||
function rot_confparam_lookup; external hamlib_modulename name 'rot_confparam_lookup';
|
||||
function rot_token_lookup; external hamlib_modulename name 'rot_token_lookup';
|
||||
function rot_get_caps; external hamlib_modulename name 'rot_get_caps';
|
||||
|
||||
end.
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
program DemoProject;
|
||||
|
||||
uses
|
||||
QForms,
|
||||
hamlib_rigapi in '../hamlib_rigapi.pas',
|
||||
hamlib_rotapi in '../hamlib_rotapi.pas',
|
||||
HamlibComponents in '../HamlibComponents.pas',
|
||||
TestForm in 'TestForm.pas' {HamlibTestForm},
|
||||
HamlibSelectionDlg in 'HamlibSelectionDlg.pas' {ModelSelectionDlg},
|
||||
HamlibRadioForm in 'HamlibRadioForm.pas' {RadioForm};
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.Title := 'Hamlib Test Program';
|
||||
Application.CreateForm(THamlibTestForm, HamlibTestForm);
|
||||
Application.CreateForm(TModelSelectionDlg, ModelSelectionDlg);
|
||||
Application.CreateForm(TRadioForm, RadioForm);
|
||||
Application.Run;
|
||||
end.
|
Plik binarny nie jest wyświetlany.
|
@ -0,0 +1,123 @@
|
|||
unit HamlibRadioForm;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Types, Classes, Variants, QGraphics, QControls, QForms, QDialogs,
|
||||
QStdCtrls, QExtCtrls,
|
||||
HamlibComponents, hamlib_rigapi;
|
||||
|
||||
type
|
||||
TRadioForm = class(TForm)
|
||||
FreqPanel_vfoa: TPanel;
|
||||
FreqEdit_vfoa: TEdit;
|
||||
FreqLabel_vfoa: TLabel;
|
||||
Label2: TLabel;
|
||||
Panel1: TPanel;
|
||||
FreqLabel_vfob: TLabel;
|
||||
FreqEdit_vfob: TEdit;
|
||||
MHzLabel_vfob: TLabel;
|
||||
CloseButton: TButton;
|
||||
MagicCheckButton: TButton;
|
||||
FreqUpButton_vfoA: TButton;
|
||||
FreqDnButton_vfoa: TButton;
|
||||
FreqUpButton_vfob: TButton;
|
||||
FreqDnButton_vfob: TButton;
|
||||
procedure MagicCheckButtonClick(Sender: TObject);
|
||||
procedure FreqButton_Click(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
FRigComponent: TRigComponent;
|
||||
procedure RadioFreqCallback(Sender: TObject; vfo: vfo_t; Freq: freq_t);
|
||||
public
|
||||
{ Public declarations }
|
||||
function Execute(model: integer): integer;
|
||||
end;
|
||||
|
||||
var
|
||||
RadioForm: TRadioForm;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.xfm}
|
||||
|
||||
procedure TRadioForm.RadioFreqCallback(Sender: TObject; vfo: Integer; Freq: Int64);
|
||||
var
|
||||
edit: TEdit;
|
||||
begin
|
||||
if (vfo = RIG_VFO_A)
|
||||
then edit := FreqEdit_vfoa
|
||||
else edit := FreqEdit_vfob;
|
||||
edit.Text := Format('%.6f', [freq / 1.0e6]);
|
||||
end;
|
||||
|
||||
function TRadioForm.Execute(model: integer): integer;
|
||||
begin
|
||||
result := 0;
|
||||
try
|
||||
FRigComponent := TRigComponent.CreateRig(Self, model);
|
||||
FRigComponent.OnFrequency := RadioFreqCallback;
|
||||
FRigComponent.OpenRig;
|
||||
FRigComponent.Transceive := RIG_TRN_RIG;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, 'This is where the window is shown...'+chr($a));
|
||||
result := ShowModal;
|
||||
rig_debug(RIG_DEBUG_TRACE, 'Finished. Window is closed.'+chr($a));
|
||||
|
||||
FRigComponent.CloseRig;
|
||||
FRigComponent.Free;
|
||||
except
|
||||
on e: ERigException do
|
||||
begin
|
||||
ShowMessage('Error occured while using the rig: %s', [e.Message]);
|
||||
FRigComponent.CloseRig;
|
||||
FRigComponent.Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TRadioForm.FreqButton_Click(Sender: TObject);
|
||||
var
|
||||
newfreq : freq_t;
|
||||
deffreq: float;
|
||||
delta: freq_t;
|
||||
vfo: vfo_t;
|
||||
edit: TEdit;
|
||||
begin
|
||||
deffreq := 145.825;
|
||||
|
||||
if (Sender = FreqUpButton_vfoA) or (Sender = FreqDnButton_vfoA)
|
||||
then begin
|
||||
vfo := RIG_VFO_A;
|
||||
edit := FreqEdit_vfoa;
|
||||
end
|
||||
else begin
|
||||
vfo := RIG_VFO_B;
|
||||
edit := FreqEdit_vfob;
|
||||
end;
|
||||
|
||||
if (Sender = FreqUpButton_vfoA) or (Sender = FreqUpButton_vfoB)
|
||||
then delta := +5000 { Hz }
|
||||
else delta := -5000; { Hz }
|
||||
|
||||
newfreq := trunc( 1.0e6 * StrToFloatDef(edit.Text, deffreq));
|
||||
newfreq := newfreq + delta;
|
||||
try
|
||||
FRigComponent.SetFreq(vfo, newfreq);
|
||||
edit.text := Format('%.6f', [newfreq / 1.0e6]);
|
||||
except
|
||||
on e: ERigException do
|
||||
ShowMessage('Unable to set rig');
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TRadioForm.MagicCheckButtonClick(Sender: TObject);
|
||||
begin
|
||||
if FRigComponent.checkMagic
|
||||
then ShowMessage('Magic check succeded.')
|
||||
else ShowMessage('Magic check FAILED!!!');
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
object RadioForm: TRadioForm
|
||||
Left = 190
|
||||
Top = 208
|
||||
Width = 400
|
||||
Height = 157
|
||||
HorzScrollBar.Range = 379
|
||||
VertScrollBar.Range = 145
|
||||
ActiveControl = FreqEdit_vfoa
|
||||
Caption = 'Radio'
|
||||
Color = clBackground
|
||||
PixelsPerInch = 78
|
||||
TextHeight = 20
|
||||
TextWidth = 8
|
||||
object FreqPanel_vfoa: TPanel
|
||||
Left = 8
|
||||
Top = 8
|
||||
Width = 289
|
||||
Height = 65
|
||||
TabOrder = 0
|
||||
object FreqEdit_vfoa: TEdit
|
||||
Left = 80
|
||||
Top = 16
|
||||
Width = 121
|
||||
Height = 30
|
||||
Font.Color = clBlack
|
||||
Font.Height = 20
|
||||
Font.Name = 'Helvetica'
|
||||
Font.Pitch = fpVariable
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
Text = '145.825000'
|
||||
end
|
||||
object FreqLabel_vfoa: TLabel
|
||||
Left = 8
|
||||
Top = 24
|
||||
Width = 63
|
||||
Height = 22
|
||||
Caption = 'VFO A:'
|
||||
Font.Color = clBlack
|
||||
Font.Height = 20
|
||||
Font.Name = 'Helvetica'
|
||||
Font.Pitch = fpVariable
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 208
|
||||
Top = 24
|
||||
Width = 39
|
||||
Height = 22
|
||||
Caption = 'MHz'
|
||||
Font.Color = clBlack
|
||||
Font.Height = 20
|
||||
Font.Name = 'Helvetica'
|
||||
Font.Pitch = fpVariable
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object FreqUpButton_vfoA: TButton
|
||||
Left = 256
|
||||
Top = 0
|
||||
Width = 35
|
||||
Height = 33
|
||||
Caption = 'up'
|
||||
TabOrder = 3
|
||||
OnClick = FreqButton_Click
|
||||
end
|
||||
object FreqDnButton_vfoa: TButton
|
||||
Left = 256
|
||||
Top = 32
|
||||
Width = 33
|
||||
Height = 33
|
||||
Caption = 'dn'
|
||||
TabOrder = 4
|
||||
OnClick = FreqButton_Click
|
||||
end
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 8
|
||||
Top = 80
|
||||
Width = 289
|
||||
Height = 65
|
||||
Caption = 'Panel1'
|
||||
TabOrder = 1
|
||||
object FreqLabel_vfob: TLabel
|
||||
Left = 8
|
||||
Top = 24
|
||||
Width = 63
|
||||
Height = 22
|
||||
Caption = 'VFO B:'
|
||||
Font.Color = clBlack
|
||||
Font.Height = 20
|
||||
Font.Name = 'Helvetica'
|
||||
Font.Pitch = fpVariable
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object FreqEdit_vfob: TEdit
|
||||
Left = 80
|
||||
Top = 16
|
||||
Width = 121
|
||||
Height = 30
|
||||
Font.Color = clBlack
|
||||
Font.Height = 20
|
||||
Font.Name = 'Helvetica'
|
||||
Font.Pitch = fpVariable
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
TabOrder = 1
|
||||
Text = '436.250000'
|
||||
end
|
||||
object MHzLabel_vfob: TLabel
|
||||
Left = 208
|
||||
Top = 24
|
||||
Width = 39
|
||||
Height = 22
|
||||
Caption = 'MHz'
|
||||
Font.Color = clBlack
|
||||
Font.Height = 20
|
||||
Font.Name = 'Helvetica'
|
||||
Font.Pitch = fpVariable
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object FreqUpButton_vfob: TButton
|
||||
Left = 256
|
||||
Top = 0
|
||||
Width = 35
|
||||
Height = 33
|
||||
Caption = 'up'
|
||||
TabOrder = 3
|
||||
OnClick = FreqButton_Click
|
||||
end
|
||||
object FreqDnButton_vfob: TButton
|
||||
Left = 256
|
||||
Top = 32
|
||||
Width = 35
|
||||
Height = 33
|
||||
Caption = 'dn'
|
||||
TabOrder = 4
|
||||
OnClick = FreqButton_Click
|
||||
end
|
||||
end
|
||||
object CloseButton: TButton
|
||||
Left = 304
|
||||
Top = 56
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = '&Close'
|
||||
Default = True
|
||||
ModalResult = 1
|
||||
TabOrder = 2
|
||||
end
|
||||
object MagicCheckButton: TButton
|
||||
Left = 328
|
||||
Top = 120
|
||||
Width = 49
|
||||
Height = 25
|
||||
Caption = 'check'
|
||||
Enabled = False
|
||||
TabOrder = 3
|
||||
OnClick = MagicCheckButtonClick
|
||||
end
|
||||
end
|
|
@ -0,0 +1,122 @@
|
|||
unit HamlibSelectionDlg;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Types, Classes, Variants, QGraphics, QControls, QForms, QDialogs,
|
||||
QStdCtrls, QComCtrls, QExtCtrls,
|
||||
HamlibComponents, hamlib_rigapi, hamlib_rotapi;
|
||||
|
||||
type
|
||||
TModelSelectionDlg = class(TForm)
|
||||
BtnPanel: TPanel;
|
||||
ListView: TListView;
|
||||
OkBtn: TButton;
|
||||
CancelBtn: TButton;
|
||||
private
|
||||
{ Private declarations }
|
||||
FModelNr: integer;
|
||||
protected
|
||||
{ Protected declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
function ExecuteRig: Boolean;
|
||||
function ExecuteRotator: Boolean;
|
||||
published
|
||||
property ModelNr: integer read FModelNr write FModelNr default 1;
|
||||
end;
|
||||
|
||||
var
|
||||
ModelSelectionDlg: TModelSelectionDlg;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.xfm}
|
||||
|
||||
function rig_list_models(const caps : TRigCaps; data: pointer): integer; cdecl;
|
||||
var
|
||||
listview: TListView;
|
||||
listitem: TListItem;
|
||||
begin
|
||||
listview := data;
|
||||
with listview, caps do
|
||||
begin
|
||||
ListItem := Items.Add;
|
||||
ListItem.Caption := mfg_name;
|
||||
ListItem.SubItems.Add(model_name);
|
||||
ListItem.SubItems.Add(version);
|
||||
ListItem.Data := @caps;
|
||||
end;
|
||||
result := 1;
|
||||
end;
|
||||
|
||||
function TModelSelectionDlg.ExecuteRig: Boolean;
|
||||
var
|
||||
caps: PRigCaps;
|
||||
status: integer;
|
||||
begin
|
||||
result := false;
|
||||
ListView.Items.Clear;
|
||||
|
||||
rig_load_all_backends;
|
||||
|
||||
status := rig_list_foreach(@rig_list_models, ListView);
|
||||
if (status <> RIG_OK )
|
||||
then raise ERigException.Create('RigError: '+ StrPas(RigError(status)));
|
||||
|
||||
status := ShowModal;
|
||||
if (status = mrOK)
|
||||
then begin
|
||||
if (ListView.Selected <> nil)
|
||||
then begin
|
||||
caps := ListView.Selected.Data;
|
||||
Modelnr := caps^.rig_model;
|
||||
end;
|
||||
result := true;
|
||||
end;
|
||||
end;
|
||||
|
||||
function rotator_list_models(const caps : TRotCaps; data: pointer): integer; cdecl;
|
||||
var
|
||||
listview: TListView;
|
||||
listitem: TListItem;
|
||||
begin
|
||||
listview := data;
|
||||
with listview, caps do
|
||||
begin
|
||||
ListItem := Items.Add;
|
||||
ListItem.Caption := mfg_name;
|
||||
ListItem.SubItems.Add(model_name);
|
||||
ListItem.SubItems.Add(version);
|
||||
ListItem.Data := @caps;
|
||||
end;
|
||||
result := 1;
|
||||
end;
|
||||
|
||||
function TModelSelectionDlg.ExecuteRotator: Boolean;
|
||||
var
|
||||
caps: PRotCaps;
|
||||
status: integer;
|
||||
begin
|
||||
result := false;
|
||||
ListView.Items.Clear;
|
||||
|
||||
rot_load_all_backends;
|
||||
|
||||
status := rot_list_foreach(@rotator_list_models, ListView);
|
||||
if (status <> RIG_OK )
|
||||
then raise ERigException.Create('RotatorError: '+ StrPas(RigError(status)));
|
||||
|
||||
status := ShowModal;
|
||||
if (status = mrOK)
|
||||
then begin
|
||||
if (ListView.Selected <> nil)
|
||||
then begin
|
||||
caps := ListView.Selected.Data;
|
||||
Modelnr := caps^.rot_model;
|
||||
end;
|
||||
result := true;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
|
@ -0,0 +1,72 @@
|
|||
object ModelSelectionDlg: TModelSelectionDlg
|
||||
Left = 190
|
||||
Top = 157
|
||||
Width = 423
|
||||
Height = 297
|
||||
HorzScrollBar.Range = 105
|
||||
ActiveControl = ListView
|
||||
Caption = 'Select a model:'
|
||||
Color = clBackground
|
||||
Position = poMainFormCenter
|
||||
PixelsPerInch = 78
|
||||
TextHeight = 20
|
||||
TextWidth = 8
|
||||
object BtnPanel: TPanel
|
||||
Left = 318
|
||||
Top = 0
|
||||
Width = 105
|
||||
Height = 297
|
||||
Align = alRight
|
||||
BevelOuter = bvNone
|
||||
TabOrder = 0
|
||||
object OkBtn: TButton
|
||||
Left = 15
|
||||
Top = 24
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = '&Ok'
|
||||
Default = True
|
||||
ModalResult = 1
|
||||
TabOrder = 0
|
||||
end
|
||||
object CancelBtn: TButton
|
||||
Left = 15
|
||||
Top = 64
|
||||
Width = 75
|
||||
Height = 25
|
||||
Cancel = True
|
||||
Caption = '&Cancel'
|
||||
ModalResult = 2
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
object ListView: TListView
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 318
|
||||
Height = 297
|
||||
Align = alClient
|
||||
BorderStyle = bsSunkenPanel
|
||||
Columns = <
|
||||
item
|
||||
Caption = 'Manufacturer'
|
||||
Width = 120
|
||||
end
|
||||
item
|
||||
Caption = 'Model'
|
||||
Width = 95
|
||||
end
|
||||
item
|
||||
Caption = 'Version'
|
||||
Width = 80
|
||||
end>
|
||||
Items.Data = {
|
||||
3E00000001000000FFFFFFFFFFFFFFFFFFFFFFFF02000000000000000E48616D
|
||||
6C69622054657374696E670544756D6D7903302E30FFFFFFFFFFFFFFFF00}
|
||||
RowSelect = True
|
||||
ShowColumnSortIndicators = True
|
||||
Sorted = True
|
||||
TabOrder = 1
|
||||
ViewStyle = vsReport
|
||||
end
|
||||
end
|
|
@ -0,0 +1,75 @@
|
|||
unit TestForm;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Types, Classes, Variants, QGraphics, QControls, QForms, QDialogs,
|
||||
QStdCtrls, QExtCtrls, QComCtrls,
|
||||
hamlib_rigapi, hamlib_rotapi, HamlibComponents,
|
||||
HamlibSelectionDlg, HamlibRadioForm;
|
||||
|
||||
type
|
||||
THamlibTestForm = class(TForm)
|
||||
Panel1: TPanel;
|
||||
Memo1: TMemo;
|
||||
Panel2: TPanel;
|
||||
RigButton: TButton;
|
||||
RotatorButton: TButton;
|
||||
APIcheckButton: TButton;
|
||||
AboutLabel: TLabel;
|
||||
procedure RigButtonClick(Sender: TObject);
|
||||
procedure RotatorButtonClick(Sender: TObject);
|
||||
procedure APIcheckButtonClick(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
HamlibTestForm: THamlibTestForm;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.xfm}
|
||||
|
||||
procedure THamlibTestForm.RigButtonClick(Sender: TObject);
|
||||
begin
|
||||
ModelSelectionDlg.ModelNr := 6666; { Default value }
|
||||
if ModelSelectionDlg.ExecuteRig
|
||||
then begin
|
||||
try
|
||||
Memo1.Lines.Add('Selected model number = '
|
||||
+ IntToStr(ModelSelectionDlg.ModelNr));
|
||||
|
||||
RadioForm.Execute(ModelSelectionDlg.ModelNr);
|
||||
except
|
||||
on e: ERigException do
|
||||
begin
|
||||
rig_debug(RIG_DEBUG_ERR, 'Error while using rig...'+chr($a));
|
||||
memo1.Lines.add('Error while using rig...');
|
||||
ShowException(e, exceptaddr);
|
||||
end;
|
||||
end; {try}
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure THamlibTestForm.RotatorButtonClick(Sender: TObject);
|
||||
begin
|
||||
ModelSelectionDlg.ModelNr := 1; { Default value }
|
||||
if ModelSelectionDlg.ExecuteRotator
|
||||
then begin
|
||||
Memo1.Lines.Add('Selected Rotator model number = '
|
||||
+ inttostr(ModelSelectionDlg.ModelNr));
|
||||
ShowMessage('Not implemented yet');
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure THamlibTestForm.APIcheckButtonClick(Sender: TObject);
|
||||
begin
|
||||
{* Test conducted on the API *}
|
||||
rig_check_types;
|
||||
rigapi_check_types;
|
||||
end;
|
||||
|
||||
end.
|
|
@ -0,0 +1,78 @@
|
|||
object HamlibTestForm: THamlibTestForm
|
||||
Left = 190
|
||||
Top = 110
|
||||
Width = 428
|
||||
Height = 267
|
||||
VertScrollBar.Range = 113
|
||||
ActiveControl = RigButton
|
||||
Caption = 'Hamlib Tests'
|
||||
Color = clBackground
|
||||
PixelsPerInch = 104
|
||||
TextHeight = 20
|
||||
TextWidth = 8
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 428
|
||||
Height = 113
|
||||
Align = alTop
|
||||
TabOrder = 0
|
||||
object Panel2: TPanel
|
||||
Left = 1
|
||||
Top = 1
|
||||
Width = 112
|
||||
Height = 111
|
||||
Align = alLeft
|
||||
TabOrder = 0
|
||||
object RigButton: TButton
|
||||
Left = 8
|
||||
Top = 8
|
||||
Width = 89
|
||||
Height = 25
|
||||
Caption = 'Radio'
|
||||
TabOrder = 0
|
||||
OnClick = RigButtonClick
|
||||
end
|
||||
object RotatorButton: TButton
|
||||
Left = 8
|
||||
Top = 40
|
||||
Width = 89
|
||||
Height = 25
|
||||
Caption = 'Rotator'
|
||||
TabOrder = 1
|
||||
OnClick = RotatorButtonClick
|
||||
end
|
||||
object APIcheckButton: TButton
|
||||
Left = 8
|
||||
Top = 72
|
||||
Width = 89
|
||||
Height = 25
|
||||
Caption = 'API check'
|
||||
TabOrder = 2
|
||||
OnClick = APIcheckButtonClick
|
||||
end
|
||||
end
|
||||
object AboutLabel: TLabel
|
||||
Left = 120
|
||||
Top = 24
|
||||
Width = 297
|
||||
Height = 49
|
||||
AutoSize = False
|
||||
Caption =
|
||||
'This is a very simple test application to verify some of the Ham' +
|
||||
'lib features.'
|
||||
WordWrap = True
|
||||
end
|
||||
end
|
||||
object Memo1: TMemo
|
||||
Left = 0
|
||||
Top = 113
|
||||
Width = 428
|
||||
Height = 154
|
||||
Align = alClient
|
||||
Lines.Strings = (
|
||||
'Demo & Test Program')
|
||||
ScrollBars = ssAutoBoth
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
Ładowanie…
Reference in New Issue