[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. 7b5765d549b9a4b68f327
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Michael B. <mdb...@us...> - 2021-04-27 21:12:53
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Hamlib -- Ham radio control libraries". The branch, master has been updated via 7b5765d549b9a4b68f327b9b62e69d91d2d2efc9 (commit) via 9970323712b59ecf0f14ba74731fa4bac7887909 (commit) via 5034bf4451c604303e83404168196d5f9cd23a38 (commit) via af499a979ee2602f08527c3ab2c5ca9207a8b02e (commit) via 6b13c6c3a3ce65ce67c5a210d621521340128719 (commit) via 6c13951da8928e8201cc59f9db3ff1dbfe71db9b (commit) from 9a82ebf65229131e6425231f521a31d6a7efa312 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7b5765d549b9a4b68f327b9b62e69d91d2d2efc9 Author: Bill Somerville <bi...@cl...> Date: Tue Apr 27 20:40:32 2021 +0100 Add missing export definition diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index ada3cdbc..ffb08df7 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -3023,7 +3023,7 @@ extern HAMLIB_EXPORT(int) rig_set_cache_timeout_ms(RIG *rig, hamlib_cache_t sele extern HAMLIB_EXPORT(int) rig_set_vfo_opt(RIG *rig, int status); extern HAMLIB_EXPORT(int) rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, pbwidth_t *width, split_t *split, int *satmode); -extern int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len); +extern HAMLIB_EXPORT(int) rig_get_rig_info(RIG *rig, char *response, int max_response_len); extern HAMLIB_EXPORT(int) rig_get_cache(RIG *rig, vfo_t vfo, freq_t *freq, int * cache_ms_freq, rmode_t *mode, int *cache_ms_mode, pbwidth_t *width, int *cache_ms_width); commit 9970323712b59ecf0f14ba74731fa4bac7887909 Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Apr 27 13:16:37 2021 -0500 Update NEWS diff --git a/NEWS b/NEWS index 82c2c02e..5353a4c1 100644 --- a/NEWS +++ b/NEWS @@ -14,8 +14,8 @@ Version 4.2 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 + VFO=VFOA Freq=10133000 Mode=LSB Width=0 RX=1 TX=0 + VFO=VFOB Freq=10134000 Mode=LSB Width=0 RX=0 TX=1 Split=1 SatMode=0 * USRP lib and gnuradio are deprecated and will be removed in 5.0 commit 5034bf4451c604303e83404168196d5f9cd23a38 Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Apr 27 13:14:54 2021 -0500 Make 1st token in get_rig_info a paired token too so all are A=B token pairs https://github.com/Hamlib/Hamlib/issues/682 diff --git a/src/rig.c b/src/rig.c index 0fecb56a..22746071 100644 --- a/src/rig.c +++ b/src/rig.c @@ -6229,7 +6229,7 @@ int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len) 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), freqB, rig_strrmode(modeB), (int)widthB, rxb, txb, split, satmode); + snprintf(response,max_response_len,"VFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nVFO=%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), freqB, rig_strrmode(modeB), (int)widthB, rxb, txb, split, satmode); RETURNFUNC(RIG_OK); } commit af499a979ee2602f08527c3ab2c5ca9207a8b02e Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Apr 27 12:13:15 2021 -0500 Fix freqB on rig_get_rig_info https://github.com/Hamlib/Hamlib/milestone/7 diff --git a/NEWS b/NEWS index e9982745..82c2c02e 100644 --- a/NEWS +++ b/NEWS @@ -7,7 +7,17 @@ Copyright (C) 2000-2021 Michael Black W9MDB, and others Please send Hamlib bug reports to ham...@li... Version 4.2 - * 2021-04-06 + * 2021-04-27 + * New rig_get_vfo_info + * New rig_get_rig_info + 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 + * USRP lib and gnuradio are deprecated and will be removed in 5.0 * Added Radan rotator * Added Malachite SDR diff --git a/src/rig.c b/src/rig.c index db1722e1..0fecb56a 100644 --- a/src/rig.c +++ b/src/rig.c @@ -6229,7 +6229,7 @@ int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len) 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); + 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), freqB, 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 06eefd8a..e1b9a65a 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -333,7 +333,7 @@ static struct test_table test_list[] = { 0x8f, "dump_state", ACTION(dump_state), ARG_OUT | ARG_NOVFO }, { 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 */ + { 0xf3, "get_vfo_info", ACTION(get_vfo_info), 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 */ commit 6b13c6c3a3ce65ce67c5a210d621521340128719 Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Apr 27 11:51:43 2021 -0500 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/682 diff --git a/src/rig.c b/src/rig.c index 7e734a08..db1722e1 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 888cf05e..06eefd8a 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) { commit 6c13951da8928e8201cc59f9db3ff1dbfe71db9b Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Apr 27 10:32:12 2021 -0500 Add satmode to rig_get_vfo_info Add prototype for rig_get_rig_info https://github.com/Hamlib/Hamlib/issues/682 diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 17dcf618..ada3cdbc 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -2376,7 +2376,12 @@ rig_get_vfo HAMLIB_PARAMS((RIG *rig, extern HAMLIB_EXPORT(int) rig_get_vfo_info HAMLIB_PARAMS((RIG *rig, - vfo_t vfo, freq_t *freq, rmode_t *mode, pbwidth_t *width, split_t *split)); + vfo_t vfo, + freq_t *freq, + rmode_t *mode, + pbwidth_t *width, + split_t *split, + int *satmode)); extern HAMLIB_EXPORT(int) rig_get_vfo_list HAMLIB_PARAMS((RIG *rig, char *buf, int buflen)); @@ -3017,7 +3022,8 @@ extern HAMLIB_EXPORT(int) rig_get_cache_timeout_ms(RIG *rig, hamlib_cache_t sele extern HAMLIB_EXPORT(int) rig_set_cache_timeout_ms(RIG *rig, hamlib_cache_t selection, int ms); extern HAMLIB_EXPORT(int) rig_set_vfo_opt(RIG *rig, int status); -extern HAMLIB_EXPORT(int) rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, pbwidth_t *width, split_t *split); +extern HAMLIB_EXPORT(int) rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, pbwidth_t *width, split_t *split, int *satmode); +extern int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len); extern HAMLIB_EXPORT(int) rig_get_cache(RIG *rig, vfo_t vfo, freq_t *freq, int * cache_ms_freq, rmode_t *mode, int *cache_ms_mode, pbwidth_t *width, int *cache_ms_width); diff --git a/src/rig.c b/src/rig.c index 0e12870c..7e734a08 100644 --- a/src/rig.c +++ b/src/rig.c @@ -6201,6 +6201,24 @@ const char *HAMLIB_API rig_get_info(RIG *rig) return (rig->caps->get_info(rig)); } +/** + * \brief get freq/mode/width for requested VFO + * \param rig The rig handle + * + * returns a string for all known VFOs plus rig split status and satellite mode status + */ +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; + split_t split; + int satmode; + response[0] = 0; + RETURNFUNC(-RIG_ENIMPL); +} + /** * \brief get freq/mode/width for requested VFO * \param rig The rig handle @@ -6219,7 +6237,7 @@ const char *HAMLIB_API rig_get_info(RIG *rig) * */ int HAMLIB_API rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, - rmode_t *mode, pbwidth_t *width, split_t *split) + rmode_t *mode, pbwidth_t *width, split_t *split, int *satmode) { int retval; @@ -6262,6 +6280,7 @@ int HAMLIB_API rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, *width = rig->state.cache.widthMainA; } + *satmode = rig->state.cache.satmode; // we should only need to ask for VFO_CURR to minimize display swapping TRACE; retval = rig_get_split(rig, RIG_VFO_CURR, split); diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 860586d7..888cf05e 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -134,6 +134,7 @@ struct test_table const char *arg2; const char *arg3; const char *arg4; + const char *arg5; }; @@ -331,7 +332,7 @@ static struct test_table test_list[] = { 0x8f, "dump_state", ACTION(dump_state), ARG_OUT | ARG_NOVFO }, { 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_OUT3, "Freq", "Mode", "Width", "Split" }, /* 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 */ { 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" }, @@ -2232,7 +2233,8 @@ declare_proto_rig(get_vfo_info) rmode_t mode = RIG_MODE_NONE; pbwidth_t width = 0; split_t split; - retval = rig_get_vfo_info(rig, vfo, &freq, &mode, &width, &split); + int satmode = 0; + retval = rig_get_vfo_info(rig, vfo, &freq, &mode, &width, &split, &satmode); if (retval != RIG_OK) { @@ -2249,6 +2251,7 @@ declare_proto_rig(get_vfo_info) fprintf(fout, "%s: %s\n", cmd->arg2, modestr); fprintf(fout, "%s: %d\n", cmd->arg3, (int)width); fprintf(fout, "%s: %d\n", cmd->arg4, (int)split); + fprintf(fout, "%s: %d\n", cmd->arg5, (int)satmode); } else { diff --git a/tests/simicom.c b/tests/simicom.c deleted file mode 100644 index 87fcc76d..00000000 --- a/tests/simicom.c +++ /dev/null @@ -1,288 +0,0 @@ -// simicom will show the pts port to use for rigctl on Unix -// using virtual serial ports on Windows is to be developed yet -// gcc -g -Wall -o simicom simicom.c -lhamlib -// On mingw in the hamlib src directory -// gcc -static -I../include -g -Wall -o simicom simicom.c -L../../build/src/.libs -lhamlib -lwsock32 -lws2_32 -#define _XOPEN_SOURCE 600 -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/time.h> -#include <hamlib/rig.h> -#include "../src/misc.h" - -#define BUFSIZE 256 - -int civ_731_mode = 0; -vfo_t current_vfo = RIG_VFO_A; -int split = 0; - -// we make B different from A to ensure we see a difference at startup -float freqA = 14074000; -float freqB = 14074500; -mode_t modeA = RIG_MODE_CW; -mode_t modeB = RIG_MODE_USB; -pbwidth_t widthA = 0; -pbwidth_t widthB = 1; - -void dumphex(unsigned char *buf, int n) -{ - for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); } - - printf("\n"); -} - -int -frameGet(int fd, unsigned char *buf) -{ - int i = 0; - memset(buf, 0, BUFSIZE); - unsigned char c; - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - //printf("i=%d, c=0x%02x\n",i,c); - - if (c == 0xfd) - { - dumphex(buf, i); - return i; - } - } - - printf("Error???\n"); - - return 0; -} - -void frameParse(int fd, unsigned char *frame, int len) -{ - double freq; - - dumphex(frame, len); - - if (frame[0] != 0xfe && frame[1] != 0xfe) - { - printf("expected fe fe, got "); - dumphex(frame, len); - return; - } - - switch (frame[4]) - { - case 0x03: - - //from_bcd(frameackbuf[2], (civ_731_mode ? 4 : 5) * 2); - if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) - { - printf("get_freqA\n"); - to_bcd(&frame[5], (long long)freqA, (civ_731_mode ? 4 : 5) * 2); - } - else - { - printf("get_freqB\n"); - to_bcd(&frame[5], (long long)freqB, (civ_731_mode ? 4 : 5) * 2); - } - - frame[10] = 0xfd; - write(fd, frame, 11); - break; - - case 0x04: - if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) - { - printf("get_modeA\n"); - frame[5] = modeA; - frame[6] = widthA; - } - else - { - printf("get_modeB\n"); - frame[5] = modeB; - frame[6] = widthB; - } - - frame[7] = 0xfd; - write(fd, frame, 8); - break; - - case 0x05: - freq = from_bcd(&frame[5], (civ_731_mode ? 4 : 5) * 2); - printf("set_freq to %.0f\n", freq); - - if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) { freqA = freq; } - else { freqB = freq; } - -// case 0x06: - - - case 0x07: - - switch (frame[5]) - { - case 0x00: current_vfo = RIG_VFO_A; break; - - case 0x01: current_vfo = RIG_VFO_B; break; - - case 0xd0: current_vfo = RIG_VFO_MAIN; break; - - case 0xd1: current_vfo = RIG_VFO_SUB; break; - } - - printf("set_vfo to %s\n", rig_strvfo(current_vfo)); - - frame[4] = 0xfb; - frame[5] = 0xfd; - write(fd, frame, 6); - break; - - case 0x0f: - if (frame[5] == 0) { split = 0; } - else { split = 1; } - - printf("set split %d\n", 1); - frame[4] = 0xfb; - frame[5] = 0xfd; - write(fd, frame, 6); - break; - - case 0x1a: // miscellaneous things - switch (frame[5]) - { - case 0x03: // width - if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) { frame[6] = widthA; } - else { frame[6] = widthB; } - - frame[7] = 0xfd; - write(fd, frame, 8); - break; - } - - break; - -#if 0 - case 0x25: - if (frame[6] == 0xfd) - { - if (frame[5] == 0x00) - { - to_bcd(&frame[6], (long long)freqA, (civ_731_mode ? 4 : 5) * 2); - printf("get_freqA=%.0f\n", freqA); - } - else - { - to_bcd(&frame[6], (long long)freqB, (civ_731_mode ? 4 : 5) * 2); - printf("get_freqB=%.0f\n", freqB); - } - - frame[11] = 0xfd; - write(fd, frame, 12); - } - else - { - freq = from_bcd(&frame[5], (civ_731_mode ? 4 : 5) * 2); - printf("set_freq to %.0f\n", freq); - - if (frame[5] == 0x00) { freqA = freq; } - else { freqB = freq; } - - frame[4] = 0xfb; - frame[5] = 0xfd; - } - - break; -#endif - - default: printf("cmd 0x%02x unknown\n", frame[4]); - } - - // don't care about the rig type yet - -} - -#if defined(WIN32) || defined(_WIN32) -int openPort(char *comport) // doesn't matter for using pts devices -{ - int fd; - fd = open(comport, O_RDWR); - - if (fd < 0) - { - perror(comport); - } - - return fd; -} - -#else -int openPort(char *comport) // doesn't matter for using pts devices -{ - int fd = posix_openpt(O_RDWR); - char *name = ptsname(fd); - - if (name == NULL) - { - perror("pstname"); - return -1; - } - - printf("name=%s\n", name); - - if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1) - { - perror("posix_openpt"); - return -1; - } - - return fd; -} -#endif - -void rigStatus() -{ - char vfoa = current_vfo == RIG_VFO_A ? '*' : ' '; - char vfob = current_vfo == RIG_VFO_B ? '*' : ' '; - printf("%cVFOA: mode=%s width=%ld freq=%.0f\n", vfoa, rig_strrmode(modeA), - widthA, - freqA); - printf("%cVFOB: mode=%s width=%ld freq=%.0f\n", vfob, rig_strrmode(modeB), - widthB, - freqB); -} - -int main(int argc, char **argv) -{ - unsigned char buf[256]; - int fd = openPort(argv[1]); - - printf("%s: %s\n", argv[0], rig_version()); -#if defined(WIN32) || defined(_WIN32) - - if (argc != 2) - { - printf("Missing comport argument\n"); - printf("%s [comport]\n", argv[0]); - exit(1); - } - -#endif - - while (1) - { - int len = frameGet(fd, buf); - - if (len <= 0) - { - close(fd); - fd = openPort(argv[1]); - } - - frameParse(fd, buf, len); - rigStatus(); - } - - return 0; -} ----------------------------------------------------------------------- Summary of changes: NEWS | 12 ++- include/hamlib/rig.h | 10 +- src/rig.c | 35 ++++++- tests/rigctl_parse.c | 20 +++- tests/simicom.c | 288 --------------------------------------------------- 5 files changed, 71 insertions(+), 294 deletions(-) delete mode 100644 tests/simicom.c hooks/post-receive -- Hamlib -- Ham radio control libraries |