Added read_only flag everywhere
pull/234/head
mdblack98 2020-04-26 14:37:03 -05:00
rodzic fd8e33d727
commit 5eb5b6f3d8
41 zmienionych plików z 193 dodań i 107 usunięć

4
NEWS
Wyświetl plik

@ -2,6 +2,7 @@ Hamlib -- History of visible changes.
Copyright (C) 2000-2003 Frank Singleton
Copyright (C) 2000-2018 Stephane Fillod, and others
Copyright (C) 2000-2020 Michael Black W9MDB, and others
Please send Hamlib bug reports to hamlib-developer@lists.sourceforge.net
@ -15,9 +16,12 @@ Version 4.0
* New utility: rigctlcom. Mike, W9MDB
* New model: FT847UNI for unidirectional early serial numbers. Mike, W9MDB
* Remove GNU Texinfo files and build system dependency.
* Rig model numbers have changed to allow future growth
* Fix a lot of static code analysis errors and warnings. Mike, W9MDB
* Rearrange directory structure to put rigs and rotators sources
under their own subdirectories. Mike, W9MDB
* rig_get_channel changed to add read_only flag
* rigctl(d) f command also returns VFO now
Version 3.3
2018-08-12

Wyświetl plik

@ -648,9 +648,9 @@ void Rig::setChannel (const channel_t *chan)
CHECK_RIG( rig_set_channel(theRig, chan) );
}
void Rig::getChannel (channel_t *chan)
void Rig::getChannel (channel_t *chan, int readOnly)
{
CHECK_RIG( rig_get_channel(theRig, chan) );
CHECK_RIG( rig_get_channel(theRig, chan, readOnly) );
}

Wyświetl plik

@ -3,7 +3,7 @@
\section auth Authors
Stéphane Fillod, F8CFE, and Frank Singleton, VK3FCS and the Hamlib Group
\n Documentation revisions by Martin Ewing, AA6E, Nate Bargmann, N0NB
\n Documentation revisions by Martin Ewing, AA6E, Nate Bargmann, N0NB, Michael Black, W9MDB
\section s1 Preface

Wyświetl plik

@ -1712,7 +1712,7 @@ static int dummy_set_channel(RIG *rig, const channel_t *chan)
}
static int dummy_get_channel(RIG *rig, channel_t *chan)
static int dummy_get_channel(RIG *rig, channel_t *chan, int read_only)
{
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;

Wyświetl plik

@ -2022,7 +2022,7 @@ static int netrigctl_set_channel(RIG *rig, const channel_t *chan)
}
static int netrigctl_get_channel(RIG *rig, channel_t *chan)
static int netrigctl_get_channel(RIG *rig, channel_t *chan, int read_only)
{
return -RIG_ENIMPL;
}

Wyświetl plik

@ -1762,7 +1762,7 @@ 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 (*get_channel)(RIG *rig, channel_t *chan, int read_only);
const char * (*get_info)(RIG *rig);
@ -2424,7 +2424,7 @@ rig_set_channel HAMLIB_PARAMS((RIG *rig,
const channel_t *chan)); /* mem */
extern HAMLIB_EXPORT(int)
rig_get_channel HAMLIB_PARAMS((RIG *rig,
channel_t *chan));
channel_t *chan, int read_only));
extern HAMLIB_EXPORT(int)
rig_set_chan_all HAMLIB_PARAMS((RIG *rig,

Wyświetl plik

@ -127,7 +127,7 @@ public:
int getMem(vfo_t vfo = RIG_VFO_CURR);
void setChannel(const channel_t *chan);
void getChannel(channel_t *chan);
void getChannel(channel_t *chan, int readOnly);
void setPowerStat(powerstat_t status);
powerstat_t getPowerStat(void);

Wyświetl plik

@ -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 aor_get_channel(RIG *rig, channel_t *chan, int read_only)
{
struct aor_priv_caps *priv = (struct aor_priv_caps *)rig->caps->priv;
char aorcmd[BUFSZ];
@ -1330,6 +1330,11 @@ int aor_get_channel(RIG *rig, channel_t *chan)
retval = parse_chan_line(rig, chan, chanbuf, mem_caps);
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
}
return retval;
}

Wyświetl plik

@ -60,7 +60,7 @@ 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 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);

Wyświetl plik

