kopia lustrzana https://github.com/Hamlib/Hamlib
New rig_get_rig_info function
Also get_rig_info in rigctld too Example output with rig in split mode 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 VFOA Freq=10133000 Mode=LSB Width=0 RX=1 TX=0 VFOB Freq=10134000 Mode=LSB Width=0 RX=0 TX=1 Split=1 SatMode=0 https://github.com/Hamlib/Hamlib/issues/682pull/691/head
rodzic
6c13951da8
commit
6b13c6c3a3
24
src/rig.c
24
src/rig.c
|
@ -6209,14 +6209,28 @@ const char *HAMLIB_API rig_get_info(RIG *rig)
|
||||||
*/
|
*/
|
||||||
int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len)
|
int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len)
|
||||||
{
|
{
|
||||||
vfo_t vfoA;
|
vfo_t vfoA,vfoB;
|
||||||
freq_t freqA;
|
freq_t freqA,freqB;
|
||||||
rmode_t modeA;
|
rmode_t modeA,modeB;
|
||||||
pbwidth_t widthA;
|
pbwidth_t widthA,widthB;
|
||||||
split_t split;
|
split_t split;
|
||||||
int satmode;
|
int satmode;
|
||||||
|
int ret;
|
||||||
|
int rxa, txa, rxb, txb;
|
||||||
response[0] = 0;
|
response[0] = 0;
|
||||||
RETURNFUNC(-RIG_ENIMPL);
|
|
||||||
|
vfoA = vfo_fixup(rig, RIG_VFO_A);
|
||||||
|
vfoB = vfo_fixup(rig, RIG_VFO_B);
|
||||||
|
ret = rig_get_vfo_info(rig, vfoA, &freqA, &modeA, &widthA, &split, &satmode);
|
||||||
|
if (ret != RIG_OK) RETURNFUNC(ret);
|
||||||
|
ret = rig_get_vfo_info(rig, vfoB, &freqB, &modeB, &widthB, &split, &satmode);
|
||||||
|
if (ret != RIG_OK) RETURNFUNC(ret);
|
||||||
|
rxa = 1;
|
||||||
|
txa = split == 0;
|
||||||
|
rxb = !rxa;
|
||||||
|
txb = split == 1;
|
||||||
|
snprintf(response,max_response_len,"%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\n%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nSplit=%d SatMode=%d", rig_strvfo(vfoA), freqA, rig_strrmode(modeA), (int)widthA, rxa, txa, rig_strvfo(vfoB), freqA, rig_strrmode(modeB), (int)widthB, rxb, txb, split, satmode);
|
||||||
|
RETURNFUNC(RIG_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -166,6 +166,7 @@ declare_proto_rig(set_mode);
|
||||||
declare_proto_rig(get_mode);
|
declare_proto_rig(get_mode);
|
||||||
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_vfo_info);
|
declare_proto_rig(get_vfo_info);
|
||||||
declare_proto_rig(get_vfo_list);
|
declare_proto_rig(get_vfo_list);
|
||||||
declare_proto_rig(set_ptt);
|
declare_proto_rig(set_ptt);
|
||||||
|
@ -333,6 +334,7 @@ static struct test_table test_list[] =
|
||||||
{ 0xf0, "chk_vfo", ACTION(chk_vfo), ARG_NOVFO, "ChkVFO" }, /* rigctld only--check for VFO mode */
|
{ 0xf0, "chk_vfo", ACTION(chk_vfo), ARG_NOVFO, "ChkVFO" }, /* rigctld only--check for VFO mode */
|
||||||
{ 0xf2, "set_vfo_opt", ACTION(set_vfo_opt), ARG_NOVFO | ARG_IN, "Status" }, /* turn vfo option on/off */
|
{ 0xf2, "set_vfo_opt", ACTION(set_vfo_opt), ARG_NOVFO | ARG_IN, "Status" }, /* turn vfo option on/off */
|
||||||
{ 0xf3, "get_vfo_info", ACTION(get_vfo_info), ARG_NOVFO | ARG_IN1 | ARG_OUT4, "Freq", "Mode", "Width", "Split", "SatMode" }, /* get several vfo parameters at once */
|
{ 0xf3, "get_vfo_info", ACTION(get_vfo_info), ARG_NOVFO | ARG_IN1 | ARG_OUT4, "Freq", "Mode", "Width", "Split", "SatMode" }, /* 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" },
|
||||||
{ 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" },
|
||||||
|
@ -2213,6 +2215,17 @@ declare_proto_rig(get_vfo)
|
||||||
RETURNFUNC(status);
|
RETURNFUNC(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare_proto_rig(get_rig_info)
|
||||||
|
{
|
||||||
|
char buf[1024]; // big enough to last numerous years hopefully
|
||||||
|
int ret;
|
||||||
|
ENTERFUNC;
|
||||||
|
ret = rig_get_rig_info(rig, buf, sizeof(buf));
|
||||||
|
if (ret != RIG_OK) RETURNFUNC(ret);
|
||||||
|
fprintf(fout,"%s\n", buf);
|
||||||
|
RETURNFUNC(RIG_OK);
|
||||||
|
}
|
||||||
|
|
||||||
/* '\get_vfo_info' */
|
/* '\get_vfo_info' */
|
||||||
declare_proto_rig(get_vfo_info)
|
declare_proto_rig(get_vfo_info)
|
||||||
{
|
{
|
||||||
|
|
Ładowanie…
Reference in New Issue