Add rig_get_mode_bandwidths -- see NEWS

Return token set of bandwidths for given mode
pull/691/head
Mike Black W9MDB 2021-05-03 15:35:56 -05:00
rodzic 5bafde9ae6
commit 78a697e582
3 zmienionych plików z 56 dodań i 2 usunięć

6
NEWS
Wyświetl plik

@ -8,6 +8,12 @@ Please send Hamlib bug reports to hamlib-developer@lists.sourceforge.net
Version 4.2 Version 4.2
* 2021-04-27 * 2021-04-27
* New rig_get_mode_bandwidths -- returns token set for bandwidths for given mode
Rig command: \get_mode_bandwidths CW
Mode=CW
Normal=500Hz
Narrow=50Hz
Wide=2400Hz
* New rig_get_info -- returns token set for all vfos where order does not matter * New rig_get_info -- returns token set for all vfos where order does not matter
This is a string return to allow for easy future expansion without changing the API This is a string return to allow for easy future expansion without changing the API
New tokens may be introduced and can be skipped if not used by clients New tokens may be introduced and can be skipped if not used by clients

Wyświetl plik

@ -2367,6 +2367,10 @@ pbwidth_t HAMLIB_API rig_passband_normal(RIG *rig, rmode_t mode)
rs = &rig->state; rs = &rig->state;
// return CW for CWR and RTTY for RTTYR
if (mode == RIG_MODE_CWR) mode = RIG_MODE_CW;
if (mode == RIG_MODE_RTTYR) mode = RIG_MODE_RTTY;
for (i = 0; i < HAMLIB_FLTLSTSIZ && rs->filters[i].modes; i++) for (i = 0; i < HAMLIB_FLTLSTSIZ && rs->filters[i].modes; i++)
{ {
if (rs->filters[i].modes & mode) if (rs->filters[i].modes & mode)

Wyświetl plik

@ -165,6 +165,7 @@ declare_proto_rig(get_xit);
declare_proto_rig(set_mode); declare_proto_rig(set_mode);
declare_proto_rig(get_mode); declare_proto_rig(get_mode);
declare_proto_rig(get_modes); declare_proto_rig(get_modes);
declare_proto_rig(get_mode_bandwidths);
declare_proto_rig(set_vfo); declare_proto_rig(set_vfo);
declare_proto_rig(get_vfo); declare_proto_rig(get_vfo);
declare_proto_rig(get_rig_info); declare_proto_rig(get_rig_info);
@ -338,6 +339,7 @@ static struct test_table test_list[] =
{ 0xf5, "get_rig_info", ACTION(get_rig_info), ARG_NOVFO | ARG_OUT, "RigInfo" }, /* get several vfo parameters at once */ { 0xf5, "get_rig_info", ACTION(get_rig_info), ARG_NOVFO | ARG_OUT, "RigInfo" }, /* get several vfo parameters at once */
{ 0xf4, "get_vfo_list", ACTION(get_vfo_list), ARG_OUT | ARG_NOVFO, "VFOs" }, { 0xf4, "get_vfo_list", ACTION(get_vfo_list), ARG_OUT | ARG_NOVFO, "VFOs" },
{ 0xf6, "get_modes", ACTION(get_modes), ARG_OUT | ARG_NOVFO, "Modes" }, { 0xf6, "get_modes", ACTION(get_modes), ARG_OUT | ARG_NOVFO, "Modes" },
{ 0xf7, "get_mode_bandwidths", ACTION(get_mode_bandwidths), ARG_IN | ARG_NOVFO, "Mode" },
{ 0xf1, "halt", ACTION(halt), ARG_NOVFO }, /* rigctld only--halt the daemon */ { 0xf1, "halt", ACTION(halt), ARG_NOVFO }, /* rigctld only--halt the daemon */
{ 0x8c, "pause", ACTION(pause), ARG_IN, "Seconds" }, { 0x8c, "pause", ACTION(pause), ARG_IN, "Seconds" },
{ 0x00, "", NULL }, { 0x00, "", NULL },
@ -2340,6 +2342,48 @@ declare_proto_rig(get_modes)
RETURNFUNC(RIG_OK); RETURNFUNC(RIG_OK);
} }
declare_proto_rig(get_mode_bandwidths)
{
int i;
char freqbuf[32];
ENTERFUNC;
rmode_t mode = rig_parse_mode(arg1);
for (i = 1; i < RIG_MODE_TESTS_MAX; i <<= 1)
{
if (i != mode) { continue; }
if (mode == RIG_MODE_CWR) { mode = RIG_MODE_CW; }
if (mode == RIG_MODE_RTTYR) { mode = RIG_MODE_RTTY; }
pbwidth_t pbnorm = rig_passband_normal(rig, i);
if (pbnorm == 0)
{
continue;
}
// sprintf_freq(freqbuf, sizeof(freqbuf), pbnorm);
snprintf(freqbuf, sizeof(freqbuf), "%ldHz", pbnorm);
fprintf(fout, "Mode=%s\n", rig_strrmode(i));
fprintf(fout, "Normal=%s\n", freqbuf);
snprintf(freqbuf, sizeof(freqbuf), "%ldHz", rig_passband_narrow(rig, i));
fprintf(fout, "Narrow=%s\n", freqbuf);
snprintf(freqbuf, sizeof(freqbuf), "%ldHz", rig_passband_wide(rig, i));
fprintf(fout, "Wide=%s", freqbuf);
}
RETURNFUNC(RIG_OK);
}
/* 'T' */ /* 'T' */
declare_proto_rig(set_ptt) declare_proto_rig(set_ptt)