@ -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);
static int ar3030_get_channel(RIG *rig, 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 ar3030_get_channel(RIG *rig, channel_t *chan, int read_only)
{
struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv;
char cmdbuf[BUFSZ], infobuf[BUFSZ];
@ -805,6 +805,11 @@ int ar3030_get_channel(RIG *rig, channel_t *chan)
chan->levels[LVL_AGC].i = infobuf[8] == '0' ? RIG_AGC_SLOW : RIG_AGC_FAST;
chan->flags = infobuf[4] == '1' ? RIG_CHFLAG_SKIP : RIG_CHFLAG_NONE;
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
}
return RIG_OK;
}

Wyświetl plik

@ -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)
static int ar7030p_get_channel(RIG *rig, channel_t *chan, int read_only)
{
int rc = RIG_OK;
unsigned char v;
@ -1754,6 +1754,11 @@ static int ar7030p_get_channel(RIG *rig, channel_t *chan)
rc = lockRx(rig, LOCK_0);
}
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
}
return (rc);
}

Wyświetl plik

@ -670,7 +670,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 drake_get_chan(RIG *rig, channel_t *chan, int read_only)
{
struct drake_priv_data *priv = rig->state.priv;
vfo_t old_vfo;
@ -854,6 +854,7 @@ int drake_get_chan(RIG *rig, channel_t *chan)
strncpy(chan->channel_desc, mdbuf + 25, 7);
//now put the radio back the way it was
//we apparently can't do a read-only channel read
if (old_vfo != RIG_VFO_MEM)
{
retval = drake_set_vfo(rig, RIG_VFO_VFO);

Wyświetl plik

@ -43,7 +43,7 @@ int drake_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, value_t *option, ant_t *ant_
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 drake_get_chan(RIG *rig, 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);

Wyświetl plik

@ -153,7 +153,7 @@ 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);
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_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);
@ -904,7 +904,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 ic746pro_get_channel(RIG *rig, channel_t *chan, int read_only)
{
struct icom_priv_data *priv;
struct rig_state *rs;
@ -1053,6 +1053,11 @@ int ic746pro_get_channel(RIG *rig, channel_t *chan)
chan->channel_desc);
}
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
}
return RIG_OK;
}

Wyświetl plik

@ -92,7 +92,7 @@
}
static int icr75_set_channel(RIG *rig, const channel_t *chan);
static int icr75_get_channel(RIG *rig, channel_t *chan);
static int icr75_get_channel(RIG *rig, channel_t *chan, int read_only);
int icr75_set_parm(RIG *rig, setting_t parm, value_t val);
int icr75_get_parm(RIG *rig, setting_t parm, value_t *val);
@ -319,7 +319,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 icr75_get_channel(RIG *rig, channel_t *chan, int read_only)
{
struct icom_priv_data *priv;
struct rig_state *rs;
@ -416,6 +416,11 @@ int icr75_get_channel(RIG *rig, channel_t *chan)
strncpy(chan->channel_desc, (char *)(chanbuf + chan_len), 8);
}
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
}
return RIG_OK;
}

Wyświetl plik

@ -1414,7 +1414,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, &current)) != RIG_OK) { return retval; }
if ((retval = jrc_get_chan(rig, &current, 1)) != RIG_OK) { return retval; }
sprintf(cmdbuf, "K%03d000", chan->channel_num);
@ -1466,7 +1466,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 jrc_get_chan(RIG *rig, channel_t *chan, int read_only)
{
struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
char membuf[BUFSZ], cmdbuf[BUFSZ];

Wyświetl plik

@ -55,7 +55,7 @@ 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 jrc_get_chan(RIG *rig, 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);

Wyświetl plik

@ -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 ic10_get_channel(RIG *rig, channel_t *chan, int read_only)
{
char membuf[16], infobuf[32];
int retval, info_len, len;
@ -717,6 +717,11 @@ int ic10_get_channel(RIG *rig, channel_t *chan)
}
}
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
}
return RIG_OK;
}

Wyświetl plik

@ -47,7 +47,7 @@ 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 ic10_get_channel(RIG *rig, 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);

Wyświetl plik

@ -3744,7 +3744,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 kenwood_get_channel(RIG *rig, channel_t *chan, int read_only)
{
int err;
char buf[26];
@ -3853,6 +3853,11 @@ int kenwood_get_channel(RIG *rig, channel_t *chan)
chan->split = RIG_SPLIT_ON;
}
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
}
return RIG_OK;
}

