2001-02-14 00:59:02 +00:00
|
|
|
/*
|
2001-07-13 19:08:15 +00:00
|
|
|
* Hamlib Dummy backend - main file
|
2010-03-06 17:31:19 +00:00
|
|
|
* Copyright (c) 2001-2010 by Stephane Fillod
|
2010-02-06 15:28:25 +00:00
|
|
|
* Copyright (c) 2010 by Nate Bargmann
|
2001-02-14 00:59:02 +00:00
|
|
|
*
|
|
|
|
*
|
2011-08-20 23:37:17 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2001-02-14 00:59:02 +00:00
|
|
|
*
|
2011-08-20 23:37:17 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2001-07-13 19:08:15 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2011-08-20 23:37:17 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2001-02-14 00:59:02 +00:00
|
|
|
*
|
2011-08-20 23:37:17 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2001-07-13 19:08:15 +00:00
|
|
|
* License along with this library; if not, write to the Free Software
|
2011-08-20 23:37:17 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2001-02-14 00:59:02 +00:00
|
|
|
*
|
2001-07-13 19:08:15 +00:00
|
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2003-10-01 19:32:04 +00:00
|
|
|
#include <stdio.h>
|
2001-02-14 00:59:02 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h> /* String function definitions */
|
|
|
|
#include <unistd.h> /* UNIX standard function definitions */
|
|
|
|
#include <math.h>
|
2008-05-04 14:08:55 +00:00
|
|
|
#include <time.h>
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2003-04-07 22:42:11 +00:00
|
|
|
#include "hamlib/rig.h"
|
|
|
|
#include "serial.h"
|
2015-04-23 17:33:45 +00:00
|
|
|
#include "parallel.h"
|
2020-01-26 14:53:04 +00:00
|
|
|
#include "cm108.h"
|
|
|
|
#include "gpio.h"
|
2003-04-07 22:42:11 +00:00
|
|
|
#include "misc.h"
|
|
|
|
#include "tones.h"
|
|
|
|
#include "idx_builtin.h"
|
2003-04-16 22:30:43 +00:00
|
|
|
#include "register.h"
|
2001-06-15 07:08:37 +00:00
|
|
|
|
2001-02-14 00:59:02 +00:00
|
|
|
#include "dummy.h"
|
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
#define NB_CHAN 22 /* see caps->chan_list */
|
2002-02-15 00:12:44 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data
|
|
|
|
{
|
|
|
|
/* current vfo already in rig_state ? */
|
|
|
|
vfo_t curr_vfo;
|
|
|
|
vfo_t last_vfo; /* VFO A or VFO B, when in MEM mode */
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-29 13:03:03 +00:00
|
|
|
split_t split;
|
|
|
|
vfo_t tx_vfo;
|
2019-10-30 03:27:12 +00:00
|
|
|
ptt_t ptt;
|
|
|
|
powerstat_t powerstat;
|
|
|
|
int bank;
|
|
|
|
value_t parms[RIG_SETTING_MAX];
|
2020-02-10 18:17:30 +00:00
|
|
|
int ant_option[4]; /* simulate 4 antennas */
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
channel_t *curr; /* points to vfo_a, vfo_b or mem[] */
|
2002-02-15 00:12:44 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
channel_t vfo_a;
|
|
|
|
channel_t vfo_b;
|
|
|
|
channel_t mem[NB_CHAN];
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
struct ext_list *ext_parms;
|
2009-11-22 12:01:38 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
char *magic_conf;
|
|
|
|
int static_data;
|
2009-01-28 22:53:18 +00:00
|
|
|
};
|
|
|
|
|
2010-05-10 20:25:47 +00:00
|
|
|
/* levels pertain to each VFO */
|
2019-10-30 03:27:12 +00:00
|
|
|
static const struct confparams dummy_ext_levels[] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TOK_EL_MAGICLEVEL, "MGL", "Magic level", "Magic level, as an example",
|
|
|
|
NULL, RIG_CONF_NUMERIC, { .n = { 0, 1, .001 } }
|
|
|
|
},
|
|
|
|
{
|
|
|
|
TOK_EL_MAGICFUNC, "MGF", "Magic func", "Magic function, as an example",
|
|
|
|
NULL, RIG_CONF_CHECKBUTTON
|
|
|
|
},
|
|
|
|
{
|
|
|
|
TOK_EL_MAGICOP, "MGO", "Magic Op", "Magic Op, as an example",
|
|
|
|
NULL, RIG_CONF_BUTTON
|
|
|
|
},
|
|
|
|
{
|
|
|
|
TOK_EL_MAGICCOMBO, "MGC", "Magic combo", "Magic combo, as an example",
|
|
|
|
"VALUE1", RIG_CONF_COMBO, { .c = { .combostr = { "VALUE1", "VALUE2", "NONE", NULL } } }
|
|
|
|
},
|
|
|
|
{ RIG_CONF_END, NULL, }
|
2009-01-28 22:53:18 +00:00
|
|
|
};
|
|
|
|
|
2010-05-10 20:25:47 +00:00
|
|
|
/* parms pertain to the whole rig */
|
2019-10-30 03:27:12 +00:00
|
|
|
static const struct confparams dummy_ext_parms[] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TOK_EP_MAGICPARM, "MGP", "Magic parm", "Magic parameter, as an example",
|
|
|
|
NULL, RIG_CONF_NUMERIC, { .n = { 0, 1, .001 } }
|
|
|
|
},
|
|
|
|
{ RIG_CONF_END, NULL, }
|
2001-11-18 14:16:57 +00:00
|
|
|
};
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2010-05-10 20:25:47 +00:00
|
|
|
/* cfgparams are configuration item generally used by the backend's open() method */
|
2019-10-30 03:27:12 +00:00
|
|
|
static const struct confparams dummy_cfg_params[] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TOK_CFG_MAGICCONF, "mcfg", "Magic conf", "Magic parameter, as an example",
|
|
|
|
"DX", RIG_CONF_STRING, { }
|
|
|
|
},
|
|
|
|
{
|
|
|
|
TOK_CFG_STATIC_DATA, "static_data", "Static data", "Output only static data, no randomization of meter values",
|
|
|
|
"0", RIG_CONF_CHECKBUTTON, { }
|
|
|
|
},
|
|
|
|
{ RIG_CONF_END, NULL, }
|
2009-11-22 12:01:38 +00:00
|
|
|
};
|
2001-02-14 23:57:30 +00:00
|
|
|
|
|
|
|
/********************************************************************/
|
|
|
|
|
2002-02-15 00:12:44 +00:00
|
|
|
static void init_chan(RIG *rig, vfo_t vfo, channel_t *chan)
|
2002-01-22 00:43:05 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
chan->channel_num = 0;
|
|
|
|
chan->vfo = vfo;
|
|
|
|
strcpy(chan->channel_desc, rig_strvfo(vfo));
|
|
|
|
|
|
|
|
chan->freq = MHz(145);
|
|
|
|
chan->mode = RIG_MODE_FM;
|
|
|
|
chan->width = rig_passband_normal(rig, RIG_MODE_FM);
|
|
|
|
chan->tx_freq = chan->freq;
|
|
|
|
chan->tx_mode = chan->mode;
|
|
|
|
chan->tx_width = chan->width;
|
|
|
|
chan->split = RIG_SPLIT_OFF;
|
|
|
|
chan->tx_vfo = vfo;
|
|
|
|
|
|
|
|
chan->rptr_shift = RIG_RPT_SHIFT_NONE;
|
|
|
|
chan->rptr_offs = 0;
|
|
|
|
chan->ctcss_tone = 0;
|
|
|
|
chan->dcs_code = 0;
|
|
|
|
chan->ctcss_sql = 0;
|
|
|
|
chan->dcs_sql = 0;
|
|
|
|
chan->rit = 0;
|
|
|
|
chan->xit = 0;
|
|
|
|
chan->tuning_step = 0;
|
|
|
|
chan->ant = 0;
|
|
|
|
|
|
|
|
chan->funcs = (setting_t)0;
|
|
|
|
memset(chan->levels, 0, RIG_SETTING_MAX * sizeof(value_t));
|
2002-01-22 00:43:05 +00:00
|
|
|
}
|
|
|
|
|
2010-05-10 20:25:47 +00:00
|
|
|
static void copy_chan(channel_t *dest, const channel_t *src)
|
|
|
|
{
|
|
|
|
struct ext_list *saved_ext_levels;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* TODO: ext_levels[] of different sizes */
|
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
for (i = 0; !RIG_IS_EXT_END(src->ext_levels[i]) &&
|
|
|
|
!RIG_IS_EXT_END(dest->ext_levels[i]); i++)
|
|
|
|
{
|
2010-05-10 20:25:47 +00:00
|
|
|
dest->ext_levels[i] = src->ext_levels[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
saved_ext_levels = dest->ext_levels;
|
|
|
|
memcpy(dest, src, sizeof(channel_t));
|
|
|
|
dest->ext_levels = saved_ext_levels;
|
|
|
|
}
|
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
static struct ext_list *alloc_init_ext(const struct confparams *cfp)
|
2009-01-28 22:53:18 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct ext_list *elp;
|
|
|
|
int i, nb_ext;
|
|
|
|
|
|
|
|
for (nb_ext = 0; !RIG_IS_EXT_END(cfp[nb_ext]); nb_ext++)
|
|
|
|
;
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
elp = calloc((nb_ext + 1), sizeof(struct ext_list));
|
|
|
|
|
|
|
|
if (!elp)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
for (i = 0; !RIG_IS_EXT_END(cfp[i]); i++)
|
|
|
|
{
|
|
|
|
elp[i].token = cfp[i].token;
|
|
|
|
/* value reset already by calloc */
|
|
|
|
}
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
/* last token in array is set to 0 by calloc */
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return elp;
|
2009-01-28 22:53:18 +00:00
|
|
|
}
|
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
static struct ext_list *find_ext(struct ext_list *elp, token_t token)
|
2009-01-28 22:53:18 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
int i;
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
for (i = 0; elp[i].token != 0; i++)
|
|
|
|
{
|
|
|
|
if (elp[i].token == token)
|
|
|
|
{
|
|
|
|
return &elp[i];
|
|
|
|
}
|
|
|
|
}
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return NULL;
|
2009-01-28 22:53:18 +00:00
|
|
|
}
|
|
|
|
|
2002-01-22 00:43:05 +00:00
|
|
|
static int dummy_init(RIG *rig)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
priv = (struct dummy_priv_data *)malloc(sizeof(struct dummy_priv_data));
|
|
|
|
|
|
|
|
if (!priv)
|
|
|
|
{
|
|
|
|
return -RIG_ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
rig->state.priv = (void *)priv;
|
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2019-10-30 03:27:12 +00:00
|
|
|
rig->state.rigport.type.rig = RIG_PORT_NONE;
|
|
|
|
|
|
|
|
priv->ptt = RIG_PTT_OFF;
|
|
|
|
priv->powerstat = RIG_POWER_ON;
|
|
|
|
priv->bank = 0;
|
|
|
|
memset(priv->parms, 0, RIG_SETTING_MAX * sizeof(value_t));
|
|
|
|
|
|
|
|
memset(priv->mem, 0, sizeof(priv->mem));
|
2001-11-18 14:16:57 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
for (i = 0; i < NB_CHAN; i++)
|
|
|
|
{
|
|
|
|
priv->mem[i].channel_num = i;
|
|
|
|
priv->mem[i].vfo = RIG_VFO_MEM;
|
|
|
|
|
|
|
|
priv->mem[i].ext_levels = alloc_init_ext(dummy_ext_levels);
|
2001-11-18 14:16:57 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (!priv->mem[i].ext_levels)
|
|
|
|
{
|
|
|
|
return -RIG_ENOMEM;
|
|
|
|
}
|
|
|
|
}
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
priv->vfo_a.ext_levels = alloc_init_ext(dummy_ext_levels);
|
|
|
|
|
|
|
|
if (!priv->vfo_a.ext_levels)
|
|
|
|
{
|
|
|
|
return -RIG_ENOMEM;
|
|
|
|
}
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
priv->vfo_b.ext_levels = alloc_init_ext(dummy_ext_levels);
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (!priv->vfo_b.ext_levels)
|
|
|
|
{
|
|
|
|
return -RIG_ENOMEM;
|
|
|
|
}
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
priv->ext_parms = alloc_init_ext(dummy_ext_parms);
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (!priv->ext_parms)
|
|
|
|
{
|
|
|
|
return -RIG_ENOMEM;
|
|
|
|
}
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
init_chan(rig, RIG_VFO_A, &priv->vfo_a);
|
|
|
|
init_chan(rig, RIG_VFO_B, &priv->vfo_b);
|
|
|
|
priv->curr = &priv->vfo_a;
|
|
|
|
priv->curr_vfo = priv->last_vfo = RIG_VFO_A;
|
2001-11-18 14:16:57 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
priv->magic_conf = strdup("DX");
|
2009-11-22 12:01:38 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
2002-01-22 00:43:05 +00:00
|
|
|
static int dummy_cleanup(RIG *rig)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
int i;
|
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
for (i = 0; i < NB_CHAN; i++)
|
|
|
|
{
|
|
|
|
free(priv->mem[i].ext_levels);
|
|
|
|
}
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
free(priv->vfo_a.ext_levels);
|
|
|
|
free(priv->vfo_b.ext_levels);
|
|
|
|
free(priv->ext_parms);
|
|
|
|
free(priv->magic_conf);
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (rig->state.priv)
|
|
|
|
{
|
|
|
|
free(rig->state.priv);
|
|
|
|
}
|
2001-11-18 14:16:57 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
rig->state.priv = NULL;
|
2001-11-18 14:16:57 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int dummy_open(RIG *rig)
|
|
|
|
{
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int dummy_close(RIG *rig)
|
|
|
|
{
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-22 12:01:38 +00:00
|
|
|
static int dummy_set_conf(RIG *rig, token_t token, const char *val)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv;
|
2009-11-22 12:01:38 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
priv = (struct dummy_priv_data *)rig->state.priv;
|
2009-11-22 12:01:38 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
switch (token)
|
|
|
|
{
|
|
|
|
case TOK_CFG_MAGICCONF:
|
|
|
|
if (val)
|
|
|
|
{
|
|
|
|
free(priv->magic_conf);
|
|
|
|
priv->magic_conf = strdup(val);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TOK_CFG_STATIC_DATA:
|
|
|
|
priv->static_data = atoi(val) ? 1 : 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return RIG_OK;
|
2009-11-22 12:01:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int dummy_get_conf(RIG *rig, token_t token, char *val)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv;
|
2009-11-22 12:01:38 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
priv = (struct dummy_priv_data *)rig->state.priv;
|
2009-11-22 12:01:38 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
switch (token)
|
|
|
|
{
|
|
|
|
case TOK_CFG_MAGICCONF:
|
|
|
|
strcpy(val, priv->magic_conf);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return RIG_OK;
|
2009-11-22 12:01:38 +00:00
|
|
|
}
|
|
|
|
|
2001-02-14 00:59:02 +00:00
|
|
|
static int dummy_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
|
|
|
char fstr[20];
|
2001-11-18 14:16:57 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
sprintf_freq(fstr, freq);
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %s\n", __func__,
|
2019-10-30 03:27:12 +00:00
|
|
|
rig_strvfo(vfo), fstr);
|
|
|
|
curr->freq = freq;
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int dummy_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2001-11-18 14:16:57 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rig_strvfo(vfo));
|
2019-10-30 03:27:12 +00:00
|
|
|
*freq = curr->freq;
|
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int dummy_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
|
|
|
char buf[16];
|
2001-11-18 14:16:57 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
sprintf_freq(buf, width);
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %s %s\n", __func__,
|
2019-10-30 03:27:12 +00:00
|
|
|
rig_strvfo(vfo), rig_strrmode(mode), buf);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
curr->mode = mode;
|
2013-01-15 18:47:47 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (RIG_PASSBAND_NOCHANGE == width) { return RIG_OK; }
|
2016-04-09 13:13:49 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (width == RIG_PASSBAND_NORMAL)
|
|
|
|
{
|
|
|
|
curr->width = rig_passband_normal(rig, mode);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
curr->width = width;
|
|
|
|
}
|
2001-11-18 14:16:57 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int dummy_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2001-11-18 14:16:57 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rig_strvfo(vfo));
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
*mode = curr->mode;
|
|
|
|
*width = curr->width;
|
2001-11-18 14:16:57 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int dummy_set_vfo(RIG *rig, vfo_t vfo)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rig_strvfo(vfo));
|
2019-10-30 03:27:12 +00:00
|
|
|
|
|
|
|
priv->last_vfo = priv->curr_vfo;
|
|
|
|
priv->curr_vfo = vfo;
|
|
|
|
|
|
|
|
switch (vfo)
|
|
|
|
{
|
|
|
|
case RIG_VFO_VFO: /* FIXME */
|
2001-12-16 11:24:56 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
case RIG_VFO_RX:
|
|
|
|
case RIG_VFO_A: priv->curr = &priv->vfo_a; break;
|
2002-02-15 00:12:44 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
case RIG_VFO_B: priv->curr = &priv->vfo_b; break;
|
2002-02-15 00:12:44 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
case RIG_VFO_MEM:
|
|
|
|
if (curr->channel_num >= 0 && curr->channel_num < NB_CHAN)
|
|
|
|
{
|
|
|
|
priv->curr = &priv->mem[curr->channel_num];
|
|
|
|
break;
|
|
|
|
}
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
case RIG_VFO_TX:
|
|
|
|
if (priv->tx_vfo == RIG_VFO_A) { priv->curr = &priv->vfo_a; }
|
|
|
|
else if (priv->tx_vfo == RIG_VFO_B) { priv->curr = &priv->vfo_b; }
|
|
|
|
else if (priv->tx_vfo == RIG_VFO_MEM) { priv->curr = &priv->mem[curr->channel_num]; }
|
|
|
|
else { priv->curr = &priv->vfo_a; }
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s unknown vfo: %s\n", __func__,
|
2019-10-30 03:27:12 +00:00
|
|
|
rig_strvfo(vfo));
|
|
|
|
}
|
|
|
|
|
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int dummy_get_vfo(RIG *rig, vfo_t *vfo)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
2001-12-16 11:24:56 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
*vfo = priv->curr_vfo;
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rig_strvfo(*vfo));
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int dummy_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2019-10-30 03:27:12 +00:00
|
|
|
priv->ptt = ptt;
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int dummy_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
2020-01-26 14:53:04 +00:00
|
|
|
int rc;
|
2019-10-30 03:27:12 +00:00
|
|
|
int status = 0;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
// sneak a look at the hardware PTT and OR that in with our result
|
|
|
|
// as if it had keyed us
|
|
|
|
switch (rig->state.pttport.type.ptt)
|
2015-04-23 17:33:45 +00:00
|
|
|
{
|
2020-01-26 14:53:04 +00:00
|
|
|
case RIG_PTT_SERIAL_DTR:
|
|
|
|
if (rig->state.pttport.fd >= 0)
|
|
|
|
{
|
2020-02-23 17:26:09 +00:00
|
|
|
if (RIG_OK != (rc = ser_get_dtr(&rig->state.pttport, &status))) { return rc; }
|
|
|
|
|
2020-01-26 14:53:04 +00:00
|
|
|
*ptt = status ? RIG_PTT_ON : RIG_PTT_OFF;
|
|
|
|
}
|
2020-02-23 17:26:09 +00:00
|
|
|
|
2020-01-26 14:53:04 +00:00
|
|
|
break;
|
2019-10-30 03:27:12 +00:00
|
|
|
|
2020-01-26 14:53:04 +00:00
|
|
|
case RIG_PTT_SERIAL_RTS:
|
|
|
|
if (rig->state.pttport.fd >= 0)
|
|
|
|
{
|
2020-02-23 17:26:09 +00:00
|
|
|
if (RIG_OK != (rc = ser_get_rts(&rig->state.pttport, &status))) { return rc; }
|
|
|
|
|
2020-01-26 14:53:04 +00:00
|
|
|
*ptt = status ? RIG_PTT_ON : RIG_PTT_OFF;
|
|
|
|
}
|
2020-02-23 17:26:09 +00:00
|
|
|
|
2020-01-26 14:53:04 +00:00
|
|
|
break;
|
2019-10-30 03:27:12 +00:00
|
|
|
|
2020-01-26 14:53:04 +00:00
|
|
|
case RIG_PTT_PARALLEL:
|
|
|
|
if (rig->state.pttport.fd >= 0)
|
|
|
|
{
|
2020-02-23 17:26:09 +00:00
|
|
|
if (RIG_OK != (rc = par_ptt_get(&rig->state.pttport, ptt))) { return rc; }
|
2020-01-26 14:53:04 +00:00
|
|
|
}
|
2020-02-23 17:26:09 +00:00
|
|
|
|
2020-01-26 14:53:04 +00:00
|
|
|
break;
|
2019-10-30 03:27:12 +00:00
|
|
|
|
2020-01-26 14:53:04 +00:00
|
|
|
case RIG_PTT_CM108:
|
|
|
|
if (rig->state.pttport.fd >= 0)
|
|
|
|
{
|
2020-02-23 17:26:09 +00:00
|
|
|
if (RIG_OK != (rc = cm108_ptt_get(&rig->state.pttport, ptt))) { return rc; }
|
2020-01-26 14:53:04 +00:00
|
|
|
}
|
2020-02-23 17:26:09 +00:00
|
|
|
|
2020-01-26 14:53:04 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_PTT_GPIO:
|
|
|
|
case RIG_PTT_GPION:
|
|
|
|
if (rig->state.pttport.fd >= 0)
|
|
|
|
{
|
2020-02-23 17:26:09 +00:00
|
|
|
if (RIG_OK != (rc = gpio_ptt_get(&rig->state.pttport, ptt))) { return rc; }
|
2020-01-26 14:53:04 +00:00
|
|
|
}
|
2020-02-23 17:26:09 +00:00
|
|
|
|
2020-01-26 14:53:04 +00:00
|
|
|
break;
|
2019-10-30 03:27:12 +00:00
|
|
|
|
2020-01-26 14:53:04 +00:00
|
|
|
default:
|
|
|
|
*ptt = priv->ptt;
|
|
|
|
break;
|
|
|
|
}
|
2020-02-23 17:26:09 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-14 23:57:30 +00:00
|
|
|
static int dummy_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
static int twiddle = 0;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2019-12-06 22:25:49 +00:00
|
|
|
*dcd = (twiddle++ & 1) ? RIG_DCD_ON : RIG_DCD_OFF;
|
2001-02-14 23:57:30 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 23:57:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-14 00:59:02 +00:00
|
|
|
static int dummy_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2019-10-30 03:27:12 +00:00
|
|
|
curr->rptr_shift = rptr_shift;
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int dummy_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
*rptr_shift = curr->rptr_shift;
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int dummy_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t rptr_offs)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2019-10-30 03:27:12 +00:00
|
|
|
curr->rptr_offs = rptr_offs;
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int dummy_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
*rptr_offs = curr->rptr_offs;
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-01 11:46:17 +00:00
|
|
|
static int dummy_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2019-10-30 03:27:12 +00:00
|
|
|
curr->ctcss_tone = tone;
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-01 11:46:17 +00:00
|
|
|
static int dummy_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
*tone = curr->ctcss_tone;
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-01 11:46:17 +00:00
|
|
|
static int dummy_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2019-10-30 03:27:12 +00:00
|
|
|
curr->dcs_code = code;
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-01 11:46:17 +00:00
|
|
|
static int dummy_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
*code = curr->dcs_code;
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-01 11:46:17 +00:00
|
|
|
static int dummy_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2019-10-30 03:27:12 +00:00
|
|
|
curr->ctcss_sql = tone;
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-01 11:46:17 +00:00
|
|
|
static int dummy_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
*tone = curr->ctcss_sql;
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int dummy_set_dcs_sql(RIG *rig, vfo_t vfo, unsigned int code)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2019-10-30 03:27:12 +00:00
|
|
|
curr->dcs_sql = code;
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int dummy_get_dcs_sql(RIG *rig, vfo_t vfo, unsigned int *code)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
*code = curr->dcs_sql;
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-27 17:32:47 +00:00
|
|
|
static int dummy_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
|
|
|
char fstr[20];
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
sprintf_freq(fstr, tx_freq);
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %s\n", __func__,
|
2019-10-30 03:27:12 +00:00
|
|
|
rig_strvfo(vfo), fstr);
|
|
|
|
curr->tx_freq = tx_freq;
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-27 17:32:47 +00:00
|
|
|
static int dummy_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rig_strvfo(vfo));
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
*tx_freq = curr->tx_freq;
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
static int dummy_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
|
|
|
|
pbwidth_t tx_width)
|
2001-05-08 09:08:59 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
|
|
|
char buf[16];
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
sprintf_freq(buf, tx_width);
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %s %s\n", __func__,
|
2019-10-30 03:27:12 +00:00
|
|
|
rig_strvfo(vfo), rig_strrmode(tx_mode), buf);
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
curr->tx_mode = tx_mode;
|
2016-04-09 13:13:49 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (RIG_PASSBAND_NOCHANGE == tx_width) { return RIG_OK; }
|
2001-05-08 09:08:59 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
curr->tx_width = tx_width;
|
|
|
|
|
|
|
|
return RIG_OK;
|
2001-05-08 09:08:59 +00:00
|
|
|
}
|
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
static int dummy_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
|
|
|
|
pbwidth_t *tx_width)
|
2001-05-08 09:08:59 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rig_strvfo(vfo));
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
*tx_mode = curr->tx_mode;
|
|
|
|
*tx_width = curr->tx_width;
|
2001-05-08 09:08:59 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-05-08 09:08:59 +00:00
|
|
|
}
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2003-04-06 18:40:36 +00:00
|
|
|
static int dummy_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
|
|
|
|
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called split=%d, vfo=%s, tx_vfo=%s\n",
|
2019-11-30 16:16:28 +00:00
|
|
|
__func__, split, rig_strvfo(vfo), rig_strvfo(tx_vfo));
|
2019-10-30 03:27:12 +00:00
|
|
|
curr->split = split;
|
|
|
|
priv->tx_vfo = tx_vfo;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (priv->curr_vfo == RIG_VFO_TX) { dummy_set_vfo(rig, RIG_VFO_TX); }
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
static int dummy_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
|
|
|
|
vfo_t *tx_vfo)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
*split = curr->split;
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int dummy_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2019-10-30 03:27:12 +00:00
|
|
|
curr->rit = rit;
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int dummy_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
*rit = curr->rit;
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-05-08 09:08:59 +00:00
|
|
|
static int dummy_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2019-10-30 03:27:12 +00:00
|
|
|
curr->xit = xit;
|
2001-05-08 09:08:59 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-05-08 09:08:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int dummy_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
*xit = curr->xit;
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-05-08 09:08:59 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-05-08 09:08:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-14 00:59:02 +00:00
|
|
|
static int dummy_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2019-10-30 03:27:12 +00:00
|
|
|
curr->tuning_step = ts;
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int dummy_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
*ts = curr->tuning_step;
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-01-22 00:43:05 +00:00
|
|
|
static int dummy_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %d\n", __func__,
|
2019-10-30 03:27:12 +00:00
|
|
|
rig_strfunc(func), status);
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (status)
|
|
|
|
{
|
|
|
|
curr->funcs |= func;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
curr->funcs &= ~func;
|
|
|
|
}
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-01-22 00:43:05 +00:00
|
|
|
static int dummy_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-12-06 22:25:49 +00:00
|
|
|
*status = (curr->funcs & func) ? 1 : 0;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__,
|
2019-10-30 03:27:12 +00:00
|
|
|
rig_strfunc(func));
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-01-22 00:43:05 +00:00
|
|
|
static int dummy_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
|
|
|
int idx;
|
|
|
|
char lstr[32];
|
|
|
|
|
|
|
|
idx = rig_setting2idx(level);
|
|
|
|
|
|
|
|
if (idx >= RIG_SETTING_MAX)
|
|
|
|
{
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
curr->levels[idx] = val;
|
2010-05-10 20:25:47 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (RIG_LEVEL_IS_FLOAT(level))
|
|
|
|
{
|
|
|
|
sprintf(lstr, "%f", val.f);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprintf(lstr, "%d", val.i);
|
|
|
|
}
|
2002-02-15 00:12:44 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %s\n", __func__,
|
2019-10-30 03:27:12 +00:00
|
|
|
rig_strlevel(level), lstr);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-01-22 00:43:05 +00:00
|
|
|
static int dummy_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
|
|
|
int idx;
|
2002-02-15 00:12:44 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
idx = rig_setting2idx(level);
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (idx >= RIG_SETTING_MAX)
|
|
|
|
{
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2010-05-10 20:25:47 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
switch (level)
|
|
|
|
{
|
2019-05-30 06:37:49 +00:00
|
|
|
case RIG_LEVEL_STRENGTH:
|
|
|
|
case RIG_LEVEL_RAWSTR:
|
2019-10-30 03:27:12 +00:00
|
|
|
if (priv->static_data)
|
|
|
|
{
|
|
|
|
curr->levels[idx].i = -12;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* make S-Meter jiggle */
|
|
|
|
int qrm = -56;
|
|
|
|
|
|
|
|
if (curr->freq < MHz(7))
|
|
|
|
{
|
|
|
|
qrm = -20;
|
|
|
|
}
|
|
|
|
else if (curr->freq < MHz(21))
|
|
|
|
{
|
|
|
|
qrm = -30;
|
|
|
|
}
|
|
|
|
else if (curr->freq < MHz(50))
|
|
|
|
{
|
|
|
|
qrm = -50;
|
|
|
|
}
|
|
|
|
|
|
|
|
curr->levels[idx].i = qrm + time(NULL) % 32 + rand() % 4
|
|
|
|
- curr->levels[LVL_ATT].i
|
|
|
|
+ curr->levels[LVL_PREAMP].i;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2019-05-30 06:37:49 +00:00
|
|
|
case RIG_LEVEL_RFPOWER_METER:
|
2019-10-30 03:27:12 +00:00
|
|
|
if (priv->static_data)
|
|
|
|
{
|
|
|
|
curr->levels[idx].f = 0.5f;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
curr->levels[idx].f = (float)(time(NULL) % 32) / 64.0f + (float)(
|
|
|
|
rand() % 4) / 8.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2019-05-30 06:37:49 +00:00
|
|
|
case RIG_LEVEL_COMP_METER:
|
2019-10-30 03:27:12 +00:00
|
|
|
if (priv->static_data)
|
|
|
|
{
|
|
|
|
curr->levels[idx].f = 3.5f;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
curr->levels[idx].f = 0.5f + (float)(time(NULL) % 32) / 16.0f + (float)(
|
|
|
|
rand() % 200) / 20.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2019-05-30 06:37:49 +00:00
|
|
|
case RIG_LEVEL_VD_METER:
|
2019-10-30 03:27:12 +00:00
|
|
|
if (priv->static_data)
|
|
|
|
{
|
|
|
|
curr->levels[idx].f = 13.82f;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
curr->levels[idx].f = 13.82f + (float)(time(NULL) % 10) / 50.0f - (float)(
|
|
|
|
rand() % 10) / 40.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2019-05-30 06:37:49 +00:00
|
|
|
case RIG_LEVEL_ID_METER:
|
2019-10-30 03:27:12 +00:00
|
|
|
if (priv->static_data)
|
|
|
|
{
|
|
|
|
curr->levels[idx].f = 0.85f;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
curr->levels[idx].f = 2.0f + (float)(time(NULL) % 320) / 16.0f - (float)(
|
|
|
|
rand() % 40) / 20.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2008-05-04 14:08:55 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
*val = curr->levels[idx];
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__,
|
2019-10-30 03:27:12 +00:00
|
|
|
rig_strlevel(level));
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
2009-01-28 22:53:18 +00:00
|
|
|
static int dummy_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
|
|
|
char lstr[64];
|
|
|
|
const struct confparams *cfp;
|
|
|
|
struct ext_list *elp;
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
cfp = rig_ext_lookup_tok(rig, token);
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (!cfp)
|
|
|
|
{
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (token)
|
|
|
|
{
|
2009-01-28 22:53:18 +00:00
|
|
|
case TOK_EL_MAGICLEVEL:
|
|
|
|
case TOK_EL_MAGICFUNC:
|
2009-02-06 17:27:54 +00:00
|
|
|
case TOK_EL_MAGICOP:
|
2019-05-30 06:37:49 +00:00
|
|
|
case TOK_EL_MAGICCOMBO:
|
2019-10-30 03:27:12 +00:00
|
|
|
break;
|
2009-01-28 22:53:18 +00:00
|
|
|
|
|
|
|
default:
|
2019-10-30 03:27:12 +00:00
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
switch (cfp->type)
|
|
|
|
{
|
2009-01-28 22:53:18 +00:00
|
|
|
case RIG_CONF_STRING:
|
2019-10-30 03:27:12 +00:00
|
|
|
strcpy(lstr, val.s);
|
|
|
|
break;
|
|
|
|
|
2009-01-28 22:53:18 +00:00
|
|
|
case RIG_CONF_COMBO:
|
2019-10-30 03:27:12 +00:00
|
|
|
sprintf(lstr, "%d", val.i);
|
|
|
|
break;
|
|
|
|
|
2009-01-28 22:53:18 +00:00
|
|
|
case RIG_CONF_NUMERIC:
|
2019-10-30 03:27:12 +00:00
|
|
|
sprintf(lstr, "%f", val.f);
|
|
|
|
break;
|
|
|
|
|
2009-01-28 22:53:18 +00:00
|
|
|
case RIG_CONF_CHECKBUTTON:
|
2019-10-30 03:27:12 +00:00
|
|
|
sprintf(lstr, "%s", val.i ? "ON" : "OFF");
|
|
|
|
break;
|
|
|
|
|
2009-02-06 17:27:54 +00:00
|
|
|
case RIG_CONF_BUTTON:
|
2019-10-30 03:27:12 +00:00
|
|
|
lstr[0] = '\0';
|
|
|
|
break;
|
|
|
|
|
2009-01-28 22:53:18 +00:00
|
|
|
default:
|
2019-10-30 03:27:12 +00:00
|
|
|
return -RIG_EINTERNAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
elp = find_ext(curr->ext_levels, token);
|
|
|
|
|
|
|
|
if (!elp)
|
|
|
|
{
|
|
|
|
return -RIG_EINTERNAL;
|
|
|
|
}
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
/* store value */
|
|
|
|
elp->val = val;
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %s\n", __func__,
|
2019-10-30 03:27:12 +00:00
|
|
|
cfp->name, lstr);
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2009-01-28 22:53:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int dummy_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
|
|
|
const struct confparams *cfp;
|
|
|
|
struct ext_list *elp;
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
cfp = rig_ext_lookup_tok(rig, token);
|
|
|
|
|
|
|
|
if (!cfp)
|
|
|
|
{
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
switch (token)
|
|
|
|
{
|
2009-01-28 22:53:18 +00:00
|
|
|
case TOK_EL_MAGICLEVEL:
|
|
|
|
case TOK_EL_MAGICFUNC:
|
2009-02-06 17:27:54 +00:00
|
|
|
case TOK_EL_MAGICOP:
|
2019-05-30 06:37:49 +00:00
|
|
|
case TOK_EL_MAGICCOMBO:
|
2019-10-30 03:27:12 +00:00
|
|
|
break;
|
2009-01-28 22:53:18 +00:00
|
|
|
|
|
|
|
default:
|
2019-10-30 03:27:12 +00:00
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
elp = find_ext(curr->ext_levels, token);
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (!elp)
|
|
|
|
{
|
|
|
|
return -RIG_EINTERNAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* load value */
|
|
|
|
*val = elp->val;
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__,
|
2019-10-30 03:27:12 +00:00
|
|
|
cfp->name);
|
|
|
|
|
|
|
|
return RIG_OK;
|
2009-01-28 22:53:18 +00:00
|
|
|
}
|
|
|
|
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2002-01-22 00:43:05 +00:00
|
|
|
static int dummy_set_powerstat(RIG *rig, powerstat_t status)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2019-10-30 03:27:12 +00:00
|
|
|
priv->powerstat = status;
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-01-22 00:43:05 +00:00
|
|
|
static int dummy_get_powerstat(RIG *rig, powerstat_t *status)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
*status = priv->powerstat;
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-01-22 00:43:05 +00:00
|
|
|
static int dummy_set_parm(RIG *rig, setting_t parm, value_t val)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
int idx;
|
|
|
|
char pstr[32];
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
idx = rig_setting2idx(parm);
|
2002-02-15 00:12:44 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (idx >= RIG_SETTING_MAX)
|
|
|
|
{
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (RIG_PARM_IS_FLOAT(parm))
|
|
|
|
{
|
|
|
|
sprintf(pstr, "%f", val.f);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprintf(pstr, "%d", val.i);
|
|
|
|
}
|
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %s\n", __func__,
|
2019-10-30 03:27:12 +00:00
|
|
|
rig_strparm(parm), pstr);
|
|
|
|
priv->parms[idx] = val;
|
|
|
|
|
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-01-22 00:43:05 +00:00
|
|
|
static int dummy_get_parm(RIG *rig, setting_t parm, value_t *val)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
int idx;
|
2002-02-15 00:12:44 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
idx = rig_setting2idx(parm);
|
|
|
|
|
|
|
|
if (idx >= RIG_SETTING_MAX)
|
|
|
|
{
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
*val = priv->parms[idx];
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called %s\n", __func__,
|
2019-10-30 03:27:12 +00:00
|
|
|
rig_strparm(parm));
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
2009-01-28 22:53:18 +00:00
|
|
|
static int dummy_set_ext_parm(RIG *rig, token_t token, value_t val)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
char lstr[64];
|
|
|
|
const struct confparams *cfp;
|
|
|
|
struct ext_list *epp;
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
cfp = rig_ext_lookup_tok(rig, token);
|
|
|
|
|
|
|
|
if (!cfp)
|
|
|
|
{
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
switch (token)
|
|
|
|
{
|
2009-01-28 22:53:18 +00:00
|
|
|
case TOK_EP_MAGICPARM:
|
2019-10-30 03:27:12 +00:00
|
|
|
break;
|
2009-01-28 22:53:18 +00:00
|
|
|
|
|
|
|
default:
|
2019-10-30 03:27:12 +00:00
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
switch (cfp->type)
|
|
|
|
{
|
2009-01-28 22:53:18 +00:00
|
|
|
case RIG_CONF_STRING:
|
2019-10-30 03:27:12 +00:00
|
|
|
strcpy(lstr, val.s);
|
|
|
|
break;
|
|
|
|
|
2009-01-28 22:53:18 +00:00
|
|
|
case RIG_CONF_COMBO:
|
2019-10-30 03:27:12 +00:00
|
|
|
sprintf(lstr, "%d", val.i);
|
|
|
|
break;
|
|
|
|
|
2009-01-28 22:53:18 +00:00
|
|
|
case RIG_CONF_NUMERIC:
|
2019-10-30 03:27:12 +00:00
|
|
|
sprintf(lstr, "%f", val.f);
|
|
|
|
break;
|
|
|
|
|
2009-01-28 22:53:18 +00:00
|
|
|
case RIG_CONF_CHECKBUTTON:
|
2019-10-30 03:27:12 +00:00
|
|
|
sprintf(lstr, "%s", val.i ? "ON" : "OFF");
|
|
|
|
break;
|
|
|
|
|
2009-02-06 17:27:54 +00:00
|
|
|
case RIG_CONF_BUTTON:
|
2019-10-30 03:27:12 +00:00
|
|
|
lstr[0] = '\0';
|
|
|
|
break;
|
|
|
|
|
2009-01-28 22:53:18 +00:00
|
|
|
default:
|
2019-10-30 03:27:12 +00:00
|
|
|
return -RIG_EINTERNAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
epp = find_ext(priv->ext_parms, token);
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (!epp)
|
|
|
|
{
|
|
|
|
return -RIG_EINTERNAL;
|
|
|
|
}
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
/* store value */
|
|
|
|
epp->val = val;
|
2009-01-28 22:53:18 +00:00
|
|
|
|
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %s\n", __func__,
|
2019-10-30 03:27:12 +00:00
|
|
|
cfp->name, lstr);
|
|
|
|
|
|
|
|
return RIG_OK;
|
2009-01-28 22:53:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int dummy_get_ext_parm(RIG *rig, token_t token, value_t *val)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
const struct confparams *cfp;
|
|
|
|
struct ext_list *epp;
|
|
|
|
|
|
|
|
/* TODO: load value from priv->ext_parms */
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
cfp = rig_ext_lookup_tok(rig, token);
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (!cfp)
|
|
|
|
{
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
switch (token)
|
|
|
|
{
|
2009-01-28 22:53:18 +00:00
|
|
|
case TOK_EP_MAGICPARM:
|
2019-10-30 03:27:12 +00:00
|
|
|
break;
|
2009-01-28 22:53:18 +00:00
|
|
|
|
|
|
|
default:
|
2019-10-30 03:27:12 +00:00
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
epp = find_ext(priv->ext_parms, token);
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (!epp)
|
|
|
|
{
|
|
|
|
return -RIG_EINTERNAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* load value */
|
|
|
|
*val = epp->val;
|
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__,
|
2019-10-30 03:27:12 +00:00
|
|
|
cfp->name);
|
2009-01-28 22:53:18 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2009-01-28 22:53:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2020-01-21 23:53:12 +00:00
|
|
|
static int dummy_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2020-02-23 17:26:09 +00:00
|
|
|
switch (ant)
|
|
|
|
{
|
|
|
|
case RIG_ANT_CURR:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_ANT_1:
|
|
|
|
case RIG_ANT_2:
|
|
|
|
case RIG_ANT_3:
|
|
|
|
case RIG_ANT_4:
|
|
|
|
curr->ant = ant;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
rig_debug(RIG_DEBUG_ERR, "%s: unknown antenna requested=0x%02x\n", __func__,
|
|
|
|
ant);
|
|
|
|
return -RIG_EINVAL;
|
2020-02-10 18:17:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
priv->ant_option[rig_setting2idx(curr->ant)] = option.i;
|
2020-02-23 17:26:09 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE,
|
|
|
|
"%s called ant=0x%02x, option=%d, curr->ant=0x%02x\n", __func__, ant, option.i,
|
|
|
|
curr->ant);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-23 17:26:09 +00:00
|
|
|
static int dummy_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
|
|
|
|
ant_t *ant_curr, ant_t *ant_tx, ant_t *ant_rx)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2020-02-02 14:38:10 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called, ant=0x%02x\n", __func__, ant);
|
2020-02-18 05:13:22 +00:00
|
|
|
|
|
|
|
*ant_tx = *ant_rx = RIG_ANT_UNKNOWN;
|
2020-02-23 17:26:09 +00:00
|
|
|
|
|
|
|
switch (ant)
|
|
|
|
{
|
|
|
|
case RIG_ANT_CURR:
|
|
|
|
*ant_curr = curr->ant;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_ANT_1:
|
|
|
|
case RIG_ANT_2:
|
|
|
|
case RIG_ANT_3:
|
|
|
|
case RIG_ANT_4:
|
|
|
|
*ant_curr = ant;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
rig_debug(RIG_DEBUG_ERR, "%s: unknown antenna requested=0x%02x\n", __func__,
|
|
|
|
ant);
|
|
|
|
return -RIG_EINVAL;
|
2020-02-10 18:17:30 +00:00
|
|
|
}
|
2020-02-23 17:26:09 +00:00
|
|
|
|
|
|
|
rig_debug(RIG_DEBUG_TRACE, "%s: ant_curr=0x%02x, idx=%d\n", __func__, *ant_curr,
|
|
|
|
rig_setting2idx(*ant_curr));
|
2020-02-10 18:17:30 +00:00
|
|
|
option->i = priv->ant_option[rig_setting2idx(*ant_curr)];
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int dummy_set_bank(RIG *rig, vfo_t vfo, int bank)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
priv->bank = bank;
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int dummy_set_mem(RIG *rig, vfo_t vfo, int ch)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2002-02-15 00:12:44 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (ch < 0 || ch >= NB_CHAN)
|
|
|
|
{
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2010-05-10 20:25:47 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (priv->curr_vfo == RIG_VFO_MEM)
|
|
|
|
{
|
|
|
|
priv->curr = &priv->mem[ch];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
priv->curr->channel_num = ch;
|
|
|
|
}
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int dummy_get_mem(RIG *rig, vfo_t vfo, int *ch)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
*ch = curr->channel_num;
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
2002-01-22 00:43:05 +00:00
|
|
|
static int dummy_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch)
|
|
|
|
{
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %d\n", __func__,
|
2019-10-30 03:27:12 +00:00
|
|
|
rig_strscan(scan), ch);
|
|
|
|
/* TODO: change freq, etc. */
|
|
|
|
return RIG_OK;
|
2002-01-22 00:43:05 +00:00
|
|
|
}
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2002-02-15 00:12:44 +00:00
|
|
|
static void chan_vfo(channel_t *chan, vfo_t vfo)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
chan->vfo = vfo;
|
|
|
|
strcpy(chan->channel_desc, rig_strvfo(vfo));
|
2002-02-15 00:12:44 +00:00
|
|
|
}
|
|
|
|
|
2001-06-03 19:54:05 +00:00
|
|
|
static int dummy_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
channel_t *curr = priv->curr;
|
|
|
|
int ret;
|
|
|
|
freq_t freq;
|
|
|
|
shortfreq_t ts;
|
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__,
|
2019-10-30 03:27:12 +00:00
|
|
|
rig_strvfop(op));
|
|
|
|
|
|
|
|
switch (op)
|
|
|
|
{
|
|
|
|
case RIG_OP_FROM_VFO: /* VFO->MEM */
|
|
|
|
if (priv->curr_vfo == RIG_VFO_MEM)
|
|
|
|
{
|
|
|
|
int ch = curr->channel_num;
|
|
|
|
copy_chan(curr, priv->last_vfo == RIG_VFO_A ?
|
|
|
|
&priv->vfo_a : &priv->vfo_b);
|
|
|
|
curr->channel_num = ch;
|
|
|
|
curr->channel_desc[0] = '\0';
|
|
|
|
curr->vfo = RIG_VFO_MEM;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
channel_t *mem_chan = &priv->mem[curr->channel_num];
|
|
|
|
copy_chan(mem_chan, curr);
|
|
|
|
mem_chan->channel_num = curr->channel_num;
|
|
|
|
mem_chan->channel_desc[0] = '\0';
|
|
|
|
mem_chan->vfo = RIG_VFO_MEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_OP_TO_VFO: /* MEM->VFO */
|
|
|
|
if (priv->curr_vfo == RIG_VFO_MEM)
|
|
|
|
{
|
|
|
|
channel_t *vfo_chan = (priv->last_vfo == RIG_VFO_A) ?
|
|
|
|
&priv->vfo_a : &priv->vfo_b;
|
|
|
|
copy_chan(vfo_chan, curr);
|
|
|
|
chan_vfo(vfo_chan, priv->last_vfo);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
copy_chan(&priv->mem[curr->channel_num], curr);
|
|
|
|
chan_vfo(curr, priv->curr_vfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_OP_CPY: /* VFO A = VFO B or VFO B = VFO A */
|
|
|
|
if (priv->curr_vfo == RIG_VFO_A)
|
|
|
|
{
|
|
|
|
copy_chan(&priv->vfo_b, &priv->vfo_a);
|
|
|
|
chan_vfo(&priv->vfo_b, RIG_VFO_B);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (priv->curr_vfo == RIG_VFO_B)
|
|
|
|
{
|
|
|
|
copy_chan(&priv->vfo_a, &priv->vfo_b);
|
|
|
|
chan_vfo(&priv->vfo_a, RIG_VFO_A);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s beep!\n", __func__);
|
2019-10-30 03:27:12 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_OP_XCHG: /* Exchange VFO A/B */
|
|
|
|
{
|
|
|
|
channel_t chan;
|
|
|
|
chan.ext_levels = alloc_init_ext(dummy_ext_levels);
|
|
|
|
|
|
|
|
if (!chan.ext_levels)
|
|
|
|
{
|
|
|
|
return -RIG_ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
copy_chan(&chan, &priv->vfo_b);
|
|
|
|
copy_chan(&priv->vfo_b, &priv->vfo_a);
|
|
|
|
copy_chan(&priv->vfo_a, &chan);
|
|
|
|
chan_vfo(&priv->vfo_a, RIG_VFO_A);
|
|
|
|
chan_vfo(&priv->vfo_b, RIG_VFO_B);
|
|
|
|
free(chan.ext_levels);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case RIG_OP_MCL: /* Memory clear */
|
|
|
|
if (priv->curr_vfo == RIG_VFO_MEM)
|
|
|
|
{
|
|
|
|
struct ext_list *saved_ext_levels = curr->ext_levels;
|
|
|
|
int saved_ch = curr->channel_num;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; !RIG_IS_EXT_END(curr->ext_levels[i]); i++)
|
|
|
|
{
|
|
|
|
curr->ext_levels[i].val.i = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(curr, 0, sizeof(channel_t));
|
|
|
|
curr->ext_levels = saved_ext_levels;
|
|
|
|
curr->channel_num = saved_ch;
|
|
|
|
curr->vfo = RIG_VFO_MEM;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
struct ext_list *saved_ext_levels = curr->ext_levels;
|
|
|
|
channel_t *mem_chan = &priv->mem[curr->channel_num];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; !RIG_IS_EXT_END(mem_chan->ext_levels[i]); i++)
|
|
|
|
{
|
|
|
|
mem_chan->ext_levels[i].val.i = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(mem_chan, 0, sizeof(channel_t));
|
|
|
|
mem_chan->ext_levels = saved_ext_levels;
|
|
|
|
mem_chan->channel_num = curr->channel_num;
|
|
|
|
mem_chan->vfo = RIG_VFO_MEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_OP_TOGGLE:
|
|
|
|
if (priv->curr_vfo == RIG_VFO_A)
|
|
|
|
{
|
|
|
|
return dummy_set_vfo(rig, RIG_VFO_B);
|
|
|
|
}
|
|
|
|
else if (priv->curr_vfo == RIG_VFO_B)
|
|
|
|
{
|
|
|
|
return dummy_set_vfo(rig, RIG_VFO_A);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return -RIG_EVFO;
|
|
|
|
}
|
|
|
|
|
|
|
|
case RIG_OP_RIGHT:
|
|
|
|
case RIG_OP_LEFT:
|
|
|
|
case RIG_OP_TUNE:
|
|
|
|
/* NOP */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_OP_BAND_UP:
|
|
|
|
case RIG_OP_BAND_DOWN:
|
|
|
|
return -RIG_ENIMPL;
|
|
|
|
|
|
|
|
case RIG_OP_UP:
|
|
|
|
ret = dummy_get_freq(rig, vfo, &freq);
|
|
|
|
|
|
|
|
if (!ret) { break; }
|
|
|
|
|
|
|
|
ret = dummy_get_ts(rig, vfo, &ts);
|
|
|
|
|
|
|
|
if (!ret) { break; }
|
|
|
|
|
2020-01-14 04:57:59 +00:00
|
|
|
dummy_set_freq(rig, vfo, freq + ts); /* up */
|
2019-10-30 03:27:12 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_OP_DOWN:
|
|
|
|
ret = dummy_get_freq(rig, vfo, &freq);
|
|
|
|
|
|
|
|
if (!ret) { break; }
|
|
|
|
|
|
|
|
ret = dummy_get_ts(rig, vfo, &ts);
|
|
|
|
|
|
|
|
if (!ret) { break; }
|
|
|
|
|
2020-01-14 04:57:59 +00:00
|
|
|
dummy_set_freq(rig, vfo, freq - ts); /* down */
|
2019-10-30 03:27:12 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return RIG_OK;
|
2001-06-03 19:54:05 +00:00
|
|
|
}
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2002-08-16 17:43:02 +00:00
|
|
|
static int dummy_set_channel(RIG *rig, const channel_t *chan)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (!chan->ext_levels)
|
|
|
|
{
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (chan->channel_num < 0 || chan->channel_num >= NB_CHAN)
|
|
|
|
{
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* TODO:
|
|
|
|
* - check ext_levels is the right length
|
|
|
|
*/
|
|
|
|
switch (chan->vfo)
|
|
|
|
{
|
|
|
|
case RIG_VFO_MEM:
|
|
|
|
copy_chan(&priv->mem[chan->channel_num], chan);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_VFO_A:
|
|
|
|
copy_chan(&priv->vfo_a, chan);
|
|
|
|
break;
|
2002-10-03 20:13:35 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
case RIG_VFO_B:
|
|
|
|
copy_chan(&priv->vfo_b, chan);
|
|
|
|
break;
|
2010-05-10 20:25:47 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
case RIG_VFO_CURR:
|
|
|
|
copy_chan(priv->curr, chan);
|
|
|
|
break;
|
2010-05-10 20:25:47 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
default:
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int dummy_get_channel(RIG *rig, channel_t *chan)
|
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
2002-01-22 00:43:05 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (chan->channel_num < 0 || chan->channel_num >= NB_CHAN)
|
|
|
|
{
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2010-05-10 20:25:47 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (!chan->ext_levels)
|
|
|
|
{
|
|
|
|
chan->ext_levels = alloc_init_ext(dummy_ext_levels);
|
2010-05-31 08:42:01 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
if (!chan->ext_levels)
|
|
|
|
{
|
|
|
|
return -RIG_ENOMEM;
|
|
|
|
}
|
|
|
|
}
|
2002-10-03 20:13:35 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
/* TODO:
|
|
|
|
* - check ext_levels is the right length
|
|
|
|
*/
|
|
|
|
switch (chan->vfo)
|
|
|
|
{
|
|
|
|
case RIG_VFO_MEM:
|
|
|
|
copy_chan(chan, &priv->mem[chan->channel_num]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_VFO_A:
|
|
|
|
copy_chan(chan, &priv->vfo_a);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_VFO_B:
|
|
|
|
copy_chan(chan, &priv->vfo_b);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_VFO_CURR:
|
|
|
|
copy_chan(chan, priv->curr);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-12-20 07:46:13 +00:00
|
|
|
static int dummy_set_trn(RIG *rig, int trn)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-12-20 07:46:13 +00:00
|
|
|
static int dummy_get_trn(RIG *rig, int *trn)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-10-30 03:27:12 +00:00
|
|
|
*trn = RIG_TRN_OFF;
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
2001-06-02 18:11:21 +00:00
|
|
|
static const char *dummy_get_info(RIG *rig)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return "Nothing much (dummy)";
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-05-08 09:08:59 +00:00
|
|
|
static int dummy_send_dtmf(RIG *rig, vfo_t vfo, const char *digits)
|
|
|
|
{
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, digits);
|
2001-05-08 09:08:59 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-05-08 09:08:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int dummy_recv_dtmf(RIG *rig, vfo_t vfo, char *digits, int *length)
|
|
|
|
{
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2019-10-30 03:27:12 +00:00
|
|
|
strcpy(digits, "0123456789ABCDEF");
|
|
|
|
*length = 16;
|
2001-05-08 09:08:59 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-05-08 09:08:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int dummy_send_morse(RIG *rig, vfo_t vfo, const char *msg)
|
|
|
|
{
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, msg);
|
2001-05-08 09:08:59 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-05-08 09:08:59 +00:00
|
|
|
}
|
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
static int dummy_power2mW(RIG *rig, unsigned int *mwpower, float power,
|
2010-02-06 15:28:25 +00:00
|
|
|
freq_t freq, rmode_t mode)
|
|
|
|
{
|
|
|
|
rig_debug(RIG_DEBUG_TRACE, "%s: passed power = %f\n", __func__, power);
|
|
|
|
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
|
2019-11-30 16:19:08 +00:00
|
|
|
rig_debug(RIG_DEBUG_TRACE, "%s: passed mode = %s\n", __func__,
|
|
|
|
rig_strrmode(mode));
|
2010-02-06 15:28:25 +00:00
|
|
|
|
|
|
|
/* Pretend this is a 100W radio */
|
|
|
|
*mwpower = (power * 100000);
|
|
|
|
|
|
|
|
return RIG_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
static int dummy_mW2power(RIG *rig, float *power, unsigned int mwpower,
|
2010-02-06 15:28:25 +00:00
|
|
|
freq_t freq, rmode_t mode)
|
|
|
|
{
|
|
|
|
rig_debug(RIG_DEBUG_TRACE, "%s: passed mwpower = %i\n", __func__, mwpower);
|
|
|
|
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
|
2019-11-30 16:19:08 +00:00
|
|
|
rig_debug(RIG_DEBUG_TRACE, "%s: passed mode = %s\n", __func__,
|
|
|
|
rig_strrmode(mode));
|
2010-02-06 15:28:25 +00:00
|
|
|
|
|
|
|
/* Pretend this is a 100W radio */
|
|
|
|
if (mwpower > 100000)
|
2019-10-30 03:27:12 +00:00
|
|
|
{
|
2010-02-06 15:28:25 +00:00
|
|
|
return -RIG_EINVAL;
|
2019-10-30 03:27:12 +00:00
|
|
|
}
|
2010-02-06 15:28:25 +00:00
|
|
|
|
|
|
|
*power = ((float)mwpower / 100000);
|
|
|
|
|
|
|
|
return RIG_OK;
|
|
|
|
}
|
2001-02-14 00:59:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Dummy rig capabilities.
|
|
|
|
*/
|
|
|
|
|
2013-02-01 00:03:50 +00:00
|
|
|
/*
|
|
|
|
* The following macros set bitmasks for the various funcs, levels, parms,
|
|
|
|
* etc. This dummy backend claims support for almost all of them.
|
|
|
|
*/
|
2019-05-30 06:37:49 +00:00
|
|
|
#define DUMMY_FUNC ((setting_t)-1ULL) /* All possible functions */
|
|
|
|
#define DUMMY_LEVEL (((setting_t)-1ULL)&~(1ULL<<27)) /* All levels except SQLSTAT */
|
|
|
|
#define DUMMY_PARM ((setting_t)-1ULL) /* All possible parms */
|
2004-01-15 22:43:59 +00:00
|
|
|
|
2013-02-01 00:03:50 +00:00
|
|
|
#define DUMMY_VFO_OP 0x7ffffffUL /* All possible VFO OPs */
|
|
|
|
#define DUMMY_SCAN 0x7ffffffUL /* All possible scan OPs */
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2010-05-10 20:25:47 +00:00
|
|
|
#define DUMMY_VFOS (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM)
|
|
|
|
|
2001-12-26 23:37:46 +00:00
|
|
|
#define DUMMY_MODES (RIG_MODE_AM | RIG_MODE_CW | RIG_MODE_RTTY | \
|
2010-03-06 17:31:19 +00:00
|
|
|
RIG_MODE_SSB | RIG_MODE_FM | RIG_MODE_WFM | \
|
|
|
|
RIG_MODE_CWR | RIG_MODE_RTTYR)
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2002-11-04 22:36:57 +00:00
|
|
|
#define DUMMY_MEM_CAP { \
|
2019-10-30 03:27:12 +00:00
|
|
|
.bank_num = 1, \
|
|
|
|
.vfo = 1, \
|
|
|
|
.ant = 1, \
|
|
|
|
.freq = 1, \
|
|
|
|
.mode = 1, \
|
|
|
|
.width = 1, \
|
|
|
|
.tx_freq = 1, \
|
|
|
|
.tx_mode = 1, \
|
|
|
|
.tx_width = 1, \
|
|
|
|
.split = 1, \
|
|
|
|
.rptr_shift = 1, \
|
|
|
|
.rptr_offs = 1, \
|
|
|
|
.tuning_step = 1, \
|
|
|
|
.rit = 1, \
|
|
|
|
.xit = 1, \
|
|
|
|
.funcs = DUMMY_FUNC, \
|
|
|
|
.levels = RIG_LEVEL_SET(DUMMY_LEVEL), \
|
|
|
|
.ctcss_tone = 1, \
|
|
|
|
.ctcss_sql = 1, \
|
|
|
|
.dcs_code = 1, \
|
|
|
|
.dcs_sql = 1, \
|
|
|
|
.scan_group = 1, \
|
|
|
|
.flags = 1, \
|
|
|
|
.channel_desc = 1, \
|
|
|
|
.ext_levels = 1, \
|
|
|
|
}
|
|
|
|
|
|
|
|
const struct rig_caps dummy_caps =
|
|
|
|
{
|
2020-03-05 14:44:18 +00:00
|
|
|
RIG_MODEL(RIG_MODEL_DUMMY),
|
2019-10-30 03:27:12 +00:00
|
|
|
.model_name = "Dummy",
|
|
|
|
.mfg_name = "Hamlib",
|
2020-02-18 05:13:22 +00:00
|
|
|
.version = "0.7",
|
2019-10-30 03:27:12 +00:00
|
|
|
.copyright = "LGPL",
|
2020-02-18 05:13:22 +00:00
|
|
|
.status = RIG_STATUS_STABLE,
|
2019-10-30 03:27:12 +00:00
|
|
|
.rig_type = RIG_TYPE_OTHER,
|
|
|
|
.targetable_vfo = 0,
|
|
|
|
.ptt_type = RIG_PTT_RIG,
|
|
|
|
.dcd_type = RIG_DCD_RIG,
|
|
|
|
.port_type = RIG_PORT_NONE,
|
|
|
|
.has_get_func = DUMMY_FUNC,
|
|
|
|
.has_set_func = DUMMY_FUNC,
|
|
|
|
.has_get_level = DUMMY_LEVEL,
|
|
|
|
.has_set_level = RIG_LEVEL_SET(DUMMY_LEVEL),
|
|
|
|
.has_get_parm = DUMMY_PARM,
|
|
|
|
.has_set_parm = RIG_PARM_SET(DUMMY_PARM),
|
|
|
|
.level_gran = { [LVL_CWPITCH] = { .step = { .i = 10 } } },
|
|
|
|
.ctcss_list = common_ctcss_list,
|
|
|
|
.dcs_list = full_dcs_list,
|
|
|
|
.chan_list = {
|
|
|
|
{ 0, 18, RIG_MTYPE_MEM, DUMMY_MEM_CAP },
|
|
|
|
{ 19, 19, RIG_MTYPE_CALL },
|
|
|
|
{ 20, NB_CHAN - 1, RIG_MTYPE_EDGE },
|
|
|
|
RIG_CHAN_END,
|
|
|
|
},
|
|
|
|
.scan_ops = DUMMY_SCAN,
|
|
|
|
.vfo_ops = DUMMY_VFO_OP,
|
|
|
|
.transceive = RIG_TRN_OFF,
|
|
|
|
.attenuator = { 10, 20, 30, RIG_DBLST_END, },
|
|
|
|
.preamp = { 10, RIG_DBLST_END, },
|
|
|
|
.rx_range_list1 = { {
|
|
|
|
.startf = kHz(150), .endf = MHz(1500), .modes = DUMMY_MODES,
|
2020-02-18 05:13:22 +00:00
|
|
|
.low_power = -1, .high_power = -1, DUMMY_VFOS, RIG_ANT_1 | RIG_ANT_2 | RIG_ANT_3 | RIG_ANT_4,
|
2020-02-17 12:44:24 +00:00
|
|
|
.label = "Dummy#1"
|
2019-10-30 03:27:12 +00:00
|
|
|
},
|
|
|
|
RIG_FRNG_END,
|
|
|
|
},
|
|
|
|
.tx_range_list1 = { {
|
|
|
|
.startf = kHz(150), .endf = MHz(1500), .modes = DUMMY_MODES,
|
2020-02-18 05:13:22 +00:00
|
|
|
.low_power = W(5), .high_power = W(100), DUMMY_VFOS, RIG_ANT_1 | RIG_ANT_2 | RIG_ANT_3 | RIG_ANT_4,
|
2020-02-17 12:44:24 +00:00
|
|
|
.label = "Dummy#1"
|
2019-10-30 03:27:12 +00:00
|
|
|
},
|
|
|
|
RIG_FRNG_END,
|
|
|
|
},
|
|
|
|
.rx_range_list2 = { {
|
|
|
|
.startf = kHz(150), .endf = MHz(1500), .modes = DUMMY_MODES,
|
2020-02-18 05:13:22 +00:00
|
|
|
.low_power = -1, .high_power = -1, DUMMY_VFOS, RIG_ANT_1 | RIG_ANT_2 | RIG_ANT_3 | RIG_ANT_4,
|
2020-02-17 12:44:24 +00:00
|
|
|
.label = "Dummy#2"
|
2019-10-30 03:27:12 +00:00
|
|
|
},
|
|
|
|
RIG_FRNG_END,
|
|
|
|
},
|
|
|
|
.tx_range_list2 = { RIG_FRNG_END, },
|
|
|
|
.tuning_steps = { {DUMMY_MODES, 1}, {DUMMY_MODES, RIG_TS_ANY}, RIG_TS_END, },
|
|
|
|
.filters = {
|
|
|
|
{RIG_MODE_SSB, kHz(2.4)},
|
|
|
|
{RIG_MODE_SSB, kHz(1.8)},
|
|
|
|
{RIG_MODE_SSB, kHz(3.0)},
|
|
|
|
{RIG_MODE_SSB, RIG_FLT_ANY},
|
|
|
|
{RIG_MODE_CW, Hz(500)},
|
|
|
|
{RIG_MODE_CW, kHz(2.4)},
|
|
|
|
{RIG_MODE_CW, Hz(50)},
|
|
|
|
{RIG_MODE_CW, RIG_FLT_ANY},
|
|
|
|
{RIG_MODE_RTTY, Hz(300)},
|
|
|
|
{RIG_MODE_RTTY, kHz(2.4)},
|
|
|
|
{RIG_MODE_RTTY, Hz(50)},
|
|
|
|
{RIG_MODE_RTTY, RIG_FLT_ANY},
|
|
|
|
{RIG_MODE_AM, kHz(8)},
|
|
|
|
{RIG_MODE_AM, kHz(2.4)},
|
|
|
|
{RIG_MODE_AM, kHz(10)},
|
|
|
|
{RIG_MODE_FM, kHz(15)},
|
|
|
|
{RIG_MODE_FM, kHz(8)},
|
|
|
|
{RIG_MODE_WFM, kHz(230)},
|
|
|
|
RIG_FLT_END,
|
|
|
|
},
|
|
|
|
.max_rit = 9990,
|
|
|
|
.max_xit = 9990,
|
|
|
|
.max_ifshift = 10000,
|
|
|
|
.priv = NULL, /* priv */
|
|
|
|
|
|
|
|
.extlevels = dummy_ext_levels,
|
|
|
|
.extparms = dummy_ext_parms,
|
|
|
|
.cfgparams = dummy_cfg_params,
|
|
|
|
|
|
|
|
.rig_init = dummy_init,
|
|
|
|
.rig_cleanup = dummy_cleanup,
|
|
|
|
.rig_open = dummy_open,
|
|
|
|
.rig_close = dummy_close,
|
|
|
|
|
|
|
|
.set_conf = dummy_set_conf,
|
|
|
|
.get_conf = dummy_get_conf,
|
|
|
|
|
|
|
|
.set_freq = dummy_set_freq,
|
|
|
|
.get_freq = dummy_get_freq,
|
|
|
|
.set_mode = dummy_set_mode,
|
|
|
|
.get_mode = dummy_get_mode,
|
|
|
|
.set_vfo = dummy_set_vfo,
|
|
|
|
.get_vfo = dummy_get_vfo,
|
|
|
|
|
|
|
|
.set_powerstat = dummy_set_powerstat,
|
|
|
|
.get_powerstat = dummy_get_powerstat,
|
|
|
|
.set_level = dummy_set_level,
|
|
|
|
.get_level = dummy_get_level,
|
|
|
|
.set_func = dummy_set_func,
|
|
|
|
.get_func = dummy_get_func,
|
|
|
|
.set_parm = dummy_set_parm,
|
|
|
|
.get_parm = dummy_get_parm,
|
|
|
|
.set_ext_level = dummy_set_ext_level,
|
|
|
|
.get_ext_level = dummy_get_ext_level,
|
|
|
|
.set_ext_parm = dummy_set_ext_parm,
|
|
|
|
.get_ext_parm = dummy_get_ext_parm,
|
|
|
|
|
|
|
|
.get_info = dummy_get_info,
|
|
|
|
|
|
|
|
|
|
|
|
.set_ptt = dummy_set_ptt,
|
|
|
|
.get_ptt = dummy_get_ptt,
|
|
|
|
.get_dcd = dummy_get_dcd,
|
|
|
|
.set_rptr_shift = dummy_set_rptr_shift,
|
|
|
|
.get_rptr_shift = dummy_get_rptr_shift,
|
|
|
|
.set_rptr_offs = dummy_set_rptr_offs,
|
|
|
|
.get_rptr_offs = dummy_get_rptr_offs,
|
|
|
|
.set_ctcss_tone = dummy_set_ctcss_tone,
|
|
|
|
.get_ctcss_tone = dummy_get_ctcss_tone,
|
|
|
|
.set_dcs_code = dummy_set_dcs_code,
|
|
|
|
.get_dcs_code = dummy_get_dcs_code,
|
|
|
|
.set_ctcss_sql = dummy_set_ctcss_sql,
|
|
|
|
.get_ctcss_sql = dummy_get_ctcss_sql,
|
|
|
|
.set_dcs_sql = dummy_set_dcs_sql,
|
|
|
|
.get_dcs_sql = dummy_get_dcs_sql,
|
|
|
|
.set_split_freq = dummy_set_split_freq,
|
|
|
|
.get_split_freq = dummy_get_split_freq,
|
|
|
|
.set_split_mode = dummy_set_split_mode,
|
|
|
|
.get_split_mode = dummy_get_split_mode,
|
|
|
|
.set_split_vfo = dummy_set_split_vfo,
|
|
|
|
.get_split_vfo = dummy_get_split_vfo,
|
|
|
|
.set_rit = dummy_set_rit,
|
|
|
|
.get_rit = dummy_get_rit,
|
|
|
|
.set_xit = dummy_set_xit,
|
|
|
|
.get_xit = dummy_get_xit,
|
|
|
|
.set_ts = dummy_set_ts,
|
|
|
|
.get_ts = dummy_get_ts,
|
|
|
|
.set_ant = dummy_set_ant,
|
|
|
|
.get_ant = dummy_get_ant,
|
|
|
|
.set_bank = dummy_set_bank,
|
|
|
|
.set_mem = dummy_set_mem,
|
|
|
|
.get_mem = dummy_get_mem,
|
|
|
|
.vfo_op = dummy_vfo_op,
|
|
|
|
.scan = dummy_scan,
|
|
|
|
.send_dtmf = dummy_send_dtmf,
|
|
|
|
.recv_dtmf = dummy_recv_dtmf,
|
|
|
|
.send_morse = dummy_send_morse,
|
|
|
|
.set_channel = dummy_set_channel,
|
|
|
|
.get_channel = dummy_get_channel,
|
|
|
|
.set_trn = dummy_set_trn,
|
|
|
|
.get_trn = dummy_get_trn,
|
|
|
|
.power2mW = dummy_power2mW,
|
|
|
|
.mW2power = dummy_mW2power,
|
2001-02-14 00:59:02 +00:00
|
|
|
};
|
|
|
|
|
2003-04-16 22:30:43 +00:00
|
|
|
DECLARE_INITRIG_BACKEND(dummy)
|
2001-02-14 00:59:02 +00:00
|
|
|
{
|
2019-11-30 16:19:08 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: _init called\n", __func__);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
rig_register(&dummy_caps);
|
|
|
|
rig_register(&netrigctl_caps);
|
|
|
|
rig_register(&flrig_caps);
|
|
|
|
rig_register(&trxmanager_caps);
|
2001-02-14 00:59:02 +00:00
|
|
|
|
2019-10-30 03:27:12 +00:00
|
|
|
return RIG_OK;
|
2001-02-14 00:59:02 +00:00
|
|
|
}
|