From 3a9b4ca027795c5fd6e05349cf2ef81437113607 Mon Sep 17 00:00:00 2001 From: Michael Black W9MDB Date: Sun, 29 Nov 2020 23:32:14 -0600 Subject: [PATCH] Add NOCHANGE_PASSBAND to icom...cascading effect on adding vfo elsewhere...which is needed anyways https://github.com/Hamlib/Hamlib/issues/448 (cherry picked from commit c70d841b83e6a8ebe7338dc0dfbb9a402cee2370) --- NEWS | 3 +- bindings/rig.swg | 10 ++--- c++/rigclass.cc | 8 ++-- include/hamlib/rig.h | 32 ++++++++----- include/hamlib/rigclass.h | 4 +- rigs/aor/aor.c | 6 +-- rigs/aor/aor.h | 6 +-- rigs/aor/ar3030.c | 4 +- rigs/aor/ar7030p.c | 4 +- rigs/drake/drake.c | 4 +- rigs/drake/drake.h | 4 +- rigs/dummy/dummy.c | 4 +- rigs/dummy/netrigctl.c | 4 +- rigs/icom/frame.c | 12 ++++- rigs/icom/frame.h | 2 +- rigs/icom/ic7000.c | 4 +- rigs/icom/ic706.c | 4 +- rigs/icom/ic746.c | 12 ++--- rigs/icom/ic756.c | 4 +- rigs/icom/ic910.c | 4 +- rigs/icom/icom.c | 6 +-- rigs/icom/icom.h | 2 +- rigs/icom/icr30.c | 4 +- rigs/icom/icr75.c | 10 ++--- rigs/icom/optoscan.c | 10 ++--- rigs/icom/perseus.c | 6 +-- rigs/jrc/jrc.c | 6 +-- rigs/jrc/jrc.h | 4 +- rigs/kenwood/ic10.c | 4 +- rigs/kenwood/ic10.h | 4 +- rigs/kenwood/kenwood.c | 4 +- rigs/kenwood/kenwood.h | 4 +- rigs/kenwood/pihpsdr.c | 8 ++-- rigs/kenwood/th.c | 10 ++--- rigs/kenwood/th.h | 4 +- rigs/kenwood/thd72.c | 4 +- rigs/kenwood/thd74.c | 4 +- rigs/kenwood/tmd710.c | 8 ++-- rigs/kenwood/tmv7.c | 8 ++-- rigs/kenwood/ts2000.c | 8 ++-- rigs/kenwood/ts570.c | 2 +- rigs/kenwood/ts850.c | 4 +- rigs/prm80/prm80.c | 10 ++--- rigs/prm80/prm80.h | 4 +- rigs/uniden/uniden.c | 4 +- rigs/uniden/uniden.h | 4 +- rigs/yaesu/ft1000d.c | 4 +- rigs/yaesu/ft1000d.h | 4 +- rigs/yaesu/ft990.c | 4 +- rigs/yaesu/ft990.h | 4 +- rigs/yaesu/newcat.c | 6 +-- rigs/yaesu/newcat.h | 4 +- src/mem.c | 94 ++++++++++++++++++++------------------- tests/memcsv.c | 4 +- tests/rigctl_parse.c | 4 +- tests/rigmem.c | 2 +- 56 files changed, 218 insertions(+), 193 deletions(-) diff --git a/NEWS b/NEWS index c9eb58a4a..438541d04 100644 --- a/NEWS +++ b/NEWS @@ -7,10 +7,11 @@ Copyright (C) 2000-2020 Michael Black W9MDB, and others Please send Hamlib bug reports to hamlib-developer@lists.sourceforge.net Version 4.0 - 2020-09-?? + 2020-11-29 * API/ABI changes, advance ABI to 4 0 0. * Add GPIO and GPION options for DCD. Jeroen Vreeken * New backend: ELAD FDM DUO. Giovanni, HB9EIK. + * All channel functions now take a vfo argument * New rotator backend: iOptron. Bob, KD8CGH * New model: Icom IC-R8600. Ekki, DF4OR * New utility: rigctlcom. Mike, W9MDB diff --git a/bindings/rig.swg b/bindings/rig.swg index 2fc87baab..19f5be1d5 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -460,11 +460,11 @@ typedef channel_t * const_channel_t_p; } void set_channel(const struct channel *chan) { - self->error_status = rig_set_channel(self->rig, chan); + self->error_status = rig_set_channel(self->rig, RIG_VFO_NONE, chan); } void get_channel(struct channel *chan, int read_only) { - self->error_status = rig_get_channel(self->rig, chan, read_only); + self->error_status = rig_get_channel(self->rig, RIG_VFO_NONE, chan, read_only); /* TODO: handle ext_level's */ } @@ -473,7 +473,7 @@ typedef channel_t * const_channel_t_p; } void get_chan_all(struct channel *chans) { - self->error_status = rig_get_chan_all(self->rig, chans); + self->error_status = rig_get_chan_all(self->rig, RIG_VFO_NONE, chans); /* TODO: handle ext_level's */ } @@ -495,7 +495,7 @@ typedef channel_t * const_channel_t_p; self->error_status = -RIG_ENOMEM; return NULL; } - self->error_status = rig_get_channel(self->rig, chan, read_only); + self->error_status = rig_get_channel(self->rig, RIG_VFO_NONE, chan, read_only); /* TODO: copy ext_level's */ return chan; } @@ -613,7 +613,7 @@ struct channel *Rig_get_chan_all(Rig *self) self->error_status = -RIG_ENOMEM; return NULL; } - self->error_status = rig_get_chan_all(self->rig, chans); + self->error_status = rig_get_chan_all(self->rig, RIG_VFO_NONE, chans); /* TODO: copy ext_level's */ return chans; } diff --git a/c++/rigclass.cc b/c++/rigclass.cc index 40dcfc225..ee8c8fd66 100644 --- a/c++/rigclass.cc +++ b/c++/rigclass.cc @@ -643,14 +643,14 @@ int Rig::getMem (vfo_t vfo) return mem; } -void Rig::setChannel (const channel_t *chan) +void Rig::setChannel (const channel_t *chan, vfo_t vfo) { - CHECK_RIG( rig_set_channel(theRig, chan) ); + CHECK_RIG( rig_set_channel(theRig, vfo, chan) ); } -void Rig::getChannel (channel_t *chan, int readOnly) +void Rig::getChannel (channel_t *chan,vfo_t vfo, int readOnly) { - CHECK_RIG( rig_get_channel(theRig, chan, readOnly) ); + CHECK_RIG( rig_get_channel(theRig, vfo, chan, readOnly) ); } diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index da8e5638d..ffea65d5f 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -1813,13 +1813,13 @@ struct rig_caps { int (*decode_event)(RIG *rig); - int (*set_channel)(RIG *rig, const channel_t *chan); - int (*get_channel)(RIG *rig, channel_t *chan, int read_only); + int (*set_channel)(RIG *rig, vfo_t vfo, const channel_t *chan); + int (*get_channel)(RIG *rig, vfo_t vfo, channel_t *chan, int read_only); const char * (*get_info)(RIG *rig); - int (*set_chan_all_cb)(RIG *rig, chan_cb_t chan_cb, rig_ptr_t); - int (*get_chan_all_cb)(RIG *rig, chan_cb_t chan_cb, rig_ptr_t); + int (*set_chan_all_cb)(RIG *rig, vfo_t vfo, chan_cb_t chan_cb, rig_ptr_t); + int (*get_chan_all_cb)(RIG *rig, vfo_t vfo, chan_cb_t chan_cb, rig_ptr_t); int (*set_mem_all_cb)(RIG *rig, chan_cb_t chan_cb, @@ -2561,46 +2561,56 @@ rig_has_scan HAMLIB_PARAMS((RIG *rig, scan_t scan)); extern HAMLIB_EXPORT(int) -rig_set_channel HAMLIB_PARAMS((RIG *rig, +rig_set_channel HAMLIB_PARAMS((RIG *rig, + vfo_t vfo, const channel_t *chan)); /* mem */ extern HAMLIB_EXPORT(int) -rig_get_channel HAMLIB_PARAMS((RIG *rig, +rig_get_channel HAMLIB_PARAMS((RIG *rig, + vfo_t vfo, channel_t *chan, int read_only)); extern HAMLIB_EXPORT(int) -rig_set_chan_all HAMLIB_PARAMS((RIG *rig, +rig_set_chan_all HAMLIB_PARAMS((RIG *rig, + vfo_t vfo, const channel_t chans[])); extern HAMLIB_EXPORT(int) -rig_get_chan_all HAMLIB_PARAMS((RIG *rig, +rig_get_chan_all HAMLIB_PARAMS((RIG *rig, + vfo_t vfo, channel_t chans[])); extern HAMLIB_EXPORT(int) -rig_set_chan_all_cb HAMLIB_PARAMS((RIG *rig, +rig_set_chan_all_cb HAMLIB_PARAMS((RIG *rig, + vfo_t vfo, chan_cb_t chan_cb, rig_ptr_t)); extern HAMLIB_EXPORT(int) -rig_get_chan_all_cb HAMLIB_PARAMS((RIG *rig, +rig_get_chan_all_cb HAMLIB_PARAMS((RIG *rig, + vfo_t vfo, chan_cb_t chan_cb, rig_ptr_t)); extern HAMLIB_EXPORT(int) rig_set_mem_all_cb HAMLIB_PARAMS((RIG *rig, + vfo_t vfo, chan_cb_t chan_cb, confval_cb_t parm_cb, rig_ptr_t)); extern HAMLIB_EXPORT(int) -rig_get_mem_all_cb HAMLIB_PARAMS((RIG *rig, +rig_get_mem_all_cb HAMLIB_PARAMS((RIG *rig, + vfo_t vfo, chan_cb_t chan_cb, confval_cb_t parm_cb, rig_ptr_t)); extern HAMLIB_EXPORT(int) rig_set_mem_all HAMLIB_PARAMS((RIG *rig, + vfo_t vfo, const channel_t *chan, const struct confparams *, const value_t *)); extern HAMLIB_EXPORT(int) rig_get_mem_all HAMLIB_PARAMS((RIG *rig, + vfo_t vfo, channel_t *chan, const struct confparams *, value_t *)); diff --git a/include/hamlib/rigclass.h b/include/hamlib/rigclass.h index 0ac47bf1b..2032624d9 100644 --- a/include/hamlib/rigclass.h +++ b/include/hamlib/rigclass.h @@ -126,8 +126,8 @@ public: void setMem(int ch, vfo_t vfo = RIG_VFO_CURR); int getMem(vfo_t vfo = RIG_VFO_CURR); - void setChannel(const channel_t *chan); - void getChannel(channel_t *chan, int readOnly); + void setChannel(const channel_t *chan, vfo_t vfo); + void getChannel(channel_t *chan, vfo_t vfo, int readOnly); void setPowerStat(powerstat_t status); powerstat_t getPowerStat(void); diff --git a/rigs/aor/aor.c b/rigs/aor/aor.c index 5b3d18bc5..d21b84ba3 100644 --- a/rigs/aor/aor.c +++ b/rigs/aor/aor.c @@ -1029,7 +1029,7 @@ int aor_set_bank(RIG *rig, vfo_t vfo, int bank) } -int aor_set_channel(RIG *rig, const channel_t *chan) +int aor_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { struct aor_priv_caps *priv = (struct aor_priv_caps *)rig->caps->priv; char aorcmd[BUFSZ]; @@ -1240,7 +1240,7 @@ static int parse_chan_line(RIG *rig, channel_t *chan, char *basep, } -int aor_get_channel(RIG *rig, channel_t *chan, int read_only) +int aor_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { struct aor_priv_caps *priv = (struct aor_priv_caps *)rig->caps->priv; char aorcmd[BUFSZ]; @@ -1346,7 +1346,7 @@ int aor_get_channel(RIG *rig, channel_t *chan, int read_only) #define LINES_PER_MA 10 -int aor_get_chan_all_cb(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg) +int aor_get_chan_all_cb(RIG *rig, vfo_t vfo, chan_cb_t chan_cb, rig_ptr_t arg) { struct aor_priv_caps *priv = (struct aor_priv_caps *)rig->caps->priv; int i, j, retval; diff --git a/rigs/aor/aor.h b/rigs/aor/aor.h index 07cdb98af..99288b774 100644 --- a/rigs/aor/aor.h +++ b/rigs/aor/aor.h @@ -60,9 +60,9 @@ int aor_set_mem(RIG *rig, vfo_t vfo, int ch); int aor_get_mem(RIG *rig, vfo_t vfo, int *ch); int aor_set_bank(RIG *rig, vfo_t vfo, int bank); -int aor_get_channel(RIG *rig, channel_t *chan, int read_only); -int aor_set_channel(RIG *rig, const channel_t *chan); -int aor_get_chan_all_cb (RIG * rig, chan_cb_t chan_cb, rig_ptr_t); +int aor_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only); +int aor_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan); +int aor_get_chan_all_cb (RIG * rig, vfo_t vfo, chan_cb_t chan_cb, rig_ptr_t); extern const struct rig_caps ar2700_caps; extern const struct rig_caps ar8200_caps; diff --git a/rigs/aor/ar3030.c b/rigs/aor/ar3030.c index f7fe52fb6..5e40e49e4 100644 --- a/rigs/aor/ar3030.c +++ b/rigs/aor/ar3030.c @@ -45,7 +45,7 @@ static int ar3030_set_mem(RIG *rig, vfo_t vfo, int ch); static int ar3030_get_mem(RIG *rig, vfo_t vfo, int *ch); static int ar3030_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int ar3030_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); -static int ar3030_get_channel(RIG *rig, channel_t *chan, int read_only); +static int ar3030_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only); static int ar3030_init(RIG *rig); static int ar3030_cleanup(RIG *rig); static int ar3030_close(RIG *rig); @@ -721,7 +721,7 @@ int ar3030_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) return RIG_OK; } -int ar3030_get_channel(RIG *rig, channel_t *chan, int read_only) +int ar3030_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv; char cmdbuf[BUFSZ], infobuf[BUFSZ]; diff --git a/rigs/aor/ar7030p.c b/rigs/aor/ar7030p.c index bcee8c3fe..d614c1062 100644 --- a/rigs/aor/ar7030p.c +++ b/rigs/aor/ar7030p.c @@ -1630,7 +1630,7 @@ static int ar7030p_decode_event(RIG *rig) return (-RIG_ENIMPL); } -static int ar7030p_set_channel(RIG *rig, const channel_t *chan) +static int ar7030p_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { assert(NULL != rig); assert(NULL != chan); @@ -1638,7 +1638,7 @@ static int ar7030p_set_channel(RIG *rig, const channel_t *chan) return (-RIG_ENIMPL); } -static int ar7030p_get_channel(RIG *rig, channel_t *chan, int read_only) +static int ar7030p_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { int rc = RIG_OK; unsigned char v; diff --git a/rigs/drake/drake.c b/rigs/drake/drake.c index 1cc3c5460..ad817591e 100644 --- a/rigs/drake/drake.c +++ b/rigs/drake/drake.c @@ -615,7 +615,7 @@ int drake_get_mem(RIG *rig, vfo_t vfo, int *ch) * drake_set_chan * Assumes rig!=NULL */ -int drake_set_chan(RIG *rig, const channel_t *chan) +int drake_set_chan(RIG *rig, vfo_t vfo, const channel_t *chan) { struct drake_priv_data *priv = rig->state.priv; vfo_t old_vfo; @@ -671,7 +671,7 @@ int drake_set_chan(RIG *rig, const channel_t *chan) * drake_get_chan * Assumes rig!=NULL */ -int drake_get_chan(RIG *rig, channel_t *chan, int read_only) +int drake_get_chan(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { struct drake_priv_data *priv = rig->state.priv; vfo_t old_vfo; diff --git a/rigs/drake/drake.h b/rigs/drake/drake.h index f46b1560f..f6f9d1d26 100644 --- a/rigs/drake/drake.h +++ b/rigs/drake/drake.h @@ -42,8 +42,8 @@ int drake_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option); int drake_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, value_t *option, ant_t *ant_curr, ant_t *ant_tx, ant_t *ant_rx); int drake_set_mem(RIG *rig, vfo_t vfo, int ch); int drake_get_mem(RIG *rig, vfo_t vfo, int *ch); -int drake_set_chan(RIG *rig, const channel_t *chan); -int drake_get_chan(RIG *rig, channel_t *chan, int read_only); +int drake_set_chan(RIG *rig, vfo_t vfo, const channel_t *chan); +int drake_get_chan(RIG *rig, vfo_t vfo, channel_t *chan, int read_only); int drake_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); int drake_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); int drake_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); diff --git a/rigs/dummy/dummy.c b/rigs/dummy/dummy.c index c214ce3c9..f3c26ceb7 100644 --- a/rigs/dummy/dummy.c +++ b/rigs/dummy/dummy.c @@ -1843,7 +1843,7 @@ static int dummy_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) return RIG_OK; } -static int dummy_set_channel(RIG *rig, const channel_t *chan) +static int dummy_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; @@ -1888,7 +1888,7 @@ static int dummy_set_channel(RIG *rig, const channel_t *chan) } -static int dummy_get_channel(RIG *rig, channel_t *chan, int read_only) +static int dummy_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; diff --git a/rigs/dummy/netrigctl.c b/rigs/dummy/netrigctl.c index 63f6ea4ca..8d0743aa2 100644 --- a/rigs/dummy/netrigctl.c +++ b/rigs/dummy/netrigctl.c @@ -2100,13 +2100,13 @@ static int netrigctl_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) } } -static int netrigctl_set_channel(RIG *rig, const channel_t *chan) +static int netrigctl_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { return -RIG_ENIMPL; } -static int netrigctl_get_channel(RIG *rig, channel_t *chan, int read_only) +static int netrigctl_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { return -RIG_ENIMPL; } diff --git a/rigs/icom/frame.c b/rigs/icom/frame.c index 18aebb4d2..6ca3664f8 100644 --- a/rigs/icom/frame.c +++ b/rigs/icom/frame.c @@ -383,7 +383,7 @@ int read_icom_frame(hamlib_port_t *p, unsigned char rxbuffer[], * TODO: be more exhaustive * assumes rig!=NULL */ -int rig2icom_mode(RIG *rig, rmode_t mode, pbwidth_t width, +int rig2icom_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, unsigned char *md, signed char *pd) { unsigned char icmode; @@ -391,6 +391,16 @@ int rig2icom_mode(RIG *rig, rmode_t mode, pbwidth_t width, icmode_ext = -1; + if (width == RIG_PASSBAND_NOCHANGE) // then we read width so we can reuse it + { + rmode_t tmode; + int ret = rig_get_mode(rig, vfo, &tmode, &width); + if (ret != RIG_OK) + { + rig_debug(RIG_DEBUG_WARN, "%s: Failed to get width for passband nochange err=%s\n", __func__, rigerror(ret)); + } + } + switch (mode) { case RIG_MODE_AM: icmode = S_AM; break; diff --git a/rigs/icom/frame.h b/rigs/icom/frame.h index aa8badf4b..b5d84621c 100644 --- a/rigs/icom/frame.h +++ b/rigs/icom/frame.h @@ -32,7 +32,7 @@ int make_cmd_frame(char frame[], char re_id, char ctrl_id, char cmd, int subcmd, int icom_transaction (RIG *rig, int cmd, int subcmd, const unsigned char *payload, int payload_len, unsigned char *data, int *data_len); int read_icom_frame(hamlib_port_t *p, unsigned char rxbuffer[], int rxbuffer_len); -int rig2icom_mode(RIG *rig, rmode_t mode, pbwidth_t width, unsigned char *md, signed char *pd); +int rig2icom_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, unsigned char *md, signed char *pd); void icom2rig_mode(RIG *rig, unsigned char md, int pd, rmode_t *mode, pbwidth_t *width); #endif /* _FRAME_H */ diff --git a/rigs/icom/ic7000.c b/rigs/icom/ic7000.c index b722be8dd..f78df92ff 100644 --- a/rigs/icom/ic7000.c +++ b/rigs/icom/ic7000.c @@ -138,12 +138,12 @@ struct cmdparams ic7000_extcmds[] = /* * This function does the special bandwidth coding for IC-7000 */ -static int ic7000_r2i_mode(RIG *rig, rmode_t mode, pbwidth_t width, +static int ic7000_r2i_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, unsigned char *md, signed char *pd) { int err; - err = rig2icom_mode(rig, mode, width, md, pd); + err = rig2icom_mode(rig, vfo, mode, width, md, pd); if (err != RIG_OK) { diff --git a/rigs/icom/ic706.c b/rigs/icom/ic706.c index 95d3a400e..f420f617c 100644 --- a/rigs/icom/ic706.c +++ b/rigs/icom/ic706.c @@ -38,12 +38,12 @@ * and IC-706MKIIG * (0 - wide, 1 - normal, 2 - narrow) */ -static int ic706_r2i_mode(RIG *rig, rmode_t mode, pbwidth_t width, +static int ic706_r2i_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, unsigned char *md, signed char *pd) { int err; - err = rig2icom_mode(rig, mode, width, md, pd); + err = rig2icom_mode(rig, vfo, mode, width, md, pd); if (err != RIG_OK) { diff --git a/rigs/icom/ic746.c b/rigs/icom/ic746.c index 04be36ead..6fcada2fc 100644 --- a/rigs/icom/ic746.c +++ b/rigs/icom/ic746.c @@ -153,8 +153,8 @@ typedef channel_str_t band_stack_reg_t; static int ic746_set_parm(RIG *rig, setting_t parm, value_t val); static int ic746_get_parm(RIG *rig, setting_t parm, value_t *val); -static int ic746pro_get_channel(RIG *rig, channel_t *chan, int read_only); -static int ic746pro_set_channel(RIG *rig, const channel_t *chan); +static int ic746pro_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only); +static int ic746pro_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan); static int ic746pro_set_ext_parm(RIG *rig, token_t token, value_t val); static int ic746pro_get_ext_parm(RIG *rig, token_t token, value_t *val); @@ -905,7 +905,7 @@ int ic746_get_parm(RIG *rig, setting_t parm, value_t *val) * * If memory is empty it will return RIG_OK,but every thing will be null. Where do we boundary check? */ -int ic746pro_get_channel(RIG *rig, channel_t *chan, int read_only) +int ic746pro_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { struct icom_priv_data *priv; struct rig_state *rs; @@ -1071,7 +1071,7 @@ int ic746pro_get_channel(RIG *rig, channel_t *chan, int read_only) * ic746pro_set_channel * Assumes rig!=NULL, rig->state.priv!=NULL, chan!=NULL */ -int ic746pro_set_channel(RIG *rig, const channel_t *chan) +int ic746pro_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { struct icom_priv_data *priv; struct rig_state *rs; @@ -1103,7 +1103,7 @@ int ic746pro_set_channel(RIG *rig, const channel_t *chan) // RX to_bcd(membuf.rx.freq, chan->freq, freq_len * 2); - retval = rig2icom_mode(rig, chan->mode, chan->width, + retval = rig2icom_mode(rig, vfo, chan->mode, chan->width, &membuf.rx.mode, &membuf.rx.pb); if (retval != RIG_OK) @@ -1150,7 +1150,7 @@ int ic746pro_set_channel(RIG *rig, const channel_t *chan) // TX to_bcd(membuf.tx.freq, chan->tx_freq, freq_len * 2); - retval = rig2icom_mode(rig, chan->tx_mode, chan->tx_width, + retval = rig2icom_mode(rig, vfo, chan->tx_mode, chan->tx_width, &membuf.tx.mode, &membuf.tx.pb); if (retval != RIG_OK) diff --git a/rigs/icom/ic756.c b/rigs/icom/ic756.c index 26d322d76..2611b5ba0 100644 --- a/rigs/icom/ic756.c +++ b/rigs/icom/ic756.c @@ -97,12 +97,12 @@ int ic756_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); * This function deals with the older type radios with only 2 filter widths * (0 - normal, 1 - narrow) */ -static int r2i_mode(RIG *rig, rmode_t mode, pbwidth_t width, +static int r2i_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, unsigned char *md, signed char *pd) { int err; - err = rig2icom_mode(rig, mode, width, md, pd); + err = rig2icom_mode(rig, vfo, mode, width, md, pd); if (err != RIG_OK) { diff --git a/rigs/icom/ic910.c b/rigs/icom/ic910.c index 8156bbbe9..66b101d78 100644 --- a/rigs/icom/ic910.c +++ b/rigs/icom/ic910.c @@ -329,12 +329,12 @@ static int ic910_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) * This function does the special bandwidth coding for IC-910 * (1 - normal, 2 - narrow) */ -static int ic910_r2i_mode(RIG *rig, rmode_t mode, pbwidth_t width, +static int ic910_r2i_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, unsigned char *md, signed char *pd) { int err; - err = rig2icom_mode(rig, mode, width, md, pd); + err = rig2icom_mode(rig, vfo, mode, width, md, pd); if (*pd == PD_NARROW_3) { diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 7b12a79d2..acbc309f5 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -1631,7 +1631,7 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, { unsigned char mode_icom; // not used as it will map to USB/LSB signed char width_icom; - rig2icom_mode(rig, mode, width, &mode_icom, &width_icom); + rig2icom_mode(rig, vfo, mode, width, &mode_icom, &width_icom); // since width_icom is 0-2 for rigs that need this here we have to make it 1-3 datamode[1] = datamode[0] ? width_icom : 0; retval = @@ -1688,11 +1688,11 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) if (priv_caps->r2i_mode != NULL) /* call priv code if defined */ { - err = priv_caps->r2i_mode(rig, mode, width, &icmode, &icmode_ext); + err = priv_caps->r2i_mode(rig, vfo, mode, width, &icmode, &icmode_ext); } else /* else call default */ { - err = rig2icom_mode(rig, mode, width, &icmode, &icmode_ext); + err = rig2icom_mode(rig, vfo, mode, width, &icmode, &icmode_ext); } if (err < 0) diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index b264776a1..8a404cc60 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -161,7 +161,7 @@ struct icom_priv_caps // the 4 elements above are mandatory // everything below here is optional in the backends int settle_time; /*!< Receiver settle time, in ms */ - int (*r2i_mode)(RIG *rig, rmode_t mode, pbwidth_t width, + int (*r2i_mode)(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, unsigned char *md, signed char *pd); /*< backend specific code to convert bandwidth and mode to cmd tokens */ diff --git a/rigs/icom/icr30.c b/rigs/icom/icr30.c index 92f486779..f84cd91f4 100644 --- a/rigs/icom/icr30.c +++ b/rigs/icom/icr30.c @@ -85,12 +85,12 @@ struct cmdparams icr30_extcmds[] = * (1 - normal, 2 - narrow) */ -static int icr30_r2i_mode(RIG *rig, rmode_t mode, pbwidth_t width, +static int icr30_r2i_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, unsigned char *md, signed char *pd) { int err; - err = rig2icom_mode(rig, mode, width, md, pd); + err = rig2icom_mode(rig, vfo, mode, width, md, pd); if (*pd == PD_NARROW_3) { diff --git a/rigs/icom/icr75.c b/rigs/icom/icr75.c index 2f5093221..18291cd8a 100644 --- a/rigs/icom/icr75.c +++ b/rigs/icom/icr75.c @@ -91,8 +91,8 @@ .flags = 1, \ } -static int icr75_set_channel(RIG *rig, const channel_t *chan); -static int icr75_get_channel(RIG *rig, channel_t *chan, int read_only); +static int icr75_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan); +static int icr75_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only); static int icr75_set_parm(RIG *rig, setting_t parm, value_t val); static int icr75_get_parm(RIG *rig, setting_t parm, value_t *val); @@ -251,7 +251,7 @@ const struct rig_caps icr75_caps = * Assumes rig!=NULL, rig->state.priv!=NULL, chan!=NULL * TODO: still a WIP --SF */ -int icr75_set_channel(RIG *rig, const channel_t *chan) +int icr75_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { struct icom_priv_data *priv; struct rig_state *rs; @@ -276,7 +276,7 @@ int icr75_set_channel(RIG *rig, const channel_t *chan) chan_len = 2 + freq_len + 1; - err = rig2icom_mode(rig, chan->mode, chan->width, + err = rig2icom_mode(rig, vfo, chan->mode, chan->width, &icmode, &icmode_ext); if (err != RIG_OK) @@ -320,7 +320,7 @@ int icr75_set_channel(RIG *rig, const channel_t *chan) * Assumes rig!=NULL, rig->state.priv!=NULL, chan!=NULL * TODO: still a WIP --SF */ -int icr75_get_channel(RIG *rig, channel_t *chan, int read_only) +int icr75_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { struct icom_priv_data *priv; struct rig_state *rs; diff --git a/rigs/icom/optoscan.c b/rigs/icom/optoscan.c index da37e6cd7..5d8440442 100644 --- a/rigs/icom/optoscan.c +++ b/rigs/icom/optoscan.c @@ -54,7 +54,7 @@ const struct confparams opto_ext_parms[] = }; static int optoscan_get_status_block(RIG *rig, struct optostat *status_block); -static int optoscan_send_freq(RIG *rig, pltstate_t *state); +static int optoscan_send_freq(RIG *rig, vfo_t vfo, pltstate_t *state); static int optoscan_RTS_toggle(RIG *rig); static int optoscan_start_timer(RIG *rig, pltstate_t *state); static int optoscan_wait_timer(RIG *rig, pltstate_t *state); @@ -643,7 +643,7 @@ int optoscan_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch) } /* Step 1 is implicit, since hamlib does this when it opens the device */ - optoscan_send_freq(rig, state); /*Step 2*/ + optoscan_send_freq(rig, vfo, state); /*Step 2*/ } rc = 0; @@ -662,7 +662,7 @@ int optoscan_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch) if (rc != RIG_SCAN_STOP) { - optoscan_send_freq(rig, state); /*Step 4*/ + optoscan_send_freq(rig, vfo, state); /*Step 4*/ } optoscan_wait_timer(rig, state); /*Step 5*/ @@ -768,7 +768,7 @@ static int optoscan_get_status_block(RIG *rig, struct optostat *status_block) } -static int optoscan_send_freq(RIG *rig, pltstate_t *state) +static int optoscan_send_freq(RIG *rig, vfo_t vfo, pltstate_t *state) { unsigned char buff[OPTO_BUFF_SIZE]; char md, pd; @@ -782,7 +782,7 @@ static int optoscan_send_freq(RIG *rig, pltstate_t *state) to_bcd(buff, freq, 5 * 2); /* to_bcd requires nibble len */ - rig2icom_mode(rig, mode, 0, (unsigned char *) &md, (signed char *) &pd); + rig2icom_mode(rig, vfo, mode, 0, (unsigned char *) &md, (signed char *) &pd); buff[5] = md; /* read echo'd chars only...there will be no ACK from this command diff --git a/rigs/icom/perseus.c b/rigs/icom/perseus.c index e875962da..bbe46b0ca 100644 --- a/rigs/icom/perseus.c +++ b/rigs/icom/perseus.c @@ -58,7 +58,7 @@ } } -static int perseus_r2i_mode(RIG *rig, rmode_t mode, pbwidth_t width, +static int perseus_r2i_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, unsigned char *md, signed char *pd); static void perseus_i2r_mode(RIG *rig, unsigned char md, int pd, rmode_t *mode, pbwidth_t *width); @@ -184,12 +184,12 @@ const struct rig_caps perseus_caps = * * NB: the filter width will be ignored. */ -static int perseus_r2i_mode(RIG *rig, rmode_t mode, pbwidth_t width, +static int perseus_r2i_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, unsigned char *md, signed char *pd) { int err; - err = rig2icom_mode(rig, mode, width, md, pd); + err = rig2icom_mode(rig, vfo, mode, width, md, pd); if (err == 0 && mode == RIG_MODE_SAM) { diff --git a/rigs/jrc/jrc.c b/rigs/jrc/jrc.c index 5e08bd5ec..15116df02 100644 --- a/rigs/jrc/jrc.c +++ b/rigs/jrc/jrc.c @@ -1401,7 +1401,7 @@ int jrc_get_mem(RIG *rig, vfo_t vfo, int *ch) * jrc_set_chan * Assumes rig!=NULL */ -int jrc_set_chan(RIG *rig, const channel_t *chan) +int jrc_set_chan(RIG *rig, vfo_t vfo, const channel_t *chan) { struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv; char cmdbuf[BUFSZ]; @@ -1413,7 +1413,7 @@ int jrc_set_chan(RIG *rig, const channel_t *chan) /* read first to get current values */ current.channel_num = chan->channel_num; - if ((retval = jrc_get_chan(rig, ¤t, 1)) != RIG_OK) { return retval; } + if ((retval = jrc_get_chan(rig, vfo, ¤t, 1)) != RIG_OK) { return retval; } sprintf(cmdbuf, "K%03d000", chan->channel_num); @@ -1465,7 +1465,7 @@ int jrc_set_chan(RIG *rig, const channel_t *chan) * jrc_get_chan * Assumes rig!=NULL */ -int jrc_get_chan(RIG *rig, channel_t *chan, int read_only) +int jrc_get_chan(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv; char membuf[BUFSZ], cmdbuf[BUFSZ]; diff --git a/rigs/jrc/jrc.h b/rigs/jrc/jrc.h index f301ea2f4..d3a4049d4 100644 --- a/rigs/jrc/jrc.h +++ b/rigs/jrc/jrc.h @@ -54,8 +54,8 @@ int jrc_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd); int jrc_set_trn(RIG *rig, int trn); int jrc_set_mem(RIG *rig, vfo_t vfo, int ch); int jrc_get_mem(RIG *rig, vfo_t vfo, int *ch); -int jrc_set_chan(RIG *rig, const channel_t *chan); -int jrc_get_chan(RIG *rig, channel_t *chan, int read_only); +int jrc_set_chan(RIG *rig, vfo_t vfo, const channel_t *chan); +int jrc_get_chan(RIG *rig, vfo_t vfo, channel_t *chan, int read_only); int jrc_set_powerstat(RIG *rig, powerstat_t status); int jrc_get_powerstat(RIG *rig, powerstat_t *status); int jrc_reset(RIG *rig, reset_t reset); diff --git a/rigs/kenwood/ic10.c b/rigs/kenwood/ic10.c index 3f2763559..07a10d19e 100644 --- a/rigs/kenwood/ic10.c +++ b/rigs/kenwood/ic10.c @@ -634,7 +634,7 @@ int ic10_set_mem(RIG *rig, vfo_t vfo, int ch) } -int ic10_get_channel(RIG *rig, channel_t *chan, int read_only) +int ic10_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { char membuf[16], infobuf[32]; int retval, info_len, len; @@ -731,7 +731,7 @@ int ic10_get_channel(RIG *rig, channel_t *chan, int read_only) } -int ic10_set_channel(RIG *rig, const channel_t *chan) +int ic10_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { char membuf[64]; int retval, len, md; diff --git a/rigs/kenwood/ic10.h b/rigs/kenwood/ic10.h index 4cc8b1440..b712623c3 100644 --- a/rigs/kenwood/ic10.h +++ b/rigs/kenwood/ic10.h @@ -46,8 +46,8 @@ int ic10_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); int ic10_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); int ic10_set_mem(RIG *rig, vfo_t vfo, int ch); int ic10_get_mem(RIG *rig, vfo_t vfo, int *ch); -int ic10_set_channel(RIG *rig, const channel_t *chan); -int ic10_get_channel(RIG *rig, channel_t *chan, int read_only); +int ic10_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan); +int ic10_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only); int ic10_set_powerstat(RIG *rig, powerstat_t status); int ic10_get_powerstat(RIG *rig, powerstat_t *status); int ic10_set_trn(RIG *rig, int trn); diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index f013f91a8..57e0d7396 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -4242,7 +4242,7 @@ int kenwood_get_mem_if(RIG *rig, vfo_t vfo, int *ch) return RIG_OK; } -int kenwood_get_channel(RIG *rig, channel_t *chan, int read_only) +int kenwood_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { int err; char buf[26]; @@ -4364,7 +4364,7 @@ int kenwood_get_channel(RIG *rig, channel_t *chan, int read_only) return RIG_OK; } -int kenwood_set_channel(RIG *rig, const channel_t *chan) +int kenwood_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { char buf[128]; char mode, tx_mode = 0; diff --git a/rigs/kenwood/kenwood.h b/rigs/kenwood/kenwood.h index 8dcc8bfa7..7766ebd75 100644 --- a/rigs/kenwood/kenwood.h +++ b/rigs/kenwood/kenwood.h @@ -201,8 +201,8 @@ int kenwood_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); int kenwood_set_mem(RIG *rig, vfo_t vfo, int ch); int kenwood_get_mem(RIG *rig, vfo_t vfo, int *ch); int kenwood_get_mem_if(RIG *rig, vfo_t vfo, int *ch); -int kenwood_get_channel(RIG *rig, channel_t *chan, int read_only); -int kenwood_set_channel(RIG *rig, const channel_t *chan); +int kenwood_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only); +int kenwood_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan); int kenwood_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch); const char *kenwood_get_info(RIG *rig); int kenwood_get_id(RIG *rig, char *buf); diff --git a/rigs/kenwood/pihpsdr.c b/rigs/kenwood/pihpsdr.c index ad9e61163..4e5f9ab91 100644 --- a/rigs/kenwood/pihpsdr.c +++ b/rigs/kenwood/pihpsdr.c @@ -64,8 +64,8 @@ static int pihpsdr_open(RIG *rig); static int pihpsdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int pihpsdr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); -static int pihspdr_get_channel(RIG *rig, channel_t *chan, int read_only); -static int pihspdr_set_channel(RIG *rig, const channel_t *chan); +static int pihspdr_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only); +static int pihspdr_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan); static struct kenwood_priv_caps ts2000_priv_caps = @@ -342,7 +342,7 @@ const struct rig_caps pihpsdr_caps = */ -int pihspdr_get_channel(RIG *rig, channel_t *chan, int read_only) +int pihspdr_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { int err; int tmp; @@ -580,7 +580,7 @@ int pihspdr_get_channel(RIG *rig, channel_t *chan, int read_only) return RIG_OK; } -int pihspdr_set_channel(RIG *rig, const channel_t *chan) +int pihspdr_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { char sqltype; char shift; diff --git a/rigs/kenwood/th.c b/rigs/kenwood/th.c index 1a352e59d..33a68a281 100644 --- a/rigs/kenwood/th.c +++ b/rigs/kenwood/th.c @@ -1895,7 +1895,7 @@ int th_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) /* get and set channel tested on thg71&thf7e */ /* must work on other th and tm kenwood rigs */ /* --------------------------------------------------------------------- */ -int th_get_channel(RIG *rig, channel_t *chan, int read_only) +int th_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { char membuf[64], ackbuf[ACKBUF_LEN]; int retval; @@ -1904,7 +1904,7 @@ int th_get_channel(RIG *rig, channel_t *chan, int read_only) int step, shift, rev, tone, ctcss, tonefq, ctcssfq, dcs, dcscode, mode, lockout; const char *mr_extra; int channel_num; - vfo_t vfo; + vfo_t vfotmp; const struct kenwood_priv_caps *priv = (const struct kenwood_priv_caps *) rig->caps->priv; const chan_t *chan_caps; @@ -1926,10 +1926,10 @@ int th_get_channel(RIG *rig, channel_t *chan, int read_only) } channel_num = chan->channel_num; - vfo = chan->vfo; + vfotmp = chan->vfo; memset(chan, 0, sizeof(channel_t)); chan->channel_num = channel_num; - chan->vfo = vfo; + chan->vfo = vfotmp; if (rig->caps->rig_model == RIG_MODEL_THF7E || rig->caps->rig_model == RIG_MODEL_THF6A) @@ -2215,7 +2215,7 @@ static int find_tone_index(const tone_t *tone_list, tone_t tone) } /* --------------------------------------------------------------------- */ -int th_set_channel(RIG *rig, const channel_t *chan) +int th_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { char membuf[256]; int retval; diff --git a/rigs/kenwood/th.h b/rigs/kenwood/th.h index 62161ac77..7458a5fca 100644 --- a/rigs/kenwood/th.h +++ b/rigs/kenwood/th.h @@ -60,8 +60,8 @@ extern int th_get_mem(RIG *rig, vfo_t vfo, int *ch); extern int th_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); extern int th_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); extern int th_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd); -extern int th_get_channel(RIG *rig, channel_t *chan, int read_only); -extern int th_set_channel(RIG *rig, const channel_t *chan); +extern int th_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only); +extern int th_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan); extern int th_set_ant (RIG * rig, vfo_t vfo, ant_t ant, value_t option); extern int th_get_ant (RIG * rig, vfo_t vfo, ant_t dummy, value_t *option, ant_t * ant_curr, ant_t *ant_tx, ant_t *ant_rx); extern int th_reset(RIG *rig, reset_t reset); diff --git a/rigs/kenwood/thd72.c b/rigs/kenwood/thd72.c index 7fcb32a52..0ad208a73 100644 --- a/rigs/kenwood/thd72.c +++ b/rigs/kenwood/thd72.c @@ -1271,7 +1271,7 @@ static int thd72_get_mem(RIG *rig, vfo_t vfo, int *ch) return RIG_OK; } -static int thd72_set_channel(RIG *rig, const channel_t *chan) +static int thd72_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); @@ -1358,7 +1358,7 @@ static int thd72_parse_channel(int kind, const char *buf, channel_t *chan) return RIG_OK; } -static int thd72_get_channel(RIG *rig, channel_t *chan, int read_only) +static int thd72_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { int retval; char buf[72]; diff --git a/rigs/kenwood/thd74.c b/rigs/kenwood/thd74.c index 2605b7211..b19d8bd6d 100644 --- a/rigs/kenwood/thd74.c +++ b/rigs/kenwood/thd74.c @@ -1188,7 +1188,7 @@ static int thd74_get_mem(RIG *rig, vfo_t vfo, int *ch) return RIG_OK; } -static int thd74_set_channel(RIG *rig, const channel_t *chan) +static int thd74_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); @@ -1275,7 +1275,7 @@ static int thd74_parse_channel(int kind, const char *buf, channel_t *chan) return RIG_OK; } -static int thd74_get_channel(RIG *rig, channel_t *chan, int read_only) +static int thd74_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { int retval; char buf[72]; diff --git a/rigs/kenwood/tmd710.c b/rigs/kenwood/tmd710.c index c9c6516c8..70106d7b2 100644 --- a/rigs/kenwood/tmd710.c +++ b/rigs/kenwood/tmd710.c @@ -70,8 +70,8 @@ static int tmd710_get_mem(RIG *rig, vfo_t vfo, int *ch); static int tmd710_set_mem(RIG *rig, vfo_t vfo, int ch); static int tmd710_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code); static int tmd710_get_dcs_sql(RIG *rig, vfo_t vfo, tone_t *code); -static int tmd710_set_channel(RIG *rig, const channel_t *chan); -static int tmd710_get_channel(RIG *rig, channel_t *chan, int read_only); +static int tmd710_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan); +static int tmd710_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only); static int tmd710_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); static int tmd710_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd); static int tmd710_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); @@ -1833,7 +1833,7 @@ int tmd710_set_mem(RIG *rig, vfo_t vfo, int ch) return kenwood_safe_transaction(rig, cmd, membuf, sizeof(membuf), 8); } -int tmd710_get_channel(RIG *rig, channel_t *chan, int read_only) +int tmd710_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { int retval; tmd710_me me_struct; @@ -1946,7 +1946,7 @@ int tmd710_get_channel(RIG *rig, channel_t *chan, int read_only) return RIG_OK; } -int tmd710_set_channel(RIG *rig, const channel_t *chan) +int tmd710_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { int retval; tmd710_me me_struct; diff --git a/rigs/kenwood/tmv7.c b/rigs/kenwood/tmv7.c index 29f58db51..0aebff5ec 100644 --- a/rigs/kenwood/tmv7.c +++ b/rigs/kenwood/tmv7.c @@ -87,8 +87,8 @@ static int tmv7_decode_event(RIG *rig); static int tmv7_set_vfo(RIG *rig, vfo_t vfo); static int tmv7_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int tmv7_get_powerstat(RIG *rig, powerstat_t *status); -static int tmv7_get_channel(RIG *rig, channel_t *chan, int read_only); -static int tmv7_set_channel(RIG *rig, const channel_t *chan); +static int tmv7_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only); +static int tmv7_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan); /* * tm-v7 rig capabilities. @@ -496,7 +496,7 @@ int tmv7_get_powerstat(RIG *rig, powerstat_t *status) /* --------------------------------------------------------------------- */ -int tmv7_get_channel(RIG *rig, channel_t *chan, int read_only) +int tmv7_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { char membuf[64], ackbuf[ACKBUF_LEN]; int retval; @@ -662,7 +662,7 @@ int tmv7_get_channel(RIG *rig, channel_t *chan, int read_only) return RIG_OK; } /* --------------------------------------------------------------------- */ -int tmv7_set_channel(RIG *rig, const channel_t *chan) +int tmv7_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { char membuf[ACKBUF_LEN]; int retval; diff --git a/rigs/kenwood/ts2000.c b/rigs/kenwood/ts2000.c index e2f4e8ab3..2b17788fb 100644 --- a/rigs/kenwood/ts2000.c +++ b/rigs/kenwood/ts2000.c @@ -58,8 +58,8 @@ /* prototypes */ static int ts2000_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); -static int ts2000_get_channel(RIG *rig, channel_t *chan, int read_only); -static int ts2000_set_channel(RIG *rig, const channel_t *chan); +static int ts2000_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only); +static int ts2000_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan); /* * 38 CTCSS sub-audible tones + 1750 tone @@ -369,7 +369,7 @@ const struct rig_caps ts2000_caps = */ -int ts2000_get_channel(RIG *rig, channel_t *chan, int read_only) +int ts2000_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { int err; int tmp; @@ -607,7 +607,7 @@ int ts2000_get_channel(RIG *rig, channel_t *chan, int read_only) return RIG_OK; } -int ts2000_set_channel(RIG *rig, const channel_t *chan) +int ts2000_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { char sqltype = '0'; char buf[128]; diff --git a/rigs/kenwood/ts570.c b/rigs/kenwood/ts570.c index badf41db2..a836029f0 100644 --- a/rigs/kenwood/ts570.c +++ b/rigs/kenwood/ts570.c @@ -688,7 +688,7 @@ int ts570_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo) .ctcss_tone=1 \ } -int ts570_set_channel(RIG *rig, const channel_t *chan) +int ts570_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { char cmdbuf[30]; int retval, cmd_len; diff --git a/rigs/kenwood/ts850.c b/rigs/kenwood/ts850.c index a8340f3f5..307de1014 100644 --- a/rigs/kenwood/ts850.c +++ b/rigs/kenwood/ts850.c @@ -73,7 +73,7 @@ static struct kenwood_priv_caps ts850_priv_caps = static int ts850_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit); static int ts850_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit); static int ts850_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); -static int ts850_set_channel(RIG *rig, const channel_t *chan); +static int ts850_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan); static const struct confparams ts850_ext_parms[] = { @@ -513,7 +513,7 @@ int ts850_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) return retval; // Never gets here. } -int ts850_set_channel(RIG *rig, const channel_t *chan) +int ts850_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { char cmdbuf[30]; int retval; diff --git a/rigs/prm80/prm80.c b/rigs/prm80/prm80.c index 1eefa60b2..580f8a3f9 100644 --- a/rigs/prm80/prm80.c +++ b/rigs/prm80/prm80.c @@ -201,7 +201,7 @@ int prm80_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) memset(&chan, 0, sizeof(chan)); chan.vfo = RIG_VFO_CURR; - ret = prm80_get_channel(rig, &chan, 0); + ret = prm80_get_channel(rig, vfo, &chan, 0); if (ret != RIG_OK) { @@ -246,7 +246,7 @@ int prm80_get_mem(RIG *rig, vfo_t vfo, int *ch) memset(&chan, 0, sizeof(chan)); chan.vfo = RIG_VFO_CURR; - ret = prm80_get_channel(rig, &chan, 0); + ret = prm80_get_channel(rig, vfo, &chan, 0); if (ret != RIG_OK) { @@ -276,7 +276,7 @@ static int hhtoi(const char *p) * prm80_get_channel * Assumes rig!=NULL */ -int prm80_get_channel(RIG *rig, channel_t *chan, int read_only) +int prm80_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { char statebuf[BUFSZ]; int statebuf_len = BUFSZ; @@ -347,7 +347,7 @@ int prm80_get_channel(RIG *rig, channel_t *chan, int read_only) * prm80_set_channel * Assumes rig!=NULL */ -int prm80_set_channel(RIG *rig, const channel_t *chan) +int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { char statebuf[BUFSZ]; int statebuf_len = BUFSZ; @@ -432,7 +432,7 @@ int prm80_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) memset(&chan, 0, sizeof(chan)); chan.vfo = RIG_VFO_CURR; - ret = prm80_get_channel(rig, &chan, 1); + ret = prm80_get_channel(rig, vfo, &chan, 1); if (ret != RIG_OK) { diff --git a/rigs/prm80/prm80.h b/rigs/prm80/prm80.h index 33a82f174..71e96a138 100644 --- a/rigs/prm80/prm80.h +++ b/rigs/prm80/prm80.h @@ -42,8 +42,8 @@ int prm80_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int prm80_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); int prm80_set_mem (RIG *rig, vfo_t vfo, int ch); int prm80_get_mem (RIG *rig, vfo_t vfo, int *ch); -int prm80_set_channel(RIG * rig, const channel_t * chan); -int prm80_get_channel(RIG * rig, channel_t * chan, int read_only); +int prm80_set_channel(RIG * rig, vfo_t vfo, const channel_t * chan); +int prm80_get_channel(RIG * rig, vfo_t vfo, channel_t * chan, int read_only); const char* prm80_get_info(RIG *rig); diff --git a/rigs/uniden/uniden.c b/rigs/uniden/uniden.c index 31a1885d9..68ecf9da8 100644 --- a/rigs/uniden/uniden.c +++ b/rigs/uniden/uniden.c @@ -590,7 +590,7 @@ int uniden_get_mem(RIG *rig, vfo_t vfo, int *ch) * uniden_get_channel * Assumes rig!=NULL */ -int uniden_get_channel(RIG *rig, channel_t *chan, int read_only) +int uniden_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { char cmdbuf[BUFSZ], membuf[BUFSZ]; size_t cmd_len = BUFSZ, mem_len = BUFSZ; @@ -689,7 +689,7 @@ int uniden_get_channel(RIG *rig, channel_t *chan, int read_only) * * Only freq can be set? */ -int uniden_set_channel(RIG *rig, const channel_t *chan) +int uniden_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { char cmdbuf[BUFSZ], membuf[BUFSZ]; size_t cmd_len = BUFSZ, mem_len = BUFSZ; diff --git a/rigs/uniden/uniden.h b/rigs/uniden/uniden.h index 4ea114ff4..ed3eea64b 100644 --- a/rigs/uniden/uniden.h +++ b/rigs/uniden/uniden.h @@ -66,8 +66,8 @@ int uniden_get_mem(RIG *rig, vfo_t vfo, int *ch); int uniden_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd); int uniden_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int uniden_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); -int uniden_get_channel(RIG *rig, channel_t *chan, int read_only); -int uniden_set_channel(RIG *rig, const channel_t *chan); +int uniden_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only); +int uniden_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan); const char* uniden_get_info(RIG *rig); extern const struct rig_caps bc895_caps; diff --git a/rigs/yaesu/ft1000d.c b/rigs/yaesu/ft1000d.c index 89e5da751..f30e03569 100644 --- a/rigs/yaesu/ft1000d.c +++ b/rigs/yaesu/ft1000d.c @@ -2666,7 +2666,7 @@ int ft1000d_get_mem(RIG *rig, vfo_t vfo, int *ch) * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure */ -int ft1000d_set_channel(RIG *rig, const channel_t *chan) +int ft1000d_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -2698,7 +2698,7 @@ int ft1000d_set_channel(RIG *rig, const channel_t *chan) * Status for split operation, active rig functions and tuning steps * are only relevant for currVFO */ -int ft1000d_get_channel(RIG *rig, channel_t *chan, int read_only) +int ft1000d_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { struct ft1000d_priv_data *priv; ft1000d_op_data_t *p; diff --git a/rigs/yaesu/ft1000d.h b/rigs/yaesu/ft1000d.h index 65d8f792c..23cfbfd19 100644 --- a/rigs/yaesu/ft1000d.h +++ b/rigs/yaesu/ft1000d.h @@ -193,8 +193,8 @@ int ft1000d_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *value); int ft1000d_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); int ft1000d_set_mem(RIG *rig, vfo_t vfo, int ch); int ft1000d_get_mem(RIG *rig, vfo_t vfo, int *ch); -int ft1000d_set_channel (RIG *rig, const channel_t *chan); -int ft1000d_get_channel (RIG *rig, channel_t *chan, int read_only); +int ft1000d_set_channel (RIG *rig, vfo_t vfo, const channel_t *chan); +int ft1000d_get_channel (RIG *rig, vfo_t vfo, channel_t *chan, int read_only); /* diff --git a/rigs/yaesu/ft990.c b/rigs/yaesu/ft990.c index 95940bbc6..3aeb82d69 100644 --- a/rigs/yaesu/ft990.c +++ b/rigs/yaesu/ft990.c @@ -2615,7 +2615,7 @@ int ft990_get_mem(RIG *rig, vfo_t vfo, int *ch) * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure */ -int ft990_set_channel(RIG *rig, const channel_t *chan) +int ft990_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -2647,7 +2647,7 @@ int ft990_set_channel(RIG *rig, const channel_t *chan) * Status for split operation, active rig functions and tuning steps * are only relevant for currVFO */ -int ft990_get_channel(RIG *rig, channel_t *chan, int read_only) +int ft990_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { struct ft990_priv_data *priv; ft990_op_data_t *p; diff --git a/rigs/yaesu/ft990.h b/rigs/yaesu/ft990.h index 159237594..fc66043c3 100644 --- a/rigs/yaesu/ft990.h +++ b/rigs/yaesu/ft990.h @@ -175,8 +175,8 @@ int ft990_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); int ft990_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); int ft990_set_mem(RIG *rig, vfo_t vfo, int ch); int ft990_get_mem(RIG *rig, vfo_t vfo, int *ch); -int ft990_set_channel (RIG *rig, const channel_t *chan); -int ft990_get_channel (RIG *rig, channel_t *chan, int read_only); +int ft990_set_channel (RIG *rig, vfo_t vfo, const channel_t *chan); +int ft990_get_channel (RIG *rig, vfo_t vfo, channel_t *chan, int read_only); /* diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 15e921452..3df1a439e 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -5336,7 +5336,7 @@ int newcat_set_mem(RIG *rig, vfo_t vfo, int ch) /* Test for valid usable channel, skip if empty */ memset(&valid_chan, 0, sizeof(channel_t)); valid_chan.channel_num = ch; - err = newcat_get_channel(rig, &valid_chan, 1); + err = newcat_get_channel(rig, vfo, &valid_chan, 1); if (err < 0) { @@ -5620,7 +5620,7 @@ int newcat_decode_event(RIG *rig) } -int newcat_set_channel(RIG *rig, const channel_t *chan) +int newcat_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { struct rig_state *state = &rig->state; struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; @@ -5778,7 +5778,7 @@ int newcat_set_channel(RIG *rig, const channel_t *chan) } -int newcat_get_channel(RIG *rig, channel_t *chan, int read_only) +int newcat_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) { struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; char *retval; diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h index 4d70a9f86..5c16c129e 100644 --- a/rigs/yaesu/newcat.h +++ b/rigs/yaesu/newcat.h @@ -211,8 +211,8 @@ int newcat_set_ts(RIG * rig, vfo_t vfo, shortfreq_t ts); int newcat_get_ts(RIG * rig, vfo_t vfo, shortfreq_t * ts); int newcat_set_trn(RIG * rig, int trn); int newcat_get_trn(RIG * rig, int *trn); -int newcat_set_channel(RIG * rig, const channel_t * chan); -int newcat_get_channel(RIG * rig, channel_t * chan, int read_only); +int newcat_set_channel(RIG * rig, vfo_t vfo, const channel_t * chan); +int newcat_get_channel(RIG * rig, vfo_t vfo, channel_t * chan, int read_only); rmode_t newcat_rmode(char mode); char newcat_modechar(rmode_t rmode); rmode_t newcat_rmode_width(RIG *rig, vfo_t vfo, char mode, pbwidth_t *width); diff --git a/src/mem.c b/src/mem.c index 9d347cf9b..769dda6f5 100644 --- a/src/mem.c +++ b/src/mem.c @@ -685,12 +685,12 @@ static int generic_restore_channel(RIG *rig, const channel_t *chan) * * \sa rig_get_channel() */ -int HAMLIB_API rig_set_channel(RIG *rig, const channel_t *chan) +int HAMLIB_API rig_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { struct rig_caps *rc; int curr_chan_num, get_mem_status = RIG_OK; vfo_t curr_vfo; - vfo_t vfo; /* requested vfo */ + vfo_t vfotmp; /* requested vfo */ int retcode; int can_emulate_by_vfo_mem, can_emulate_by_vfo_op; @@ -709,7 +709,7 @@ int HAMLIB_API rig_set_channel(RIG *rig, const channel_t *chan) if (rc->set_channel) { - return rc->set_channel(rig, chan); + return rc->set_channel(rig, vfo, chan); } /* @@ -717,15 +717,15 @@ int HAMLIB_API rig_set_channel(RIG *rig, const channel_t *chan) * Optional: get_vfo, set_vfo, */ - vfo = chan->vfo; + vfotmp = chan->vfo; - if (vfo == RIG_VFO_CURR) + if (vfotmp == RIG_VFO_CURR) { return generic_restore_channel(rig, chan); } /* any emulation requires set_mem() */ - if (vfo == RIG_VFO_MEM && !rc->set_mem) + if (vfotmp == RIG_VFO_MEM && !rc->set_mem) { return -RIG_ENAVAIL; } @@ -743,14 +743,14 @@ int HAMLIB_API rig_set_channel(RIG *rig, const channel_t *chan) curr_vfo = rig->state.current_vfo; - if (vfo == RIG_VFO_MEM) + if (vfotmp == RIG_VFO_MEM) { get_mem_status = rig_get_mem(rig, RIG_VFO_CURR, &curr_chan_num); } - if (can_emulate_by_vfo_mem && curr_vfo != vfo) + if (can_emulate_by_vfo_mem && curr_vfo != vfotmp) { - retcode = rig_set_vfo(rig, vfo); + retcode = rig_set_vfo(rig, vfotmp); if (retcode != RIG_OK) { @@ -758,7 +758,7 @@ int HAMLIB_API rig_set_channel(RIG *rig, const channel_t *chan) } } - if (vfo == RIG_VFO_MEM) + if (vfotmp == RIG_VFO_MEM) { rig_set_mem(rig, RIG_VFO_CURR, chan->channel_num); } @@ -776,7 +776,7 @@ int HAMLIB_API rig_set_channel(RIG *rig, const channel_t *chan) } /* restore current memory number */ - if (vfo == RIG_VFO_MEM && get_mem_status == RIG_OK) + if (vfotmp == RIG_VFO_MEM && get_mem_status == RIG_OK) { rig_set_mem(rig, RIG_VFO_CURR, curr_chan_num); } @@ -829,12 +829,12 @@ int HAMLIB_API rig_set_channel(RIG *rig, const channel_t *chan) * * \sa rig_set_channel() */ -int HAMLIB_API rig_get_channel(RIG *rig, channel_t *chan, int read_only) +int HAMLIB_API rig_get_channel(RIG *rig, vfo_t vfox, channel_t *chan, int read_only) { struct rig_caps *rc; int curr_chan_num, get_mem_status = RIG_OK; vfo_t curr_vfo; - vfo_t vfo; /* requested vfo */ + vfo_t vfotmp=RIG_VFO_NONE; /* requested vfo */ int retcode = RIG_OK; int can_emulate_by_vfo_mem, can_emulate_by_vfo_op; @@ -853,7 +853,7 @@ int HAMLIB_API rig_get_channel(RIG *rig, channel_t *chan, int read_only) if (rc->get_channel) { - return rc->get_channel(rig, chan, read_only); + return rc->get_channel(rig, vfotmp, chan, read_only); } /* @@ -861,15 +861,15 @@ int HAMLIB_API rig_get_channel(RIG *rig, channel_t *chan, int read_only) * Optional: get_vfo, set_vfo * TODO: check return codes */ - vfo = chan->vfo; + vfotmp = chan->vfo; - if (vfo == RIG_VFO_CURR) + if (vfotmp == RIG_VFO_CURR) { return generic_save_channel(rig, chan); } /* any emulation requires set_mem() */ - if (vfo == RIG_VFO_MEM && !rc->set_mem) + if (vfotmp == RIG_VFO_MEM && !rc->set_mem) { return -RIG_ENAVAIL; } @@ -887,16 +887,16 @@ int HAMLIB_API rig_get_channel(RIG *rig, channel_t *chan, int read_only) curr_vfo = rig->state.current_vfo; - if (vfo == RIG_VFO_MEM) + if (vfotmp == RIG_VFO_MEM) { get_mem_status = rig_get_mem(rig, RIG_VFO_CURR, &curr_chan_num); } if (!read_only) { - if (can_emulate_by_vfo_mem && curr_vfo != vfo) + if (can_emulate_by_vfo_mem && curr_vfo != vfotmp) { - retcode = rig_set_vfo(rig, vfo); + retcode = rig_set_vfo(rig, vfotmp); if (retcode != RIG_OK) { @@ -904,7 +904,7 @@ int HAMLIB_API rig_get_channel(RIG *rig, channel_t *chan, int read_only) } } - if (vfo == RIG_VFO_MEM) + if (vfotmp == RIG_VFO_MEM) { rig_set_mem(rig, RIG_VFO_CURR, chan->channel_num); } @@ -922,7 +922,7 @@ int HAMLIB_API rig_get_channel(RIG *rig, channel_t *chan, int read_only) retcode = generic_save_channel(rig, chan); /* restore current memory number */ - if (vfo == RIG_VFO_MEM && get_mem_status == RIG_OK) + if (vfotmp == RIG_VFO_MEM && get_mem_status == RIG_OK) { rig_set_mem(rig, RIG_VFO_CURR, curr_chan_num); } @@ -939,7 +939,7 @@ int HAMLIB_API rig_get_channel(RIG *rig, channel_t *chan, int read_only) #ifndef DOC_HIDDEN -int get_chan_all_cb_generic(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg) +int get_chan_all_cb_generic(RIG *rig, vfo_t vfo, chan_cb_t chan_cb, rig_ptr_t arg) { int i, j; chan_t *chan_list = rig->state.chan_list; @@ -977,7 +977,7 @@ int get_chan_all_cb_generic(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg) /* * TODO: if doesn't have rc->get_channel, special generic */ - retval = rig_get_channel(rig, chan, 1); + retval = rig_get_channel(rig, vfo, chan, 1); if (retval == -RIG_ENAVAIL) { @@ -1004,7 +1004,7 @@ int get_chan_all_cb_generic(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg) } -int set_chan_all_cb_generic(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg) +int set_chan_all_cb_generic(RIG *rig, vfo_t vfo, chan_cb_t chan_cb, rig_ptr_t arg) { int i, j, retval; chan_t *chan_list = rig->state.chan_list; @@ -1019,7 +1019,7 @@ int set_chan_all_cb_generic(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg) chan_cb(rig, &chan, j, chan_list, arg); chan->vfo = RIG_VFO_MEM; - retval = rig_set_channel(rig, chan); + retval = rig_set_channel(rig, vfo, chan); if (retval != RIG_OK) { @@ -1076,7 +1076,7 @@ static int map_chan(RIG *rig, * * \sa rig_set_chan_all(), rig_get_chan_all_cb() */ -int HAMLIB_API rig_set_chan_all_cb(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg) +int HAMLIB_API rig_set_chan_all_cb(RIG *rig, vfo_t vfo, chan_cb_t chan_cb, rig_ptr_t arg) { struct rig_caps *rc; int retval; @@ -1092,11 +1092,11 @@ int HAMLIB_API rig_set_chan_all_cb(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg) if (rc->set_chan_all_cb) { - return rc->set_chan_all_cb(rig, chan_cb, arg); + return rc->set_chan_all_cb(rig, vfo, chan_cb, arg); } /* if not available, emulate it */ - retval = set_chan_all_cb_generic(rig, chan_cb, arg); + retval = set_chan_all_cb_generic(rig, vfo, chan_cb, arg); return retval; } @@ -1122,7 +1122,7 @@ int HAMLIB_API rig_set_chan_all_cb(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg) * * \sa rig_get_chan_all(), rig_set_chan_all_cb() */ -int HAMLIB_API rig_get_chan_all_cb(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg) +int HAMLIB_API rig_get_chan_all_cb(RIG *rig, vfo_t vfo, chan_cb_t chan_cb, rig_ptr_t arg) { struct rig_caps *rc; int retval; @@ -1138,12 +1138,12 @@ int HAMLIB_API rig_get_chan_all_cb(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg) if (rc->get_chan_all_cb) { - return rc->get_chan_all_cb(rig, chan_cb, arg); + return rc->get_chan_all_cb(rig, vfo, chan_cb, arg); } /* if not available, emulate it */ - retval = get_chan_all_cb_generic(rig, chan_cb, arg); + retval = get_chan_all_cb_generic(rig, vfo, chan_cb, arg); return retval; } @@ -1162,7 +1162,7 @@ int HAMLIB_API rig_get_chan_all_cb(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg) * * \sa rig_set_chan_all_cb(), rig_get_chan_all() */ -int HAMLIB_API rig_set_chan_all(RIG *rig, const channel_t chans[]) +int HAMLIB_API rig_set_chan_all(RIG *rig, vfo_t vfo, const channel_t chans[]) { struct rig_caps *rc; struct map_all_s map_arg; @@ -1180,12 +1180,12 @@ int HAMLIB_API rig_set_chan_all(RIG *rig, const channel_t chans[]) if (rc->set_chan_all_cb) { - return rc->set_chan_all_cb(rig, map_chan, (rig_ptr_t)&map_arg); + return rc->set_chan_all_cb(rig, vfo, map_chan, (rig_ptr_t)&map_arg); } /* if not available, emulate it */ - retval = set_chan_all_cb_generic(rig, map_chan, (rig_ptr_t)&map_arg); + retval = set_chan_all_cb_generic(rig, vfo, map_chan, (rig_ptr_t)&map_arg); return retval; } @@ -1204,7 +1204,7 @@ int HAMLIB_API rig_set_chan_all(RIG *rig, const channel_t chans[]) * * \sa rig_get_chan_all_cb(), rig_set_chan_all() */ -int HAMLIB_API rig_get_chan_all(RIG *rig, channel_t chans[]) +int HAMLIB_API rig_get_chan_all(RIG *rig, vfo_t vfo, channel_t chans[]) { struct rig_caps *rc; struct map_all_s map_arg; @@ -1222,7 +1222,7 @@ int HAMLIB_API rig_get_chan_all(RIG *rig, channel_t chans[]) if (rc->get_chan_all_cb) { - return rc->get_chan_all_cb(rig, map_chan, (rig_ptr_t)&map_arg); + return rc->get_chan_all_cb(rig, vfo, map_chan, (rig_ptr_t)&map_arg); } /* @@ -1230,7 +1230,7 @@ int HAMLIB_API rig_get_chan_all(RIG *rig, channel_t chans[]) * * TODO: save_current_state, restore_current_state */ - retval = get_chan_all_cb_generic(rig, map_chan, (rig_ptr_t)&map_arg); + retval = get_chan_all_cb_generic(rig, vfo, map_chan, (rig_ptr_t)&map_arg); return retval; } @@ -1283,14 +1283,14 @@ static int map_parm(RIG *rig, const struct confparams *cfgps, value_t *value, } -int get_parm_all_cb_generic(RIG *rig, confval_cb_t parm_cb, rig_ptr_t cfgps, +int get_parm_all_cb_generic(RIG *rig, vfo_t vfo, confval_cb_t parm_cb, rig_ptr_t cfgps, rig_ptr_t vals) { return -RIG_ENIMPL; } -int set_parm_all_cb_generic(RIG *rig, confval_cb_t parm_cb, rig_ptr_t cfgps, +int set_parm_all_cb_generic(RIG *rig, vfo_t vfo, confval_cb_t parm_cb, rig_ptr_t cfgps, rig_ptr_t vals) { return -RIG_ENIMPL; @@ -1318,6 +1318,7 @@ int set_parm_all_cb_generic(RIG *rig, confval_cb_t parm_cb, rig_ptr_t cfgps, * \todo finish coding and testing of mem_all functions */ int HAMLIB_API rig_set_mem_all_cb(RIG *rig, + vfo_t vfo, chan_cb_t chan_cb, confval_cb_t parm_cb, rig_ptr_t arg) @@ -1341,7 +1342,7 @@ int HAMLIB_API rig_set_mem_all_cb(RIG *rig, /* if not available, emulate it */ - retval = rig_set_chan_all_cb(rig, chan_cb, arg); + retval = rig_set_chan_all_cb(rig, vfo, chan_cb, arg); if (retval != RIG_OK) { @@ -1385,6 +1386,7 @@ int HAMLIB_API rig_set_mem_all_cb(RIG *rig, * \todo finish coding and testing of mem_all functions */ int HAMLIB_API rig_get_mem_all_cb(RIG *rig, + vfo_t vfo, chan_cb_t chan_cb, confval_cb_t parm_cb, rig_ptr_t arg) @@ -1407,7 +1409,7 @@ int HAMLIB_API rig_get_mem_all_cb(RIG *rig, } /* if not available, emulate it */ - retval = rig_get_chan_all_cb(rig, chan_cb, arg); + retval = rig_get_chan_all_cb(rig, vfo, chan_cb, arg); if (retval != RIG_OK) { @@ -1450,6 +1452,7 @@ int HAMLIB_API rig_get_mem_all_cb(RIG *rig, * \todo finish coding and testing of mem_all functions */ int HAMLIB_API rig_set_mem_all(RIG *rig, + vfo_t vfo, const channel_t chans[], const struct confparams cfgps[], const value_t vals[]) @@ -1475,7 +1478,7 @@ int HAMLIB_API rig_set_mem_all(RIG *rig, (rig_ptr_t)&mem_all_arg); /* if not available, emulate it */ - retval = rig_set_chan_all(rig, chans); + retval = rig_set_chan_all(rig, vfo, chans); if (retval != RIG_OK) { @@ -1517,6 +1520,7 @@ int HAMLIB_API rig_set_mem_all(RIG *rig, * \todo finish coding and testing of mem_all functions */ int HAMLIB_API rig_get_mem_all(RIG *rig, + vfo_t vfo, channel_t chans[], const struct confparams cfgps[], value_t vals[]) @@ -1546,14 +1550,14 @@ int HAMLIB_API rig_get_mem_all(RIG *rig, * * TODO: save_current_state, restore_current_state */ - retval = rig_get_chan_all(rig, chans); + retval = rig_get_chan_all(rig, vfo, chans); if (retval != RIG_OK) { return retval; } - retval = get_parm_all_cb_generic(rig, map_parm, + retval = get_parm_all_cb_generic(rig, vfo, map_parm, (rig_ptr_t)cfgps, (rig_ptr_t)vals); diff --git a/tests/memcsv.c b/tests/memcsv.c index 0bbade49b..6d6d55be3 100644 --- a/tests/memcsv.c +++ b/tests/memcsv.c @@ -97,7 +97,7 @@ int csv_save(RIG *rig, const char *outfilename) rig->caps->clone_combo_get); } - status = rig_get_chan_all_cb(rig, dump_csv_chan, f); + status = rig_get_chan_all_cb(rig, RIG_VFO_NONE, dump_csv_chan, f); fclose(f); @@ -175,7 +175,7 @@ int csv_load(RIG *rig, const char *infilename) set_channel_data(rig, &chan, key_list, value_list); /* Write a rig memory */ - status = rig_set_channel(rig, &chan); + status = rig_set_channel(rig, RIG_VFO_NONE, &chan); if (status != RIG_OK) { diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index c626062d8..cd84e330b 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -3659,7 +3659,7 @@ declare_proto_rig(set_channel) #endif - status = rig_set_channel(rig, &chan); + status = rig_set_channel(rig, vfo, &chan); return status; } @@ -3687,7 +3687,7 @@ declare_proto_rig(get_channel) CHKSCN1ARG(sscanf(arg2, "%d", &read_only)); - status = rig_get_channel(rig, &chan, read_only); + status = rig_get_channel(rig, RIG_VFO_NONE, &chan, read_only); if (status != RIG_OK) { diff --git a/tests/rigmem.c b/tests/rigmem.c index ca0796638..2174686ec 100644 --- a/tests/rigmem.c +++ b/tests/rigmem.c @@ -509,7 +509,7 @@ int clear_chans(RIG *rig, const char *infilename) { chan.channel_num = j; - ret = rig_set_channel(rig, &chan); + ret = rig_set_channel(rig, RIG_VFO_NONE, &chan); if (ret != RIG_OK) {