Wyświetl plik

@ -192,7 +192,7 @@ 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 kenwood_get_channel(RIG *rig, channel_t *chan, int read_only);
int kenwood_set_channel(RIG *rig, const channel_t *chan);
int kenwood_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch);
const char *kenwood_get_info(RIG *rig);

Wyświetl plik

@ -64,7 +64,7 @@ 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);
static int pihspdr_get_channel(RIG *rig, channel_t *chan, int read_only);
static int pihspdr_set_channel(RIG *rig, const channel_t *chan);
@ -335,7 +335,7 @@ const struct rig_caps pihpsdr_caps =
*/
int pihspdr_get_channel(RIG *rig, channel_t *chan)
int pihspdr_get_channel(RIG *rig, channel_t *chan, int read_only)
{
int err;
int tmp;
@ -560,6 +560,11 @@ int pihspdr_get_channel(RIG *rig, channel_t *chan)
chan->split = RIG_SPLIT_ON;
}
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
}
return RIG_OK;
}

Wyświetl plik

@ -1935,7 +1935,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 th_get_channel(RIG *rig, channel_t *chan, int read_only)
{
char membuf[64], ackbuf[ACKBUF_LEN];
int retval;
@ -2226,6 +2226,11 @@ int th_get_channel(RIG *rig, channel_t *chan)
chan->channel_desc[ack_len] = '\0';
}
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
}
return RIG_OK;
}

Wyświetl plik

@ -60,7 +60,7 @@ 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);
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_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);

Wyświetl plik

@ -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)
static int thd72_get_channel(RIG *rig, channel_t *chan, int read_only)
{
int retval;
char buf[72];
@ -1407,6 +1407,11 @@ static int thd72_get_channel(RIG *rig, channel_t *chan)
return thd72_parse_channel(0, buf, chan);
}
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
}
return RIG_OK;
}

Wyświetl plik

@ -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)
static int thd74_get_channel(RIG *rig, channel_t *chan, int read_only)
{
int retval;
char buf[72];
@ -1324,6 +1324,11 @@ static int thd74_get_channel(RIG *rig, channel_t *chan)
return thd74_parse_channel(0, buf, chan);
}
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
}
return RIG_OK;
}

Wyświetl plik

@ -71,7 +71,7 @@ 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);
static int tmd710_get_channel(RIG *rig, 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 tmd710_get_channel(RIG *rig, channel_t *chan, int read_only)
{
int retval;
tmd710_me me_struct;
@ -1933,6 +1933,11 @@ int tmd710_get_channel(RIG *rig, channel_t *chan)
// TODO: chan->levels
chan->ext_levels = NULL;
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
}
return RIG_OK;
}

Wyświetl plik

@ -87,7 +87,7 @@ 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);
static int tmv7_get_channel(RIG *rig, channel_t *chan, int read_only);
static int tmv7_set_channel(RIG *rig, const channel_t *chan);
/*
@ -496,7 +496,7 @@ int tmv7_get_powerstat(RIG *rig, powerstat_t *status)
/* --------------------------------------------------------------------- */
int tmv7_get_channel(RIG *rig, channel_t *chan)
int tmv7_get_channel(RIG *rig, channel_t *chan, int read_only)
{
char membuf[64], ackbuf[ACKBUF_LEN];
int retval;
@ -649,6 +649,11 @@ int tmv7_get_channel(RIG *rig, channel_t *chan)
memcpy(chan->channel_desc, &ackbuf[10], 7);
}
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
}
return RIG_OK;
}
/* --------------------------------------------------------------------- */

Wyświetl plik

@ -58,7 +58,7 @@
/* 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);
static int ts2000_get_channel(RIG *rig, channel_t *chan, int read_only);
static int ts2000_set_channel(RIG *rig, const channel_t *chan);
/*
@ -368,7 +368,7 @@ const struct rig_caps ts2000_caps =
*/
int ts2000_get_channel(RIG *rig, channel_t *chan)
int ts2000_get_channel(RIG *rig, channel_t *chan, int read_only)
{
int err;
int tmp;
@ -593,6 +593,11 @@ int ts2000_get_channel(RIG *rig, channel_t *chan)
chan->split = RIG_SPLIT_ON;
}
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
}
return RIG_OK;
}

Wyświetl plik

