[WT-support] New Lua APIs
Laurent HAAS - F6FVY
f6fvy at free.fr
Wed Oct 7 12:44:41 CEST 2009
Hi
The current nightly build (4.2.0-dev Revision 184 or better) includes
several new Lua APIs regarding radios and windows management.
Please find below the list of available APIs of this dvpt version. You
can also find a list of constants known by the interpreter to facilitate
script writing.
We remind you that nightly builds are still dvpt versions, meaning that
despite of numerous tests, bugs can happen, and functionalities can be
modified before the official release.
73
Larry - F6FVY
=====================================================================
Class wtApp
===========
wtApp:TextCommand(Command)
Command is a WT text command
wtApp:AlertBox(Text)
wtApp:MessageBox(Text, Type, Title)
Type => See MessageBox options
Return the button pressed to exit the message (can be ignored)
wtApp:Sleep(Time)
Time is expressed in ms
wtApp:GetKeyState()
Returns the modifers keys status when the function is called
wtApp:SendKeyCode(KeyCode [, ModifiersKeys])
Send a key by its ASCII code
Keycode is an ASCII code
ModifiersKeys (optional) indicates the modifiers keys (Ctrl = 4, Alt =
2, Shift = 1, None = 0 - Can be combined)
If this argument is missing or -1, the current modifiers keys are used
wtApp:SendKey(Key [, ModifiersKeys])
Send key or string
Key is a single character or a string
ModifiersKeys (optional) indicates the modifiers keys (Ctrl = 4, Alt =
2, Shift = 1, None = 0 - Can be combined)
If this argument is missing or -1, the current modifiers keys are used
wtApp:SendFKey(Key [, ModifiersKeys])
Send Functions keys (and Insert and Plus)
Key is one of "F1".."F12" + "Insert" + "Plus" + "Esc"
ModifiersKeys (optional) indicates the modifiers keys (Ctrl = 4, Alt =
2, Shift = 1, None = 0 - Can be combined)
If this argument is missing or -1, the current modifiers keys are used
wtApp:SendAltKey(Key)
Key is a letter, a number, or a function key ("F1".."F12" + "Insert" +
"Plus" + "Esc")
wtApp:SendCtrlKey(Key)
Key is a letter, a number, or a function key ("F1".."F12" + "Insert" +
"Plus" + "Esc")
wtApp:InputText(Prompt, Title, Default)
If Title or Prompt is empty, a default text is used
wtApp:InputNumber(Prompt, Title, Default)
If Title or Prompt is empty, a default text is used
wtApp:InputInteger(Prompt, Title, Default)
If Title or Prompt is empty, a default text is used
wtApp:ShowWindow(ChildWndId)
Show the child window designated by its windowID (see the wtConstants list)
wtApp:HideWindow(ChildWndId)
Hide the child window designated by its windowID (see the wtConstants list)
wtApp:ToggleWindow(ChildWndId)
Toggle the child window designated by its windowID (see the wtConstants
list)
wtApp:WizzWindow(ChildWndId)
Wizz the child window designated by its windowID (see the wtConstants list)
wtApp:SetWindowColor(ChildWndId, nRed, nGreen, nBlue, nColorIndex)
Set the nColorIndex color of the child window designated by its windowID
(see the wtConstants list)
If ChildWndId is < 0, it applies to the main window.
If nColorIndex is omitted (or set to 0), it applies to the background color
All colors must be <= 255.
wtApp:CallScript(strScript)
Call a wts script (no extension required in strScript)
Can return a number only (or nothing)
wtApp:IsPostKeyProcess()
Return true if the current script is executed after the
assigned key has been processed by WT, and false otherwise
Class wtContest
===============
wtContest:IsExchangeRequired()
Return a boolean. True if the current contest requires an exchange
wtContest:GetContestId()
Return the current contest ID
Class wtKeyer
=============
wtKeyer:Play(Message)
Message is a plain string to be played, a saved message ($F1 etc.) or a
variable ($xxx)
wtKeyer:Stop()
Stop the current message
wtKeyer:GetCwSpeed()
Return the CW speed in wpm (return 0 in case of error)
wtKeyer:SetCwSpeed(Speed)
Class wtOp
==========
wtOp:GetCallsign()
Return the current op callsign
wtOp:GetNick()
Return the current op nick
Class wtQso
===========
wtQso:IsCallsignEmpty()
Return a boolean : True if the callsign field of the active Qso is empty
wtQso:IsCallsignIncomplete()
Return a boolean : True if the callsign field of the active Qso contains
a "?"
wtQso:IsExchangeEmpty()
Return a boolean : True if the exchange field of the active Qso is empty
wtQso:IsExchangeSent()
Return a boolean : True if the exchange of the active Qso has been sent
wtQso:SetExchangeSent()
Set the exchangeSent flag of the active Qso (see wtQso::IsExchangeSent())
wtQso:ResetExchangeSent()
Clear the exchangeSent flag of the active Qso (see wtQso::IsExchangeSent())
wtQso:ClearStatus()
Clear the status flags of the active Qso
wtQso:IsCallsignRepeated()
Return a boolean. True if the callsign hasn't changed
wtQso:IsOperatingModeRun()
Return a boolean. True if the operating mode of the active Qso is RUN
(and False if S&P)
wtQso:IsModePhone()
Return a boolean. True if the mode of the active Qso is Phone (SSB and
FM), and False otherwise
wtQso:GetModeId()
Return the mode ID of the active Qso
wtQso:IsQsoApproved()
Return a boolean. True if all requested fields of the active Qso are
filled (contest dependent)
wtQso:IsDupe()
Return a boolean. True if the current Q is a dupe
wtQso:IsCurrentFieldCallsign()
Return a boolean : True if the current field is the callsign field
wtQso:IsCurrentFieldExchange()
Return a boolean : True if the current field is an exchange field
wtQso:IsCurrentFieldOther()
Return a boolean : True if the current field is not the callsign field
or an exchange field
wtQso:IsCurrentFieldEmpty()
Return a boolean : True if the current field is empty (except RST for
the exchange field)
wtQso:IsCurrentFieldPrimaryRadio()
Return a boolean : True if the current field is in the primary radio
(main log)
wtQso:IsCurrentFieldSecondaryRadio()
Return a boolean : True if the current field is in the secondary radio
Class wtRadio
=============
See Class wtRadioGeneric
Class wtRadio1
==============
See Class wtRadioGeneric
Class wtRadio2
==============
See Class wtRadioGeneric
Class wtRadioGeneric
====================
CAUTION : The following functions can apply to:
wtRadio (the active one),
wtRadioInactive (the non-active one),
wtRadioPrimary (the one that is in the main log wnd)
wtRadioSecondary (the one that is in the secondary log wnd)
wtRadio1 and wtRadio2
WARNING : Some functions may not work
because of the CAT protocol or radio hardware limitations
wtRadio*:GetFreq()
Return freq of the active VFO of the designated radio
freq is expressed in kHz
wtRadio*:GetFreq(nVfo)
Return freq of the designated VFO (0 => VFO A, 1 => VFO B) of the
designated radio
freq is expressed in kHz
wtRadio*:GetFreqInactiveVfo()
Return freq of the inactive VFO of the designated radio
freq is expressed in kHz
wtRadio*:SetFreqfreq)
Set freq of the active VFO of the designated radio
freq is expressed in kHz
wtRadio*:SetFreq(freq, nVfo)
Set freq of the designated VFO (0 => VFO A, 1 => VFO B) of the
designated radio
freq is expressed in kHz
wtRadio*:SetFreqInactiveVfo(freq)
Set freq of the inactive VFO of the designated radio
freq is expressed in kHz
wtRadio*:SetFreqSubVfo(freq)
Set freq of the sub VFO of the designated radio
freq is expressed in kHz
wtRadio*:SetSplit(freq)
Set split ON and the split frequency on the designated radio
freq is expressed in kHz
wtRadio*:ResetSplit()
Reset split on the designated radio
wtRadio*:IsSplit()
Return false or true whether the split is set or not on the designated radio
wtRadio*:GetRadioId()
Return the radioID (0 => RADIO_1, 1 => RADIO_2) of the designated radio
wtRadio*:Send(catString)
Send the ASCII catString to the designated radio
wtRadio*:SendHex(hexString)
The hexString must contains only 0-9 and A-F characters
and must have a even length. Ex "02DFA8" etc.
Send the hexString to the designated radio
Class wtRadioInactive
=====================
See Class wtRadioGeneric
Class wtRadioPrimary
====================
See Class wtRadioGeneric
Class wtRadioSecondary
======================
See Class wtRadioGeneric
======================================================================
-- /!\ WARNING /!\
-- Constants are not guaranteed to remain constant in Lua.
-- The name of the constant could be accidentally reassigned to refer to
some other object or value.
-- Unfortunately, there is no easy way to generate code that prevents this.
-- You will just have to be careful.
-- Child windows IDs
WT_WND_SUMMARY = 0;
WT_WND_GRIDSQUAREMAP = 1;
WT_WND_CHECKPARTIAL = 2;
WT_WND_RATESHEET = 3;
WT_WND_CLOCK = 4;
WT_WND_VUMETER = 5;
WT_WND_RATE = 6;
WT_WND_GAB = 7;
WT_WND_MAP = 8;
WT_WND_CHECKCOUNTRY = 9;
WT_WND_ZONE = 10;
WT_WND_MULT = 11;
WT_WND_NP1 = 12;
WT_WND_RADIO1 = 13;
WT_WND_RADIO2 = 14;
WT_WND_PACKETCLUSTER = 15;
WT_WND_DXCLUSTERANN = 16;
WT_WND_SOLAR = 17;
WT_WND_PILEUP = 18;
WT_WND_STATUS = 19;
WT_WND_SKED = 20;
WT_WND_CHECKCALL = 21;
WT_WND_SECONDARYRADIO = 22;
WT_WND_RTTY1 = 23;
WT_WND_RTTY2 = 24;
WT_WND_QSYWIZARD = 25;
WT_WND_EXTRAINFO = 26;
WT_WND_ZONE2 = 27;
WT_WND_ROTATORS = 28;
WT_WND_CONTESTRECORDER = 29;
-- Supported contests IDs
WT_CONTEST_IARU_VHF = 1;
WT_CONTEST_IARU_UHF = 2;
WT_CONTEST_IARU_CW = 3;
WT_CONTEST_IARU_HF = 4;
WT_CONTEST_IARU_R1_50MHZ = 5;
WT_CONTEST_REF_THF = 10;
WT_CONTEST_REF_DDFM_50MHZ = 11;
WT_CONTEST_THF_EU = 20;
WT_CONTEST_THF_EU_50_70 = 21;
WT_CONTEST_THF_EU_GRIDSQUARE = 30;
WT_CONTEST_THF_EU_GRIDSQUARE_50_70 = 31;
WT_CONTEST_THF_EU_GRIDSQUARE_NO_DIST = 32;
WT_CONTEST_THF_EU_GRIDSQUARE_NO_DIST_50_70 = 33;
WT_CONTEST_REF_HF = 100;
WT_CONTEST_ARRL_DX = 101;
WT_CONTEST_ARRL_10 = 102;
WT_CONTEST_ARRL_160 = 103;
WT_CONTEST_ARRL_SWEEPSTAKES = 104;
WT_CONTEST_ARRL_FD = 105;
WT_CONTEST_ARRL_RU = 106;
WT_CONTEST_ARRL_UHF_AUG = 130;
WT_CONTEST_ARRL_VHF_JAN = 131;
WT_CONTEST_ARRL_VHF_JUN = 132;
WT_CONTEST_ARRL_VHF_SEP = 133;
WT_CONTEST_REF_160 = 150;
WT_CONTEST_CQWW_DX = 200;
WT_CONTEST_CQWW_WPX = 201;
WT_CONTEST_CQWW_160 = 202;
WT_CONTEST_CQWW_VHF = 250;
WT_CONTEST_RDXC = 300;
WT_CONTEST_RDAC = 301;
WT_CONTEST_CIS = 302;
WT_CONTEST_R_160 = 303;
WT_CONTEST_RRTC = 304;
WT_CONTEST_RAEM = 305;
WT_CONTEST_DXPEDITION_HF = 400;
WT_CONTEST_DXPEDITION_VHF = 410;
WT_CONTEST_ALL_ASIAN = 500;
WT_CONTEST_SPDXC = 600;
WT_CONTEST_JIDX = 700;
WT_CONTEST_KCJ = 701;
WT_CONTEST_KCJ_TOPBAND = 702;
WT_CONTEST_YUDXC = 800;
WT_CONTEST_CQM = 900;
WT_CONTEST_ARI = 1000;
WT_CONTEST_ARI_SEZIONI = 1001;
WT_CONTEST_ARI_40_80 = 1002;
WT_CONTEST_BALTIC = 1100;
WT_CONTEST_KING_OF_SPAIN = 1200;
WT_CONTEST_IOTA = 1300;
WT_CONTEST_RSGB_160 = 1301;
WT_CONTEST_RSGB_80_CC = 1302;
WT_CONTEST_RSGB_CMW = 1303;
WT_CONTEST_RSGB_15_10 = 1304;
WT_CONTEST_RSGB_AFS = 1305;
WT_CONTEST_WAEDC = 1400;
WT_CONTEST_WAG = 1401;
WT_CONTEST_DARC_XMAS = 1402;
WT_CONTEST_DARC_10 = 1403;
WT_CONTEST_YODXC = 1500;
WT_CONTEST_EU_HF = 1600;
WT_CONTEST_SCC = 1601;
WT_CONTEST_OCDXC = 1700;
WT_CONTEST_TOECC = 1800;
WT_CONTEST_SAC = 1900;
WT_CONTEST_NRAU_BALTIC = 1901;
WT_CONTEST_NAC = 1902;
WT_CONTEST_SARTG = 1903;
WT_CONTEST_QP_TX = 2000;
WT_CONTEST_EU_SPRINT = 2100;
WT_CONTEST_UKDXC = 2200;
WT_CONTEST_OKOMDXC = 2300;
WT_CONTEST_STEW_PERRY = 2400;
WT_CONTEST_GACW_DX = 2401;
WT_CONTEST_NINE_KCC_15 = 2402;
WT_CONTEST_FOC_MARATHON = 2403;
WT_CONTEST_LOTW = 2404;
WT_CONTEST_AP_SPRINT = 2405;
WT_CONTEST_JARTS = 2406;
WT_CONTEST_MARCONI_HF = 2407;
WT_CONTEST_LZDX = 2500;
WT_CONTEST_CROATIAN_CW = 2600;
WT_CONTEST_UBADX = 2700;
WT_CONTEST_UBA_SPRING_80M = 2701;
WT_CONTEST_UBA_SPRING_6M = 2702;
WT_CONTEST_UBA_SPRING_2M = 2703;
WT_CONTEST_ON_80M = 2704;
WT_CONTEST_ON_6M = 2705;
WT_CONTEST_ON_2M = 2706;
WT_CONTEST_RAC_DAY = 2800;
WT_CONTEST_RAC_WINTER = 2801;
WT_CONTEST_PACC = 2900;
WT_CONTEST_HELVETIA = 3000;
WT_CONTEST_HELVETIA_VHF = 3001;
WT_CONTEST_IARU_FD_R1_GENERIC = 3100;
WT_CONTEST_IARU_FD_R1_DARC = 3101;
WT_CONTEST_IARU_FD_R1_RSGB = 3102;
WT_CONTEST_UFT_HF = 3200;
WT_CONTEST_AGCW_HNY = 3300;
WT_CONTEST_HA_DX = 3400;
WT_CONTEST_NAQP = 3500;
WT_CONTEST_NA_SPRINT = 3501;
WT_CONTEST_NCCC_SPRINT = 3600;
WT_CONTEST_CQIR = 3700;
-- Supported modes IDs
WT_MODE_CW = 0;
WT_MODE_SSB = 1;
WT_MODE_RTTY = 2;
WT_MODE_FM = 3;
WT_MODE_PSK = 4;
WT_MODE_PKT = 5;
WT_MODE_HELL = 6;
WT_MODE_SAT = 7;
-- Status Keys IDs
WT_KEY_SHIFT = 1;
WT_KEY_ALT = 2;
WT_KEY_CTRL = 4;
-- Radio Constants
WT_RADIO_MAX = 2;
WT_RADIO_VFOA = 0;
WT_RADIO_VFOB = 1;
WT_RADIO_1 = 0;
WT_RADIO_2 = 1;
More information about the Support
mailing list