diff --git a/src/rig.c b/src/rig.c index 7e734a08e..db1722e1c 100644 --- a/src/rig.c +++ b/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) { - vfo_t vfoA; - freq_t freqA; - rmode_t modeA; - pbwidth_t widthA; + vfo_t vfoA,vfoB; + freq_t freqA,freqB; + rmode_t modeA,modeB; + pbwidth_t widthA,widthB; split_t split; int satmode; + int ret; + int rxa, txa, rxb, txb; 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); } /** diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 888cf05e4..06eefd8a5 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -166,6 +166,7 @@ declare_proto_rig(set_mode); declare_proto_rig(get_mode); declare_proto_rig(set_vfo); declare_proto_rig(get_vfo); +declare_proto_rig(get_rig_info); declare_proto_rig(get_vfo_info); declare_proto_rig(get_vfo_list); 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 */ { 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 */ + { 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" }, { 0xf1, "halt", ACTION(halt), ARG_NOVFO }, /* rigctld only--halt the daemon */ { 0x8c, "pause", ACTION(pause), ARG_IN, "Seconds" }, @@ -2213,6 +2215,17 @@ declare_proto_rig(get_vfo) 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' */ declare_proto_rig(get_vfo_info) {