@ -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);
ret = prm80_get_channel(rig, &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);
ret = prm80_get_channel(rig, &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 prm80_get_channel(RIG *rig, channel_t *chan, int read_only)
{
char statebuf[BUFSZ];
int statebuf_len = BUFSZ;
@ -329,6 +329,11 @@ int prm80_get_channel(RIG *rig, channel_t *chan)
chan->tx_freq = ((hhtoi(statebuf + 16) << 8) + hhtoi(statebuf + 18)) * 12500;
chan->rptr_offs = chan->tx_freq - chan->freq;
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
}
return RIG_OK;
}
@ -421,7 +426,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);
ret = prm80_get_channel(rig, &chan, 1);
if (ret != RIG_OK)
{

Wyświetl plik

@ -43,7 +43,7 @@ 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 prm80_get_channel(RIG * rig, channel_t * chan, int read_only);
const char* prm80_get_info(RIG *rig);

Wyświetl plik

@ -561,7 +561,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 uniden_get_channel(RIG *rig, channel_t *chan, int read_only)
{
char cmdbuf[BUFSZ], membuf[BUFSZ];
size_t cmd_len = BUFSZ, mem_len = BUFSZ;
@ -641,6 +641,11 @@ int uniden_get_channel(RIG *rig, channel_t *chan)
strncpy(chan->channel_desc, membuf + 9, rig->caps->chan_desc_sz);
}
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
}
return RIG_OK;
}

Wyświetl plik

@ -65,7 +65,7 @@ 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 uniden_get_channel(RIG *rig, channel_t *chan, int read_only);
int uniden_set_channel(RIG *rig, const channel_t *chan);
const char* uniden_get_info(RIG *rig);

Wyświetl plik

@ -2715,7 +2715,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 ft1000d_get_channel(RIG *rig, channel_t *chan, int read_only)
{
struct ft1000d_priv_data *priv;
ft1000d_op_data_t *p;
@ -3168,6 +3168,11 @@ int ft1000d_get_channel(RIG *rig, channel_t *chan)
chan->flags |= RIG_CHFLAG_SKIP;
}
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
}
return RIG_OK;
}

Wyświetl plik

@ -194,7 +194,7 @@ 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 ft1000d_get_channel (RIG *rig, channel_t *chan, int read_only);
/*

Wyświetl plik

@ -2664,7 +2664,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 ft990_get_channel(RIG *rig, channel_t *chan, int read_only)
{
struct ft990_priv_data *priv;
ft990_op_data_t *p;
@ -3115,6 +3115,11 @@ int ft990_get_channel(RIG *rig, channel_t *chan)
chan->flags |= RIG_CHFLAG_SKIP;
}
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
}
return RIG_OK;
}

Wyświetl plik

@ -176,7 +176,7 @@ 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 ft990_get_channel (RIG *rig, channel_t *chan, int read_only);
/*

Wyświetl plik

@ -3992,7 +3992,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);
err = newcat_get_channel(rig, &valid_chan, 1);
if (err < 0)
{
@ -4460,7 +4460,7 @@ int newcat_set_channel(RIG *rig, const channel_t *chan)
}
int newcat_get_channel(RIG *rig, channel_t *chan)
int newcat_get_channel(RIG *rig, channel_t *chan, int read_only)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
char *retval;
@ -4636,6 +4636,11 @@ int newcat_get_channel(RIG *rig, channel_t *chan)
retval = priv->ret_data + 5;
chan->freq = atof(retval);
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
}
return RIG_OK;
}

Wyświetl plik

@ -177,6 +177,6 @@ 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 newcat_get_channel(RIG * rig, channel_t * chan, int read_only);
#endif /* _NEWCAT_H */

Wyświetl plik

@ -693,9 +693,6 @@ int HAMLIB_API rig_set_channel(RIG *rig, const channel_t *chan)
vfo_t vfo; /* requested vfo */
int retcode;
int can_emulate_by_vfo_mem, can_emulate_by_vfo_op;
#ifdef PARANOID_CHANNEL_HANDLING
channel_t curr_chan;
#endif
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -745,10 +742,6 @@ int HAMLIB_API rig_set_channel(RIG *rig, const channel_t *chan)
}
curr_vfo = rig->state.current_vfo;
/* may be needed if the restore_channel has some side effects */
#ifdef PARANOID_CHANNEL_HANDLING
generic_save_channel(rig, &curr_chan);
#endif
if (vfo == RIG_VFO_MEM)
{
@ -793,9 +786,6 @@ int HAMLIB_API rig_set_channel(RIG *rig, const channel_t *chan)
rig_set_vfo(rig, curr_vfo);
}
#ifdef PARANOID_CHANNEL_HANDLING
generic_restore_channel(rig, &curr_chan);
#endif
return retcode;
}
@ -804,6 +794,7 @@ int HAMLIB_API rig_set_channel(RIG *rig, const channel_t *chan)
* \brief get channel data
* \param rig The rig handle
* \param chan The location where to store the channel data
* \param read_only if true chan info will be filled but rig will not change, if false rig will update to chan info
*
* Retrieves the data associated with a channel. This channel can either
* be the state of a VFO specified by \a chan->vfo, or a memory channel
@ -817,6 +808,7 @@ int HAMLIB_API rig_set_channel(RIG *rig, const channel_t *chan)
chan->vfo = RIG_VFO_MEM;
chan->channel_num = 10;
char->read_only = 1;
err = rig_get_channel(rig, &chan);
if (err != RIG_OK)
error("get_channel failed: %s", rigerror(err));
@ -837,17 +829,14 @@ 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 HAMLIB_API rig_get_channel(RIG *rig, 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 */
int retcode;
int retcode = RIG_OK;
int can_emulate_by_vfo_mem, can_emulate_by_vfo_op;
#ifdef PARANOID_CHANNEL_HANDLING
channel_t curr_chan;
#endif
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -864,7 +853,7 @@ int HAMLIB_API rig_get_channel(RIG *rig, channel_t *chan)
if (rc->get_channel)
{
return rc->get_channel(rig, chan);
return rc->get_channel(rig, chan, 0);
}
/*
@ -897,57 +886,54 @@ int HAMLIB_API rig_get_channel(RIG *rig, channel_t *chan)
}
curr_vfo = rig->state.current_vfo;
/* may be needed if the restore_channel has some side effects */
#ifdef PARANOID_CHANNEL_HANDLING
generic_save_channel(rig, &curr_chan);
#endif
if (vfo == 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 (!read_only)
{
retcode = rig_set_vfo(rig, vfo);
if (retcode != RIG_OK)
if (can_emulate_by_vfo_mem && curr_vfo != vfo)
{
return retcode;
retcode = rig_set_vfo(rig, vfo);
if (retcode != RIG_OK)
{
return retcode;
}
}
}
if (vfo == RIG_VFO_MEM)
{
rig_set_mem(rig, RIG_VFO_CURR, chan->channel_num);
}
if (!can_emulate_by_vfo_mem && can_emulate_by_vfo_op)
{
retcode = rig_vfo_op(rig, RIG_VFO_CURR, RIG_OP_TO_VFO);
if (retcode != RIG_OK)
if (vfo == RIG_VFO_MEM)
{
return retcode;
rig_set_mem(rig, RIG_VFO_CURR, chan->channel_num);
}
if (!can_emulate_by_vfo_mem && can_emulate_by_vfo_op)
{
retcode = rig_vfo_op(rig, RIG_VFO_CURR, RIG_OP_TO_VFO);
if (retcode != RIG_OK)
{
return retcode;
}
}
retcode = generic_save_channel(rig, chan);
/* restore current memory number */
if (vfo == RIG_VFO_MEM && get_mem_status == RIG_OK)
{
rig_set_mem(rig, RIG_VFO_CURR, curr_chan_num);
}
if (can_emulate_by_vfo_mem)
{
rig_set_vfo(rig, curr_vfo);
}
}
retcode = generic_save_channel(rig, chan);
/* restore current memory number */
if (vfo == RIG_VFO_MEM && get_mem_status == RIG_OK)
{
rig_set_mem(rig, RIG_VFO_CURR, curr_chan_num);
}
if (can_emulate_by_vfo_mem)
{
rig_set_vfo(rig, curr_vfo);
}
#ifdef PARANOID_CHANNEL_HANDLING
generic_restore_channel(rig, &curr_chan);
#endif
return retcode;
}
@ -991,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);
retval = rig_get_channel(rig, chan, 1);
if (retval == -RIG_ENAVAIL)
{

Wyświetl plik

@ -3595,7 +3595,7 @@ declare_proto_rig(get_channel)
chan.channel_num = 0;
}
status = rig_get_channel(rig, &chan);
status = rig_get_channel(rig, &chan, 0);
if (status != RIG_OK)
{