Add \test command to rigctl -- first test routine is "cw"

https://github.com/Hamlib/Hamlib/issues/1281
pull/1330/head^2
Mike Black W9MDB 2023-07-04 17:31:07 -05:00
rodzic 52cba4630b
commit 24f17730f4
4 zmienionych plików z 52 dodań i 2 usunięć

Wyświetl plik

@ -17,9 +17,9 @@ DISTCLEANFILES = rigctl.log rigctl.sum testbcd.log testbcd.sum
bin_PROGRAMS = rigctl rigctld rigmem rigsmtr rigswr rotctl rotctld rigctlcom rigctltcp rigctlsync ampctl ampctld rigtestmcast rigtestmcastrx $(TESTLIBUSB)
#check_PROGRAMS = dumpmem testrig testrigopen testrigcaps testtrn testbcd testfreq listrigs testloc rig_bench testcache cachetest cachetest2 testcookie testgrid testsecurity
check_PROGRAMS = dumpmem testrig testrigopen testrigcaps testtrn testbcd testfreq listrigs testloc rig_bench testcache cachetest cachetest2 testcookie testgrid hamlibmodels
check_PROGRAMS = dumpmem testrig testrigopen testrigcaps testtrn testbcd testfreq listrigs testloc rig_bench testcache cachetest cachetest2 testcookie testgrid hamlibmodels testmW2power
RIGCOMMONSRC = rigctl_parse.c rigctl_parse.h dumpcaps.c dumpstate.c uthash.h
RIGCOMMONSRC = rigctl_parse.c rigctl_parse.h dumpcaps.c dumpstate.c uthash.h rig_tests.c rig_tests.h
ROTCOMMONSRC = rotctl_parse.c rotctl_parse.h dumpcaps_rot.c uthash.h
AMPCOMMONSRC = ampctl_parse.c ampctl_parse.h dumpcaps_amp.c uthash.h

30
tests/rig_tests.c 100644
Wyświetl plik

@ -0,0 +1,30 @@
#include <stdio.h>
#include <hamlib/rig.h>
#include <misc.h>
int rig_test_cw(RIG *rig)
{
char *s = "SOS SOS SOS SOS SOS SOS SOS SOS SOS SOS SOS SOS SOS";
//char *s = "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST";
int i;
ENTERFUNC;
for (i = 0; i < strlen(s); ++i)
{
char cw[2];
cw[0] = s[i];
cw[1] = '\0';
int retval = rig_send_morse(rig, RIG_VFO_CURR, cw);
hl_usleep(100*1000);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: rig_send_morse error: %s\n", __func__,
rigerror(retval));
}
}
RETURNFUNC(RIG_OK);
}

Wyświetl plik

@ -0,0 +1,3 @@
#include <hamlib/rig.h>
int rig_test_cw(RIG *rig);

Wyświetl plik

@ -36,6 +36,7 @@
#include <ctype.h>
#include <errno.h>
#include <getopt.h>
#include <rig_tests.h>
// If true adds some debug statements to see flow of rigctl parsing
int debugflow = 0;
@ -264,6 +265,7 @@ declare_proto_rig(set_lock_mode);
declare_proto_rig(get_lock_mode);
declare_proto_rig(send_raw);
declare_proto_rig(client_version);
declare_proto_rig(test);
/*
@ -379,6 +381,7 @@ static struct test_table test_list[] =
{ 0xa4, "send_raw", ACTION(send_raw), ARG_NOVFO | ARG_IN1 | ARG_IN2 | ARG_OUT3, "Terminator", "Command", "Send raw answer" },
{ 0xa5, "client_version", ACTION(client_version), ARG_NOVFO | ARG_IN1, "Version", "Client version" },
{ 0xa6, "get_vfo_list", ACTION(get_vfo_list), ARG_NOVFO },
{ 0xa7, "test", ACTION(test), ARG_NOVFO | ARG_IN, "routine" },
{ 0x00, "", NULL },
};
@ -2437,6 +2440,20 @@ declare_proto_rig(get_vfo_list)
RETURNFUNC2(RIG_OK);
}
/* '\test' */
declare_proto_rig(test)
{
ENTERFUNC2;
if (!strcmp(arg1, "?"))
{
fprintf(fout, "cw\n");
RETURNFUNC2(RIG_OK);
}
if (strcmp(arg1, "cw")==0) rig_test_cw(rig);
RETURNFUNC2(RIG_OK);
}
/* '\get_modes' */
declare_proto_rig(get_modes)
{