[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. 0089964af7fa1f4375708
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Michael B. <mdb...@us...> - 2021-01-08 22:39:22
|
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 0089964af7fa1f43757083b7bc7db195ba382fe0 (commit) from 6a523705319918a84feccfed151e408fbc43ee59 (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 0089964af7fa1f43757083b7bc7db195ba382fe0 Author: Michael Black W9MDB <mdb...@ya...> Date: Fri Jan 8 16:37:53 2021 -0600 Add some dumpcaps values to allow for set/get_freq and set/get_vfo functions https://github.com/Hamlib/Hamlib/issues/490 diff --git a/rigs/dummy/netrigctl.c b/rigs/dummy/netrigctl.c index 98199165..e9359d23 100644 --- a/rigs/dummy/netrigctl.c +++ b/rigs/dummy/netrigctl.c @@ -578,7 +578,28 @@ static int netrigctl_open(RIG *rig) } else if (strcmp(setting, "targetable_vfo") == 0) { - rig->caps->targetable_vfo = strtol(value, NULL, 0); + int has = strtol(value, NULL, 0); + if (!has) rig->caps->targetable_vfo = strtol(value, NULL, 0); + } + else if (strcmp(setting, "has_set_vfo") == 0) + { + int has = strtol(value, NULL, 0); + if (!has) rig->caps->set_vfo = NULL; + } + else if (strcmp(setting, "has_get_vfo") == 0) + { + int has = strtol(value, NULL, 0); + if (!has) rig->caps->get_vfo = NULL; + } + else if (strcmp(setting, "has_set_freq") == 0) + { + int has = strtol(value, NULL, 0); + if (!has) rig->caps->set_freq = NULL; + } + else if (strcmp(setting, "has_get_freq") == 0) + { + int has = strtol(value, NULL, 0); + if (!has) rig->caps->get_freq= NULL; } else { @@ -775,12 +796,11 @@ static int netrigctl_set_vfo(RIG *rig, vfo_t vfo) char cmd[CMD_MAX]; char buf[BUF_MAX]; char vfostr[16] = ""; + struct netrigctl_priv_data *priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); - //ret = netrigctl_vfostr(rig, vfostr, sizeof(vfostr), RIG_VFO_A); - - //if (ret != RIG_OK) { return ret; } + priv = (struct netrigctl_priv_data *)rig->state.priv; len = sprintf(cmd, "V%s %s\n", vfostr, rig_strvfo(vfo)); rig_debug(RIG_DEBUG_VERBOSE, "%s: cmd='%s'\n", __func__, cmd); @@ -790,10 +810,9 @@ static int netrigctl_set_vfo(RIG *rig, vfo_t vfo) { return -RIG_EPROTO; } - else - { - return ret; - } + + priv->vfo_curr = vfo; // remember our vfo + return ret; } @@ -817,7 +836,12 @@ static int netrigctl_get_vfo(RIG *rig, vfo_t *vfo) ret = netrigctl_transaction(rig, cmd, len, buf); - if (ret == -RIG_ENAVAIL) { return ret; } + if (ret == -RIG_ENAVAIL || ret == -RIG_ENIMPL) + { + // for rigs without get_vfo we'll use our saved vfo + *vfo = priv->vfo_curr; + return RIG_OK; + } if (ret <= 0) { @@ -2255,7 +2279,7 @@ struct rig_caps netrigctl_caps = RIG_MODEL(RIG_MODEL_NETRIGCTL), .model_name = "NET rigctl", .mfg_name = "Hamlib", - .version = "20200503.0", + .version = "20210108.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_OTHER, diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 1dbd877b..962ed7a4 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -4109,6 +4109,10 @@ declare_proto_rig(dump_state) fprintf(fout, "vfo_ops=0x%x\n", rig->caps->vfo_ops); fprintf(fout, "ptt_type=0x%x\n", rig->state.pttport.type.ptt); fprintf(fout, "targetable_vfo=0x%x\n", rig->caps->targetable_vfo); + fprintf(fout, "has_set_vfo=%d\n", rig->caps->set_vfo!=NULL); + fprintf(fout, "has_get_vfo=%d\n", rig->caps->get_vfo!=NULL); + fprintf(fout, "has_set_freq=%d\n", rig->caps->set_freq!=NULL); + fprintf(fout, "has_get_freq=%d\n", rig->caps->get_freq!=NULL); fprintf(fout, "done\n"); } ----------------------------------------------------------------------- Summary of changes: rigs/dummy/netrigctl.c | 44 ++++++++++++++++++++++++++++++++++---------- tests/rigctl_parse.c | 4 ++++ 2 files changed, 38 insertions(+), 10 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |