kopia lustrzana https://github.com/Hamlib/Hamlib
added "extra" level and "extra" parm support
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1111 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.1.4
rodzic
27b67a82da
commit
e8403d542d
|
@ -2,7 +2,7 @@
|
||||||
* Hamlib Interface - API header
|
* Hamlib Interface - API header
|
||||||
* Copyright (c) 2000-2002 by Stephane Fillod and Frank Singleton
|
* Copyright (c) 2000-2002 by Stephane Fillod and Frank Singleton
|
||||||
*
|
*
|
||||||
* $Id: rig.h,v 1.66 2002-07-08 22:20:08 fillods Exp $
|
* $Id: rig.h,v 1.67 2002-07-09 20:40:28 fillods Exp $
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Library General Public License as
|
* it under the terms of the GNU Library General Public License as
|
||||||
|
@ -435,6 +435,7 @@ enum meter_level_e {
|
||||||
union value_u {
|
union value_u {
|
||||||
signed int i;
|
signed int i;
|
||||||
float f;
|
float f;
|
||||||
|
char *s;
|
||||||
};
|
};
|
||||||
typedef union value_u value_t;
|
typedef union value_u value_t;
|
||||||
|
|
||||||
|
@ -542,6 +543,7 @@ typedef unsigned long long setting_t; /* hope 64 bits will be enough.. */
|
||||||
#define RIG_FUNC_SATMODE (1<<26) /* Satellite mode ON/OFF (IC-910H) */
|
#define RIG_FUNC_SATMODE (1<<26) /* Satellite mode ON/OFF (IC-910H) */
|
||||||
#define RIG_FUNC_SCOPE (1<<27) /* Simple bandscope ON/OFF (IC-910H) */
|
#define RIG_FUNC_SCOPE (1<<27) /* Simple bandscope ON/OFF (IC-910H) */
|
||||||
#define RIG_FUNC_RESUME (1<<28) /* Scan resume */
|
#define RIG_FUNC_RESUME (1<<28) /* Scan resume */
|
||||||
|
#define RIG_FUNC_TBURST (1<<29) /* 1750 Hz tone burst */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -630,6 +632,14 @@ struct filter_list {
|
||||||
#define RIG_CHFLAG_NONE 0
|
#define RIG_CHFLAG_NONE 0
|
||||||
#define RIG_CHFLAG_SKIP (1<<0)
|
#define RIG_CHFLAG_SKIP (1<<0)
|
||||||
|
|
||||||
|
struct ext_list {
|
||||||
|
token_t token;
|
||||||
|
value_t val;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define RIG_EXT_END {0, {i:0}}
|
||||||
|
#define RIG_IS_EXT_END(x) ((x).token == 0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convenience struct, describes a freq/vfo/mode combo
|
* Convenience struct, describes a freq/vfo/mode combo
|
||||||
* Also useful for memory handling -- FS
|
* Also useful for memory handling -- FS
|
||||||
|
@ -663,6 +673,7 @@ struct channel {
|
||||||
int scan_group;
|
int scan_group;
|
||||||
int flags; /* RIG_CHFLAG's */
|
int flags; /* RIG_CHFLAG's */
|
||||||
char channel_desc[MAXCHANDESC];
|
char channel_desc[MAXCHANDESC];
|
||||||
|
struct ext_list *ext_levels;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct channel channel_t;
|
typedef struct channel channel_t;
|
||||||
|
@ -753,6 +764,9 @@ struct rig_caps {
|
||||||
int level_gran[RIG_SETTING_MAX];
|
int level_gran[RIG_SETTING_MAX];
|
||||||
int parm_gran[RIG_SETTING_MAX];
|
int parm_gran[RIG_SETTING_MAX];
|
||||||
|
|
||||||
|
const struct confparams *extparms; /* apply to whole rig */
|
||||||
|
const struct confparams *extlevels; /* specific to a VFO */
|
||||||
|
|
||||||
const tone_t *ctcss_list;
|
const tone_t *ctcss_list;
|
||||||
const tone_t *dcs_list;
|
const tone_t *dcs_list;
|
||||||
|
|
||||||
|
@ -884,6 +898,12 @@ struct rig_caps {
|
||||||
int (*set_parm) (RIG * rig, setting_t parm, value_t val);
|
int (*set_parm) (RIG * rig, setting_t parm, value_t val);
|
||||||
int (*get_parm) (RIG * rig, setting_t parm, value_t * val);
|
int (*get_parm) (RIG * rig, setting_t parm, value_t * val);
|
||||||
|
|
||||||
|
int (*set_ext_level)(RIG *rig, vfo_t vfo, token_t token, value_t val);
|
||||||
|
int (*get_ext_level)(RIG *rig, vfo_t vfo, token_t token, value_t *val);
|
||||||
|
|
||||||
|
int (*set_ext_parm)(RIG *rig, token_t token, value_t val);
|
||||||
|
int (*get_ext_parm)(RIG *rig, token_t token, value_t *val);
|
||||||
|
|
||||||
int (*set_conf) (RIG * rig, token_t token, const char *val);
|
int (*set_conf) (RIG * rig, token_t token, const char *val);
|
||||||
int (*get_conf) (RIG * rig, token_t token, char *val);
|
int (*get_conf) (RIG * rig, token_t token, char *val);
|
||||||
|
|
||||||
|
@ -1152,6 +1172,19 @@ extern HAMLIB_EXPORT(int) rig_get_powerstat HAMLIB_PARAMS((RIG *rig, powerstat_t
|
||||||
|
|
||||||
extern HAMLIB_EXPORT(int) rig_reset HAMLIB_PARAMS((RIG *rig, reset_t reset)); /* dangerous! */
|
extern HAMLIB_EXPORT(int) rig_reset HAMLIB_PARAMS((RIG *rig, reset_t reset)); /* dangerous! */
|
||||||
|
|
||||||
|
extern HAMLIB_EXPORT(int) rig_set_ext_level HAMLIB_PARAMS((RIG *rig, vfo_t vfo,
|
||||||
|
token_t token, value_t val));
|
||||||
|
extern HAMLIB_EXPORT(int) rig_get_ext_level HAMLIB_PARAMS((RIG *rig, vfo_t vfo,
|
||||||
|
token_t token, value_t *val));
|
||||||
|
|
||||||
|
extern HAMLIB_EXPORT(int) rig_set_ext_parm HAMLIB_PARAMS((RIG *rig, token_t token, value_t val));
|
||||||
|
extern HAMLIB_EXPORT(int) rig_get_ext_parm HAMLIB_PARAMS((RIG *rig, token_t token, value_t *val));
|
||||||
|
|
||||||
|
extern HAMLIB_EXPORT(int) rig_ext_level_foreach HAMLIB_PARAMS((RIG *rig, int (*cfunc)(RIG*, const struct confparams *, rig_ptr_t), rig_ptr_t data));
|
||||||
|
extern HAMLIB_EXPORT(int) rig_ext_parm_foreach HAMLIB_PARAMS((RIG *rig, int (*cfunc)(RIG*, const struct confparams *, rig_ptr_t), rig_ptr_t data));
|
||||||
|
extern HAMLIB_EXPORT(const struct confparams*) rig_ext_lookup HAMLIB_PARAMS((RIG *rig, const char *name));
|
||||||
|
extern HAMLIB_EXPORT(token_t) rig_ext_token_lookup HAMLIB_PARAMS((RIG *rig, const char *name));
|
||||||
|
|
||||||
|
|
||||||
extern HAMLIB_EXPORT(int) rig_token_foreach HAMLIB_PARAMS((RIG *rig, int (*cfunc)(const struct confparams *, rig_ptr_t), rig_ptr_t data));
|
extern HAMLIB_EXPORT(int) rig_token_foreach HAMLIB_PARAMS((RIG *rig, int (*cfunc)(const struct confparams *, rig_ptr_t), rig_ptr_t data));
|
||||||
extern HAMLIB_EXPORT(const struct confparams*) rig_confparam_lookup HAMLIB_PARAMS((RIG *rig, const char *name));
|
extern HAMLIB_EXPORT(const struct confparams*) rig_confparam_lookup HAMLIB_PARAMS((RIG *rig, const char *name));
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
INCLUDES = @INCLUDES@ @INCLTDL@
|
INCLUDES = @INCLUDES@ @INCLTDL@
|
||||||
RIGSRC = rig.c serial.c misc.c register.c event.c cal.c conf.c tones.c \
|
RIGSRC = rig.c serial.c misc.c register.c event.c cal.c conf.c tones.c \
|
||||||
rotator.c locator.c rot_reg.c rot_conf.c iofunc.c
|
rotator.c locator.c rot_reg.c rot_conf.c iofunc.c ext.c
|
||||||
|
|
||||||
lib_LTLIBRARIES = libhamlib.la
|
lib_LTLIBRARIES = libhamlib.la
|
||||||
libhamlib_la_SOURCES = $(RIGSRC)
|
libhamlib_la_SOURCES = $(RIGSRC)
|
||||||
|
|
144
src/rig.c
144
src/rig.c
|
@ -13,7 +13,7 @@
|
||||||
* Hamlib Interface - main file
|
* Hamlib Interface - main file
|
||||||
* Copyright (c) 2000-2002 by Stephane Fillod and Frank Singleton
|
* Copyright (c) 2000-2002 by Stephane Fillod and Frank Singleton
|
||||||
*
|
*
|
||||||
* $Id: rig.c,v 1.58 2002-03-18 22:59:30 fillods Exp $
|
* $Id: rig.c,v 1.59 2002-07-09 20:40:28 fillods Exp $
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Library General Public License as
|
* it under the terms of the GNU Library General Public License as
|
||||||
|
@ -2987,6 +2987,148 @@ int rig_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief set a radio level extra parameter
|
||||||
|
* \param rig The rig handle
|
||||||
|
* \param vfo The target VFO
|
||||||
|
* \param token The parameter
|
||||||
|
* \param val The value to set the parameter to
|
||||||
|
*
|
||||||
|
* Sets an level extra parameter.
|
||||||
|
*
|
||||||
|
* \return RIG_OK if the operation has been sucessful, otherwise
|
||||||
|
* a negative value if an error occured (in which case, cause is
|
||||||
|
* set appropriately).
|
||||||
|
*
|
||||||
|
* \sa rig_get_ext_level()
|
||||||
|
*/
|
||||||
|
int rig_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val)
|
||||||
|
{
|
||||||
|
const struct rig_caps *caps;
|
||||||
|
int retcode;
|
||||||
|
vfo_t curr_vfo;
|
||||||
|
|
||||||
|
if (CHECK_RIG_ARG(rig))
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
|
||||||
|
caps = rig->caps;
|
||||||
|
|
||||||
|
if (caps->set_ext_level == NULL)
|
||||||
|
return -RIG_ENAVAIL;
|
||||||
|
|
||||||
|
if ((caps->targetable_vfo&RIG_TARGETABLE_ALL) ||
|
||||||
|
vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo)
|
||||||
|
return caps->set_ext_level(rig, vfo, token, val);
|
||||||
|
|
||||||
|
if (!caps->set_vfo)
|
||||||
|
return -RIG_ENTARGET;
|
||||||
|
curr_vfo = rig->state.current_vfo;
|
||||||
|
retcode = caps->set_vfo(rig, vfo);
|
||||||
|
if (retcode != RIG_OK)
|
||||||
|
return retcode;
|
||||||
|
|
||||||
|
retcode = caps->set_ext_level(rig, vfo, token, val);
|
||||||
|
caps->set_vfo(rig, curr_vfo);
|
||||||
|
return retcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief get the value of a level extra parameter
|
||||||
|
* \param rig The rig handle
|
||||||
|
* \param vfo The target VFO
|
||||||
|
* \param token The parameter
|
||||||
|
* \param val The location where to store the value of \a token
|
||||||
|
*
|
||||||
|
* Retrieves the value of a level extra paramter associated with \a token.
|
||||||
|
*
|
||||||
|
* \return RIG_OK if the operation has been sucessful, otherwise
|
||||||
|
* a negative value if an error occured (in which case, cause is
|
||||||
|
* set appropriately).
|
||||||
|
*
|
||||||
|
* \sa rig_set_ext_level()
|
||||||
|
*/
|
||||||
|
int rig_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val)
|
||||||
|
{
|
||||||
|
const struct rig_caps *caps;
|
||||||
|
int retcode;
|
||||||
|
vfo_t curr_vfo;
|
||||||
|
|
||||||
|
if (CHECK_RIG_ARG(rig) || !val)
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
|
||||||
|
caps = rig->caps;
|
||||||
|
|
||||||
|
if (caps->get_ext_level == NULL)
|
||||||
|
return -RIG_ENAVAIL;
|
||||||
|
|
||||||
|
if ((caps->targetable_vfo&RIG_TARGETABLE_ALL) ||
|
||||||
|
vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo)
|
||||||
|
return caps->get_ext_level(rig, vfo, token, val);
|
||||||
|
|
||||||
|
if (!caps->set_vfo)
|
||||||
|
return -RIG_ENTARGET;
|
||||||
|
curr_vfo = rig->state.current_vfo;
|
||||||
|
retcode = caps->set_vfo(rig, vfo);
|
||||||
|
if (retcode != RIG_OK)
|
||||||
|
return retcode;
|
||||||
|
|
||||||
|
retcode = caps->get_ext_level(rig, vfo, token, val);
|
||||||
|
caps->set_vfo(rig, curr_vfo);
|
||||||
|
return retcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief set a radio parm extra parameter
|
||||||
|
* \param rig The rig handle
|
||||||
|
* \param token The parameter
|
||||||
|
* \param val The value to set the parameter to
|
||||||
|
*
|
||||||
|
* Sets an parm extra parameter.
|
||||||
|
*
|
||||||
|
* \return RIG_OK if the operation has been sucessful, otherwise
|
||||||
|
* a negative value if an error occured (in which case, cause is
|
||||||
|
* set appropriately).
|
||||||
|
*
|
||||||
|
* \sa rig_get_ext_parm()
|
||||||
|
*/
|
||||||
|
int rig_set_ext_parm(RIG *rig, token_t token, value_t val)
|
||||||
|
{
|
||||||
|
if (CHECK_RIG_ARG(rig))
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
|
||||||
|
if (rig->caps->set_ext_parm == NULL)
|
||||||
|
return -RIG_ENAVAIL;
|
||||||
|
|
||||||
|
return rig->caps->set_ext_parm(rig, token, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief get the value of a parm extra parameter
|
||||||
|
* \param rig The rig handle
|
||||||
|
* \param token The parameter
|
||||||
|
* \param val The location where to store the value of \a token
|
||||||
|
*
|
||||||
|
* Retrieves the value of a parm extra paramter associated with \a token.
|
||||||
|
*
|
||||||
|
* \return RIG_OK if the operation has been sucessful, otherwise
|
||||||
|
* a negative value if an error occured (in which case, cause is
|
||||||
|
* set appropriately).
|
||||||
|
*
|
||||||
|
* \sa rig_set_ext_parm()
|
||||||
|
*/
|
||||||
|
int rig_get_ext_parm(RIG *rig, token_t token, value_t *val)
|
||||||
|
{
|
||||||
|
if (CHECK_RIG_ARG(rig) || !val)
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
|
||||||
|
if (rig->caps->get_ext_parm == NULL)
|
||||||
|
return -RIG_ENAVAIL;
|
||||||
|
|
||||||
|
return rig->caps->get_ext_parm(rig, token, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief set a radio configuration parameter
|
* \brief set a radio configuration parameter
|
||||||
* \param rig The rig handle
|
* \param rig The rig handle
|
||||||
|
|
123
tests/rigctl.c
123
tests/rigctl.c
|
@ -5,7 +5,7 @@
|
||||||
* It takes commands in interactive mode as well as
|
* It takes commands in interactive mode as well as
|
||||||
* from command line options.
|
* from command line options.
|
||||||
*
|
*
|
||||||
* $Id: rigctl.c,v 1.30 2002-06-26 20:44:37 dedmons Exp $
|
* $Id: rigctl.c,v 1.31 2002-07-09 20:40:28 fillods Exp $
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -607,7 +607,6 @@ static int print_conf_list(const struct confparams *cfp, rig_ptr_t data)
|
||||||
printf(", %s", cfp->u.c.combostr[i]);
|
printf(", %s", cfp->u.c.combostr[i]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1; /* !=0, we want them all ! */
|
return 1; /* !=0, we want them all ! */
|
||||||
|
@ -976,13 +975,43 @@ declare_proto_rig(power2mW)
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* RIG_CONF_ extparm's type:
|
||||||
|
* NUMERIC: val.f
|
||||||
|
* COMBO: val.i, starting from 0
|
||||||
|
* STRING: val.s
|
||||||
|
* CHECKBUTTON: val.i 0/1
|
||||||
|
*/
|
||||||
declare_proto_rig(set_level)
|
declare_proto_rig(set_level)
|
||||||
{
|
{
|
||||||
setting_t level;
|
setting_t level;
|
||||||
value_t val;
|
value_t val;
|
||||||
|
|
||||||
level = parse_level(arg1);
|
level = parse_level(arg1);
|
||||||
|
if (!rig_has_set_level(rig, level)) {
|
||||||
|
const struct confparams *cfp;
|
||||||
|
|
||||||
|
cfp = rig_ext_lookup(rig, arg1);
|
||||||
|
if (!cfp)
|
||||||
|
return -RIG_EINVAL; /* no such parameter */
|
||||||
|
|
||||||
|
switch (cfp->type) {
|
||||||
|
case RIG_CONF_CHECKBUTTON:
|
||||||
|
case RIG_CONF_COMBO:
|
||||||
|
sscanf(arg2, "%d", &val.i);
|
||||||
|
break;
|
||||||
|
case RIG_CONF_NUMERIC:
|
||||||
|
sscanf(arg2, "%f", &val.f);
|
||||||
|
break;
|
||||||
|
case RIG_CONF_STRING:
|
||||||
|
val.s = arg2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -RIG_ECONF;
|
||||||
|
}
|
||||||
|
return rig_set_ext_level(rig, RIG_VFO_CURR, cfp->token, val);
|
||||||
|
}
|
||||||
|
|
||||||
if (RIG_LEVEL_IS_FLOAT(level))
|
if (RIG_LEVEL_IS_FLOAT(level))
|
||||||
sscanf(arg2, "%f", &val.f);
|
sscanf(arg2, "%f", &val.f);
|
||||||
else
|
else
|
||||||
|
@ -999,6 +1028,37 @@ declare_proto_rig(get_level)
|
||||||
value_t val;
|
value_t val;
|
||||||
|
|
||||||
level = parse_level(arg1);
|
level = parse_level(arg1);
|
||||||
|
if (!rig_has_get_level(rig, level)) {
|
||||||
|
const struct confparams *cfp;
|
||||||
|
|
||||||
|
cfp = rig_ext_lookup(rig, arg1);
|
||||||
|
if (!cfp)
|
||||||
|
return -RIG_EINVAL; /* no such parameter */
|
||||||
|
|
||||||
|
status = rig_get_ext_level(rig, RIG_VFO_CURR, cfp->token, &val);
|
||||||
|
if (status != RIG_OK)
|
||||||
|
return status;
|
||||||
|
|
||||||
|
if (interactive)
|
||||||
|
printf("%s: ", cmd->arg2);
|
||||||
|
|
||||||
|
switch (cfp->type) {
|
||||||
|
case RIG_CONF_CHECKBUTTON:
|
||||||
|
case RIG_CONF_COMBO:
|
||||||
|
printf("%d\n", val.i);
|
||||||
|
break;
|
||||||
|
case RIG_CONF_NUMERIC:
|
||||||
|
printf("%f\n", val.f);
|
||||||
|
break;
|
||||||
|
case RIG_CONF_STRING:
|
||||||
|
printf("%s\n", val.s);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -RIG_ECONF;
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
status = rig_get_level(rig, RIG_VFO_CURR, level, &val);
|
status = rig_get_level(rig, RIG_VFO_CURR, level, &val);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
|
@ -1008,7 +1068,6 @@ declare_proto_rig(get_level)
|
||||||
printf("%f\n", val.f);
|
printf("%f\n", val.f);
|
||||||
else
|
else
|
||||||
printf("%d\n", val.i);
|
printf("%d\n", val.i);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1046,6 +1105,31 @@ declare_proto_rig(set_parm)
|
||||||
value_t val;
|
value_t val;
|
||||||
|
|
||||||
parm = parse_parm(arg1);
|
parm = parse_parm(arg1);
|
||||||
|
|
||||||
|
if (!rig_has_set_parm(rig, parm)) {
|
||||||
|
const struct confparams *cfp;
|
||||||
|
|
||||||
|
cfp = rig_ext_lookup(rig, arg1);
|
||||||
|
if (!cfp)
|
||||||
|
return -RIG_EINVAL; /* no such parameter */
|
||||||
|
|
||||||
|
switch (cfp->type) {
|
||||||
|
case RIG_CONF_CHECKBUTTON:
|
||||||
|
case RIG_CONF_COMBO:
|
||||||
|
sscanf(arg2, "%d", &val.i);
|
||||||
|
break;
|
||||||
|
case RIG_CONF_NUMERIC:
|
||||||
|
sscanf(arg2, "%f", &val.f);
|
||||||
|
break;
|
||||||
|
case RIG_CONF_STRING:
|
||||||
|
val.s = arg2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -RIG_ECONF;
|
||||||
|
}
|
||||||
|
return rig_set_ext_parm(rig, cfp->token, val);
|
||||||
|
}
|
||||||
|
|
||||||
if (RIG_PARM_IS_FLOAT(parm))
|
if (RIG_PARM_IS_FLOAT(parm))
|
||||||
sscanf(arg2, "%f", &val.f);
|
sscanf(arg2, "%f", &val.f);
|
||||||
else
|
else
|
||||||
|
@ -1062,6 +1146,37 @@ declare_proto_rig(get_parm)
|
||||||
value_t val;
|
value_t val;
|
||||||
|
|
||||||
parm = parse_parm(arg1);
|
parm = parse_parm(arg1);
|
||||||
|
if (!rig_has_get_parm(rig, parm)) {
|
||||||
|
const struct confparams *cfp;
|
||||||
|
|
||||||
|
cfp = rig_ext_lookup(rig, arg1);
|
||||||
|
if (!cfp)
|
||||||
|
return -RIG_EINVAL; /* no such parameter */
|
||||||
|
|
||||||
|
status = rig_get_ext_parm(rig, cfp->token, &val);
|
||||||
|
if (status != RIG_OK)
|
||||||
|
return status;
|
||||||
|
|
||||||
|
if (interactive)
|
||||||
|
printf("%s: ", cmd->arg2);
|
||||||
|
|
||||||
|
switch (cfp->type) {
|
||||||
|
case RIG_CONF_CHECKBUTTON:
|
||||||
|
case RIG_CONF_COMBO:
|
||||||
|
printf("%d\n", val.i);
|
||||||
|
break;
|
||||||
|
case RIG_CONF_NUMERIC:
|
||||||
|
printf("%f\n", val.f);
|
||||||
|
break;
|
||||||
|
case RIG_CONF_STRING:
|
||||||
|
printf("%s\n", val.s);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -RIG_ECONF;
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
status = rig_get_parm(rig, parm, &val);
|
status = rig_get_parm(rig, parm, &val);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
Ładowanie…
Reference in New Issue