2002-11-04 22:22:30 +00:00
|
|
|
/**
|
2006-10-15 00:27:52 +00:00
|
|
|
* \addtogroup rig
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \file settings.c
|
2002-11-04 22:22:30 +00:00
|
|
|
* \brief func/level/parm interface
|
|
|
|
* \author Stephane Fillod
|
2010-03-05 18:48:40 +00:00
|
|
|
* \date 2000-2010
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
* Hamlib interface is a frontend implementing wrapper functions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Hamlib Interface - func/level/parm
|
2010-03-05 18:48:40 +00:00
|
|
|
* Copyright (c) 2000-2010 by Stephane Fillod
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
*
|
2011-08-22 01:07:57 +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.
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
2011-08-22 01:07:57 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2002-11-04 22:22:30 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2011-08-22 01:07:57 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
2011-08-22 01:07:57 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2002-11-04 22:22:30 +00:00
|
|
|
* License along with this library; if not, write to the Free Software
|
2011-08-22 01:07:57 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
2017-10-05 02:32:08 +00:00
|
|
|
# include "config.h"
|
2002-11-04 22:22:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
#include <hamlib/rig.h>
|
2003-11-16 17:14:44 +00:00
|
|
|
#include "cal.h"
|
2002-11-04 22:22:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef DOC_HIDDEN
|
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
# define CHECK_RIG_ARG(r) (!(r) || !(r)->caps || !(r)->state.comm_state)
|
2002-11-04 22:22:30 +00:00
|
|
|
|
|
|
|
#endif /* !DOC_HIDDEN */
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief set a radio level setting
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param vfo The target VFO
|
|
|
|
* \param level The level setting
|
|
|
|
* \param val The value to set the level setting to
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
* Sets the level of a setting.
|
|
|
|
* The level value \a val can be a float or an integer. See #value_t
|
|
|
|
* for more information.
|
|
|
|
*
|
Fix spelling errors
Fixed using the following command:
codespell --write-changes --summary --skip=*.m4 --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
codespell --write-changes --summary --skip=aclocal.m4,lib --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
Codespell home page: https://github.com/codespell-project/codespell
2020-07-24 07:02:12 +00:00
|
|
|
* \return RIG_OK if the operation has been successful, otherwise
|
|
|
|
* a negative value if an error occurred (in which case, cause is
|
2002-11-04 22:22:30 +00:00
|
|
|
* set appropriately).
|
|
|
|
*
|
|
|
|
* \sa rig_has_set_level(), rig_get_level()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
int HAMLIB_API rig_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
2002-11-04 22:22:30 +00:00
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
const struct rig_caps *caps;
|
|
|
|
int retcode;
|
|
|
|
vfo_t curr_vfo;
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (CHECK_RIG_ARG(rig))
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
caps = rig->caps;
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (caps->set_level == NULL || !rig_has_set_level(rig, level))
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_ENAVAIL;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2020-10-12 14:56:24 +00:00
|
|
|
if ((caps->targetable_vfo & RIG_TARGETABLE_LEVEL)
|
2019-11-30 16:19:08 +00:00
|
|
|
|| vfo == RIG_VFO_CURR
|
|
|
|
|| vfo == rig->state.current_vfo)
|
2017-10-05 02:32:08 +00:00
|
|
|
{
|
|
|
|
return caps->set_level(rig, vfo, level, val);
|
2017-08-05 14:09:12 +00:00
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (!caps->set_vfo)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_ENTARGET;
|
|
|
|
}
|
|
|
|
|
|
|
|
curr_vfo = rig->state.current_vfo;
|
|
|
|
retcode = caps->set_vfo(rig, vfo);
|
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (retcode != RIG_OK)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return retcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
retcode = caps->set_level(rig, vfo, level, val);
|
|
|
|
caps->set_vfo(rig, curr_vfo);
|
|
|
|
return retcode;
|
2002-11-04 22:22:30 +00:00
|
|
|
}
|
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2002-11-04 22:22:30 +00:00
|
|
|
/**
|
|
|
|
* \brief get the value of a level
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param vfo The target VFO
|
|
|
|
* \param level The level setting
|
|
|
|
* \param val The location where to store the value of \a level
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
* Retrieves the value of a \a level.
|
|
|
|
* The level value \a val can be a float or an integer. See #value_t
|
|
|
|
* for more information.
|
|
|
|
*
|
2017-08-05 14:09:12 +00:00
|
|
|
* RIG_LEVEL_STRENGTH: \a val is an integer, representing the S Meter
|
|
|
|
* level in dB relative to S9, according to the ideal S Meter scale.
|
|
|
|
* The ideal S Meter scale is as follow: S0=-54, S1=-48, S2=-42, S3=-36,
|
|
|
|
* S4=-30, S5=-24, S6=-18, S7=-12, S8=-6, S9=0, +10=10, +20=20,
|
Fix spelling errors
Fixed using the following command:
codespell --write-changes --summary --skip=*.m4 --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
codespell --write-changes --summary --skip=aclocal.m4,lib --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
Codespell home page: https://github.com/codespell-project/codespell
2020-07-24 07:02:12 +00:00
|
|
|
* +30=30, +40=40, +50=50 and +60=60. This is the responsibility
|
2017-08-05 14:09:12 +00:00
|
|
|
* of the backend to return values calibrated for this scale.
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
Fix spelling errors
Fixed using the following command:
codespell --write-changes --summary --skip=*.m4 --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
codespell --write-changes --summary --skip=aclocal.m4,lib --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
Codespell home page: https://github.com/codespell-project/codespell
2020-07-24 07:02:12 +00:00
|
|
|
* \return RIG_OK if the operation has been successful, otherwise
|
|
|
|
* a negative value if an error occurred (in which case, cause is
|
2002-11-04 22:22:30 +00:00
|
|
|
* set appropriately).
|
|
|
|
*
|
|
|
|
* \sa rig_has_get_level(), rig_set_level()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
int HAMLIB_API rig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
2002-11-04 22:22:30 +00:00
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
const struct rig_caps *caps;
|
|
|
|
int retcode;
|
|
|
|
vfo_t curr_vfo;
|
|
|
|
|
2020-04-03 20:22:07 +00:00
|
|
|
// too verbose
|
|
|
|
//rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (CHECK_RIG_ARG(rig) || !val)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
caps = rig->caps;
|
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (caps->get_level == NULL || !rig_has_get_level(rig, level))
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_ENAVAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Special case(frontend emulation): calibrated S-meter reading
|
|
|
|
*/
|
|
|
|
if (level == RIG_LEVEL_STRENGTH
|
2019-11-30 16:19:08 +00:00
|
|
|
&& (caps->has_get_level & RIG_LEVEL_STRENGTH) == 0
|
|
|
|
&& rig_has_get_level(rig, RIG_LEVEL_RAWSTR)
|
|
|
|
&& rig->state.str_cal.size)
|
2017-10-05 02:32:08 +00:00
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
value_t rawstr;
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
retcode = rig_get_level(rig, vfo, RIG_LEVEL_RAWSTR, &rawstr);
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (retcode != RIG_OK)
|
|
|
|
{
|
|
|
|
return retcode;
|
|
|
|
}
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
val->i = (int)rig_raw2val(rawstr.i, &rig->state.str_cal);
|
|
|
|
return RIG_OK;
|
2017-08-05 14:09:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-12 14:56:24 +00:00
|
|
|
if ((caps->targetable_vfo & RIG_TARGETABLE_LEVEL)
|
2019-11-30 16:19:08 +00:00
|
|
|
|| vfo == RIG_VFO_CURR
|
|
|
|
|| vfo == rig->state.current_vfo)
|
2017-10-05 02:32:08 +00:00
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
return caps->get_level(rig, vfo, level, val);
|
2017-08-05 14:09:12 +00:00
|
|
|
}
|
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (!caps->set_vfo)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_ENTARGET;
|
|
|
|
}
|
|
|
|
|
|
|
|
curr_vfo = rig->state.current_vfo;
|
|
|
|
retcode = caps->set_vfo(rig, vfo);
|
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (retcode != RIG_OK)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return retcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
retcode = caps->get_level(rig, vfo, level, val);
|
|
|
|
caps->set_vfo(rig, curr_vfo);
|
|
|
|
return retcode;
|
2002-11-04 22:22:30 +00:00
|
|
|
}
|
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2002-11-04 22:22:30 +00:00
|
|
|
/**
|
|
|
|
* \brief set a radio parameter
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param parm The parameter
|
|
|
|
* \param val The value to set the parameter
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
2011-08-22 01:07:57 +00:00
|
|
|
* Sets a parameter.
|
2002-11-04 22:22:30 +00:00
|
|
|
* The parameter value \a val can be a float or an integer. See #value_t
|
|
|
|
* for more information.
|
|
|
|
*
|
Fix spelling errors
Fixed using the following command:
codespell --write-changes --summary --skip=*.m4 --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
codespell --write-changes --summary --skip=aclocal.m4,lib --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
Codespell home page: https://github.com/codespell-project/codespell
2020-07-24 07:02:12 +00:00
|
|
|
* \return RIG_OK if the operation has been successful, otherwise
|
|
|
|
* a negative value if an error occurred (in which case, cause is
|
2002-11-04 22:22:30 +00:00
|
|
|
* set appropriately).
|
|
|
|
*
|
|
|
|
* \sa rig_has_set_parm(), rig_get_parm()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
int HAMLIB_API rig_set_parm(RIG *rig, setting_t parm, value_t val)
|
2002-11-04 22:22:30 +00:00
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (CHECK_RIG_ARG(rig))
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (rig->caps->set_parm == NULL || !rig_has_set_parm(rig, parm))
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_ENAVAIL;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
return rig->caps->set_parm(rig, parm, val);
|
2002-11-04 22:22:30 +00:00
|
|
|
}
|
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2002-11-04 22:22:30 +00:00
|
|
|
/**
|
|
|
|
* \brief get the value of a parameter
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param parm The parameter
|
|
|
|
* \param val The location where to store the value of \a parm
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
* Retrieves the value of a \a parm.
|
|
|
|
* The parameter value \a val can be a float or an integer. See #value_t
|
|
|
|
* for more information.
|
|
|
|
*
|
Fix spelling errors
Fixed using the following command:
codespell --write-changes --summary --skip=*.m4 --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
codespell --write-changes --summary --skip=aclocal.m4,lib --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
Codespell home page: https://github.com/codespell-project/codespell
2020-07-24 07:02:12 +00:00
|
|
|
* \return RIG_OK if the operation has been successful, otherwise
|
|
|
|
* a negative value if an error occurred (in which case, cause is
|
2002-11-04 22:22:30 +00:00
|
|
|
* set appropriately).
|
|
|
|
*
|
|
|
|
* \sa rig_has_get_parm(), rig_set_parm()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
int HAMLIB_API rig_get_parm(RIG *rig, setting_t parm, value_t *val)
|
2002-11-04 22:22:30 +00:00
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (CHECK_RIG_ARG(rig) || !val)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (rig->caps->get_parm == NULL || !rig_has_get_parm(rig, parm))
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_ENAVAIL;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
return rig->caps->get_parm(rig, parm, val);
|
2002-11-04 22:22:30 +00:00
|
|
|
}
|
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2002-11-04 22:22:30 +00:00
|
|
|
/**
|
|
|
|
* \brief check retrieval ability of level settings
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param level The level settings
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
* Checks if a rig is capable of *getting* a level setting.
|
|
|
|
* Since the \a level is an OR'ed bitwise argument, more than
|
|
|
|
* one level can be checked at the same time.
|
|
|
|
*
|
2017-08-05 14:09:12 +00:00
|
|
|
* EXAMPLE: if (rig_has_get_level(my_rig, RIG_LVL_STRENGTH)) disp_Smeter();
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
* \return a bit map of supported level settings that can be retrieved,
|
|
|
|
* otherwise 0 if none supported.
|
|
|
|
*
|
|
|
|
* \sa rig_has_set_level(), rig_get_level()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
setting_t HAMLIB_API rig_has_get_level(RIG *rig, setting_t level)
|
2002-11-04 22:22:30 +00:00
|
|
|
{
|
2020-04-03 20:22:07 +00:00
|
|
|
// too verbose
|
|
|
|
//rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (!rig || !rig->caps)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
return (rig->state.has_get_level & level);
|
2002-11-04 22:22:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief check settable ability of level settings
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param level The level settings
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
* Checks if a rig can *set* a level setting.
|
|
|
|
* Since the \a level is an OR'ed bitwise argument, more than
|
|
|
|
* one level can be check at the same time.
|
|
|
|
*
|
2017-08-05 14:09:12 +00:00
|
|
|
* EXAMPLE: if (rig_has_set_level(my_rig, RIG_LVL_RFPOWER)) crank_tx();
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
* \return a bit map of supported level settings that can be set,
|
|
|
|
* otherwise 0 if none supported.
|
|
|
|
*
|
|
|
|
* \sa rig_has_get_level(), rig_set_level()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
setting_t HAMLIB_API rig_has_set_level(RIG *rig, setting_t level)
|
2002-11-04 22:22:30 +00:00
|
|
|
{
|
2020-04-03 20:22:07 +00:00
|
|
|
// too verbose
|
|
|
|
//rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (!rig || !rig->caps)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (rig->state.has_set_level & level);
|
2002-11-04 22:22:30 +00:00
|
|
|
}
|
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2002-11-04 22:22:30 +00:00
|
|
|
/**
|
|
|
|
* \brief check retrieval ability of parameter settings
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param parm The parameter settings
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
* Checks if a rig is capable of *getting* a parm setting.
|
|
|
|
* Since the \a parm is an OR'ed bitwise argument, more than
|
|
|
|
* one parameter can be checked at the same time.
|
|
|
|
*
|
2017-08-05 14:09:12 +00:00
|
|
|
* EXAMPLE: if (rig_has_get_parm(my_rig, RIG_PARM_ANN)) good4you();
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
* \return a bit map of supported parameter settings that can be retrieved,
|
|
|
|
* otherwise 0 if none supported.
|
|
|
|
*
|
|
|
|
* \sa rig_has_set_parm(), rig_get_parm()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
setting_t HAMLIB_API rig_has_get_parm(RIG *rig, setting_t parm)
|
2002-11-04 22:22:30 +00:00
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (!rig || !rig->caps)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (rig->state.has_get_parm & parm);
|
2002-11-04 22:22:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief check settable ability of parameter settings
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param parm The parameter settings
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
* Checks if a rig can *set* a parameter setting.
|
|
|
|
* Since the \a parm is an OR'ed bitwise argument, more than
|
|
|
|
* one parameter can be check at the same time.
|
|
|
|
*
|
2017-08-05 14:09:12 +00:00
|
|
|
* EXAMPLE: if (rig_has_set_parm(my_rig, RIG_PARM_ANN)) announce_all();
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
* \return a bit map of supported parameter settings that can be set,
|
|
|
|
* otherwise 0 if none supported.
|
|
|
|
*
|
|
|
|
* \sa rig_has_get_parm(), rig_set_parm()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
setting_t HAMLIB_API rig_has_set_parm(RIG *rig, setting_t parm)
|
2002-11-04 22:22:30 +00:00
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (!rig || !rig->caps)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
return (rig->state.has_set_parm & parm);
|
2002-11-04 22:22:30 +00:00
|
|
|
}
|
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2002-11-04 22:22:30 +00:00
|
|
|
/**
|
|
|
|
* \brief check ability of radio functions
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param func The functions
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
* Checks if a rig supports a set of functions.
|
|
|
|
* Since the \a func is an OR'ed bitwise argument, more than
|
|
|
|
* one function can be checked at the same time.
|
|
|
|
*
|
2017-08-05 14:09:12 +00:00
|
|
|
* EXAMPLE: if (rig_has_get_func(my_rig,RIG_FUNC_FAGC)) disp_fagc_button();
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
2011-08-22 01:07:57 +00:00
|
|
|
* \return a bit map of supported functions,
|
2002-11-04 22:22:30 +00:00
|
|
|
* otherwise 0 if none supported.
|
|
|
|
*
|
|
|
|
* \sa rig_has_set_func(), rig_get_func()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
setting_t HAMLIB_API rig_has_get_func(RIG *rig, setting_t func)
|
2002-11-04 22:22:30 +00:00
|
|
|
{
|
2020-04-03 20:22:07 +00:00
|
|
|
// too verbose
|
|
|
|
//rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (!rig || !rig->caps)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
return (rig->state.has_get_func & func);
|
2002-11-04 22:22:30 +00:00
|
|
|
}
|
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2002-11-04 22:22:30 +00:00
|
|
|
/**
|
|
|
|
* \brief check ability of radio functions
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param func The functions
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
* Checks if a rig supports a set of functions.
|
|
|
|
* Since the \a func is an OR'ed bitwise argument, more than
|
|
|
|
* one function can be checked at the same time.
|
|
|
|
*
|
2017-08-05 14:09:12 +00:00
|
|
|
* EXAMPLE: if (rig_has_set_func(my_rig,RIG_FUNC_FAGC)) disp_fagc_button();
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
2011-08-22 01:07:57 +00:00
|
|
|
* \return a bit map of supported functions,
|
2002-11-04 22:22:30 +00:00
|
|
|
* otherwise 0 if none supported.
|
|
|
|
*
|
|
|
|
* \sa rig_set_func(), rig_has_get_func()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
setting_t HAMLIB_API rig_has_set_func(RIG *rig, setting_t func)
|
2002-11-04 22:22:30 +00:00
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (!rig || !rig->caps)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
return (rig->state.has_set_func & func);
|
2002-11-04 22:22:30 +00:00
|
|
|
}
|
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2002-11-04 22:22:30 +00:00
|
|
|
/**
|
2007-11-26 20:54:12 +00:00
|
|
|
* \brief activate/de-activate functions of radio
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param vfo The target VFO
|
|
|
|
* \param func The functions to activate
|
|
|
|
* \param status The status (on or off) to set to
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
2007-11-26 20:54:12 +00:00
|
|
|
* Activate/de-activate a function of the radio.
|
2003-03-27 23:45:27 +00:00
|
|
|
*
|
2011-08-22 01:07:57 +00:00
|
|
|
* The \a status argument is a non null value for "activate",
|
2007-11-26 20:54:12 +00:00
|
|
|
* "de-activate" otherwise, much as TRUE/FALSE definitions in C language.
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
Fix spelling errors
Fixed using the following command:
codespell --write-changes --summary --skip=*.m4 --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
codespell --write-changes --summary --skip=aclocal.m4,lib --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
Codespell home page: https://github.com/codespell-project/codespell
2020-07-24 07:02:12 +00:00
|
|
|
* \return RIG_OK if the operation has been successful, otherwise
|
|
|
|
* a negative value if an error occurred (in which case, cause is
|
2002-11-04 22:22:30 +00:00
|
|
|
* set appropriately).
|
|
|
|
*
|
|
|
|
* \sa rig_get_func()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
int HAMLIB_API rig_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
|
2002-11-04 22:22:30 +00:00
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
const struct rig_caps *caps;
|
|
|
|
int retcode;
|
|
|
|
vfo_t curr_vfo;
|
|
|
|
|
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (CHECK_RIG_ARG(rig))
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
caps = rig->caps;
|
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (caps->set_func == NULL || !rig_has_set_func(rig, func))
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_ENAVAIL;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
if ((caps->targetable_vfo & RIG_TARGETABLE_FUNC)
|
2019-11-30 16:19:08 +00:00
|
|
|
|| vfo == RIG_VFO_CURR
|
|
|
|
|| vfo == rig->state.current_vfo)
|
2017-10-05 02:32:08 +00:00
|
|
|
{
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
return caps->set_func(rig, vfo, func, status);
|
2017-08-05 14:09:12 +00:00
|
|
|
}
|
2020-10-02 03:51:31 +00:00
|
|
|
else
|
|
|
|
{
|
2020-09-27 21:07:26 +00:00
|
|
|
int targetable = caps->targetable_vfo & RIG_TARGETABLE_FUNC;
|
2020-10-02 03:51:31 +00:00
|
|
|
rig_debug(RIG_DEBUG_TRACE, "%s: targetable=%d, vfo=%s, currvfo=%s\n", __func__,
|
|
|
|
targetable, rig_strvfo(vfo), rig_strvfo(rig->state.current_vfo));
|
2020-09-27 21:07:26 +00:00
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (!caps->set_vfo)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_ENTARGET;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
curr_vfo = rig->state.current_vfo;
|
|
|
|
retcode = caps->set_vfo(rig, vfo);
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (retcode != RIG_OK)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return retcode;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
retcode = caps->set_func(rig, vfo, func, status);
|
|
|
|
caps->set_vfo(rig, curr_vfo);
|
2017-10-05 02:32:08 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
return retcode;
|
2002-11-04 22:22:30 +00:00
|
|
|
}
|
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2002-11-04 22:22:30 +00:00
|
|
|
/**
|
|
|
|
* \brief get the status of functions of the radio
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param vfo The target VFO
|
|
|
|
* \param func The functions to get the status
|
|
|
|
* \param status The location where to store the function status
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
2003-03-27 23:45:27 +00:00
|
|
|
* Retrieves the status (on/off) of a function of the radio.
|
|
|
|
* Upon return, \a status will hold the status of the function,
|
2011-08-22 01:07:57 +00:00
|
|
|
* The value pointer to by the \a status argument is a non null
|
2007-11-26 20:54:12 +00:00
|
|
|
* value for "on", "off" otherwise, much as TRUE/FALSE
|
2003-03-27 23:45:27 +00:00
|
|
|
* definitions in C language.
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
Fix spelling errors
Fixed using the following command:
codespell --write-changes --summary --skip=*.m4 --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
codespell --write-changes --summary --skip=aclocal.m4,lib --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
Codespell home page: https://github.com/codespell-project/codespell
2020-07-24 07:02:12 +00:00
|
|
|
* \return RIG_OK if the operation has been successful, otherwise
|
|
|
|
* a negative value if an error occurred (in which case, cause is
|
2002-11-04 22:22:30 +00:00
|
|
|
* set appropriately).
|
|
|
|
*
|
|
|
|
* \sa rig_set_func()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
int HAMLIB_API rig_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
|
2002-11-04 22:22:30 +00:00
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
const struct rig_caps *caps;
|
|
|
|
int retcode;
|
|
|
|
vfo_t curr_vfo;
|
|
|
|
|
2020-04-03 20:22:07 +00:00
|
|
|
// too verbose
|
|
|
|
//rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (CHECK_RIG_ARG(rig) || !func)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
caps = rig->caps;
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (caps->get_func == NULL || !rig_has_get_func(rig, func))
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_ENAVAIL;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
if ((caps->targetable_vfo & RIG_TARGETABLE_FUNC)
|
2019-11-30 16:19:08 +00:00
|
|
|
|| vfo == RIG_VFO_CURR
|
|
|
|
|| vfo == rig->state.current_vfo)
|
2017-10-05 02:32:08 +00:00
|
|
|
{
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
return caps->get_func(rig, vfo, func, status);
|
2017-08-05 14:09:12 +00:00
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (!caps->set_vfo)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_ENTARGET;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
curr_vfo = rig->state.current_vfo;
|
|
|
|
retcode = caps->set_vfo(rig, vfo);
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (retcode != RIG_OK)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return retcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
retcode = caps->get_func(rig, vfo, func, status);
|
|
|
|
caps->set_vfo(rig, curr_vfo);
|
|
|
|
|
|
|
|
return retcode;
|
2002-11-04 22:22:30 +00:00
|
|
|
}
|
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2002-11-04 22:22:30 +00:00
|
|
|
/**
|
|
|
|
* \brief set a radio level extra parameter
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param vfo The target VFO
|
|
|
|
* \param token The parameter
|
|
|
|
* \param val The value to set the parameter to
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
2011-08-22 01:07:57 +00:00
|
|
|
* Sets an level extra parameter.
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
Fix spelling errors
Fixed using the following command:
codespell --write-changes --summary --skip=*.m4 --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
codespell --write-changes --summary --skip=aclocal.m4,lib --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
Codespell home page: https://github.com/codespell-project/codespell
2020-07-24 07:02:12 +00:00
|
|
|
* \return RIG_OK if the operation has been successful, otherwise
|
|
|
|
* a negative value if an error occurred (in which case, cause is
|
2002-11-04 22:22:30 +00:00
|
|
|
* set appropriately).
|
|
|
|
*
|
|
|
|
* \sa rig_get_ext_level()
|
|
|
|
*/
|
2017-10-05 02:32:08 +00:00
|
|
|
int HAMLIB_API rig_set_ext_level(RIG *rig,
|
|
|
|
vfo_t vfo,
|
|
|
|
token_t token,
|
2017-08-05 14:09:12 +00:00
|
|
|
value_t val)
|
2002-11-04 22:22:30 +00:00
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
const struct rig_caps *caps;
|
|
|
|
int retcode;
|
|
|
|
vfo_t curr_vfo;
|
|
|
|
|
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (CHECK_RIG_ARG(rig))
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
caps = rig->caps;
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (caps->set_ext_level == NULL)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_ENAVAIL;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2021-01-04 04:52:56 +00:00
|
|
|
if ((caps->targetable_vfo & RIG_TARGETABLE_LEVEL)
|
2019-11-30 16:19:08 +00:00
|
|
|
|| vfo == RIG_VFO_CURR
|
|
|
|
|| vfo == rig->state.current_vfo)
|
2017-10-05 02:32:08 +00:00
|
|
|
{
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
return caps->set_ext_level(rig, vfo, token, val);
|
2017-08-05 14:09:12 +00:00
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (!caps->set_vfo)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_ENTARGET;
|
|
|
|
}
|
|
|
|
|
|
|
|
curr_vfo = rig->state.current_vfo;
|
|
|
|
retcode = caps->set_vfo(rig, vfo);
|
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (retcode != RIG_OK)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return retcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
retcode = caps->set_ext_level(rig, vfo, token, val);
|
|
|
|
caps->set_vfo(rig, curr_vfo);
|
|
|
|
|
|
|
|
return retcode;
|
2002-11-04 22:22:30 +00:00
|
|
|
}
|
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2002-11-04 22:22:30 +00:00
|
|
|
/**
|
|
|
|
* \brief get the value of a level extra parameter
|
2017-08-05 14:09:12 +00:00
|
|
|
* \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
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
2007-11-26 20:54:12 +00:00
|
|
|
* Retrieves the value of a level extra parameter associated with \a token.
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
Fix spelling errors
Fixed using the following command:
codespell --write-changes --summary --skip=*.m4 --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
codespell --write-changes --summary --skip=aclocal.m4,lib --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
Codespell home page: https://github.com/codespell-project/codespell
2020-07-24 07:02:12 +00:00
|
|
|
* \return RIG_OK if the operation has been successful, otherwise
|
|
|
|
* a negative value if an error occurred (in which case, cause is
|
2002-11-04 22:22:30 +00:00
|
|
|
* set appropriately).
|
|
|
|
*
|
|
|
|
* \sa rig_set_ext_level()
|
|
|
|
*/
|
2017-10-05 02:32:08 +00:00
|
|
|
int HAMLIB_API rig_get_ext_level(RIG *rig,
|
|
|
|
vfo_t vfo,
|
|
|
|
token_t token,
|
2017-08-05 14:09:12 +00:00
|
|
|
value_t *val)
|
2002-11-04 22:22:30 +00:00
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
const struct rig_caps *caps;
|
|
|
|
int retcode;
|
|
|
|
vfo_t curr_vfo;
|
|
|
|
|
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (CHECK_RIG_ARG(rig) || !val)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
caps = rig->caps;
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (caps->get_ext_level == NULL)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_ENAVAIL;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2021-01-04 04:52:56 +00:00
|
|
|
if ((caps->targetable_vfo & RIG_TARGETABLE_LEVEL)
|
2019-11-30 16:19:08 +00:00
|
|
|
|| vfo == RIG_VFO_CURR
|
|
|
|
|| vfo == rig->state.current_vfo)
|
2017-10-05 02:32:08 +00:00
|
|
|
{
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
return caps->get_ext_level(rig, vfo, token, val);
|
2017-08-05 14:09:12 +00:00
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (!caps->set_vfo)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_ENTARGET;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
curr_vfo = rig->state.current_vfo;
|
|
|
|
retcode = caps->set_vfo(rig, vfo);
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (retcode != RIG_OK)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return retcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
retcode = caps->get_ext_level(rig, vfo, token, val);
|
|
|
|
caps->set_vfo(rig, curr_vfo);
|
|
|
|
|
|
|
|
return retcode;
|
2002-11-04 22:22:30 +00:00
|
|
|
}
|
|
|
|
|
2020-02-11 09:48:13 +00:00
|
|
|
/**
|
|
|
|
* \brief set a radio function extra parameter
|
|
|
|
* \param rig The rig handle
|
|
|
|
* \param vfo The target VFO
|
|
|
|
* \param token The parameter
|
|
|
|
* \param status The value to set the parameter to
|
|
|
|
*
|
|
|
|
* Sets a function extra parameter.
|
|
|
|
*
|
Fix spelling errors
Fixed using the following command:
codespell --write-changes --summary --skip=*.m4 --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
codespell --write-changes --summary --skip=aclocal.m4,lib --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
Codespell home page: https://github.com/codespell-project/codespell
2020-07-24 07:02:12 +00:00
|
|
|
* \return RIG_OK if the operation has been successful, otherwise
|
|
|
|
* a negative value if an error occurred (in which case, cause is
|
2020-02-11 09:48:13 +00:00
|
|
|
* set appropriately).
|
|
|
|
*
|
|
|
|
* \sa rig_get_ext_func()
|
|
|
|
*/
|
|
|
|
int HAMLIB_API rig_set_ext_func(RIG *rig,
|
2020-02-23 17:26:09 +00:00
|
|
|
vfo_t vfo,
|
|
|
|
token_t token,
|
|
|
|
int status)
|
2020-02-11 09:48:13 +00:00
|
|
|
{
|
|
|
|
const struct rig_caps *caps;
|
|
|
|
int retcode;
|
|
|
|
vfo_t curr_vfo;
|
|
|
|
|
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
|
|
|
|
|
|
|
if (CHECK_RIG_ARG(rig))
|
|
|
|
{
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
caps = rig->caps;
|
|
|
|
|
2020-09-16 19:33:39 +00:00
|
|
|
if (caps->set_ext_func == NULL)
|
2020-02-11 09:48:13 +00:00
|
|
|
{
|
|
|
|
return -RIG_ENAVAIL;
|
|
|
|
}
|
|
|
|
|
2021-01-04 04:52:56 +00:00
|
|
|
if ((caps->targetable_vfo & RIG_TARGETABLE_FUNC)
|
2020-02-11 09:48:13 +00:00
|
|
|
|| vfo == RIG_VFO_CURR
|
|
|
|
|| vfo == rig->state.current_vfo)
|
|
|
|
{
|
|
|
|
|
|
|
|
return caps->set_ext_func(rig, vfo, token, status);
|
|
|
|
}
|
|
|
|
|
|
|
|
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_func(rig, vfo, token, status);
|
|
|
|
caps->set_vfo(rig, curr_vfo);
|
|
|
|
|
|
|
|
return retcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief get the value of a function extra parameter
|
|
|
|
* \param rig The rig handle
|
|
|
|
* \param vfo The target VFO
|
|
|
|
* \param token The parameter
|
|
|
|
* \param status The location where to store the value of \a token
|
|
|
|
*
|
|
|
|
* Retrieves the value of a function extra parameter associated with \a token.
|
|
|
|
*
|
Fix spelling errors
Fixed using the following command:
codespell --write-changes --summary --skip=*.m4 --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
codespell --write-changes --summary --skip=aclocal.m4,lib --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
Codespell home page: https://github.com/codespell-project/codespell
2020-07-24 07:02:12 +00:00
|
|
|
* \return RIG_OK if the operation has been successful, otherwise
|
|
|
|
* a negative value if an error occurred (in which case, cause is
|
2020-02-11 09:48:13 +00:00
|
|
|
* set appropriately).
|
|
|
|
*
|
|
|
|
* \sa rig_set_ext_func()
|
|
|
|
*/
|
|
|
|
int HAMLIB_API rig_get_ext_func(RIG *rig,
|
2020-02-23 17:26:09 +00:00
|
|
|
vfo_t vfo,
|
|
|
|
token_t token,
|
|
|
|
int *status)
|
2020-02-11 09:48:13 +00:00
|
|
|
{
|
|
|
|
const struct rig_caps *caps;
|
|
|
|
int retcode;
|
|
|
|
vfo_t curr_vfo;
|
|
|
|
|
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
|
|
|
|
|
|
|
if (CHECK_RIG_ARG(rig) || !status)
|
|
|
|
{
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
caps = rig->caps;
|
|
|
|
|
|
|
|
if (caps->get_ext_func == NULL)
|
|
|
|
{
|
|
|
|
return -RIG_ENAVAIL;
|
|
|
|
}
|
|
|
|
|
2021-01-04 04:52:56 +00:00
|
|
|
if ((caps->targetable_vfo & RIG_TARGETABLE_FUNC)
|
2020-02-11 09:48:13 +00:00
|
|
|
|| vfo == RIG_VFO_CURR
|
|
|
|
|| vfo == rig->state.current_vfo)
|
|
|
|
{
|
|
|
|
|
|
|
|
return caps->get_ext_func(rig, vfo, token, status);
|
|
|
|
}
|
|
|
|
|
|
|
|
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_func(rig, vfo, token, status);
|
|
|
|
caps->set_vfo(rig, curr_vfo);
|
|
|
|
|
|
|
|
return retcode;
|
|
|
|
}
|
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2002-11-04 22:22:30 +00:00
|
|
|
/**
|
|
|
|
* \brief set a radio parm extra parameter
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param token The parameter
|
|
|
|
* \param val The value to set the parameter to
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
2011-08-22 01:07:57 +00:00
|
|
|
* Sets an parm extra parameter.
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
Fix spelling errors
Fixed using the following command:
codespell --write-changes --summary --skip=*.m4 --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
codespell --write-changes --summary --skip=aclocal.m4,lib --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
Codespell home page: https://github.com/codespell-project/codespell
2020-07-24 07:02:12 +00:00
|
|
|
* \return RIG_OK if the operation has been successful, otherwise
|
|
|
|
* a negative value if an error occurred (in which case, cause is
|
2002-11-04 22:22:30 +00:00
|
|
|
* set appropriately).
|
|
|
|
*
|
|
|
|
* \sa rig_get_ext_parm()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
int HAMLIB_API rig_set_ext_parm(RIG *rig, token_t token, value_t val)
|
2002-11-04 22:22:30 +00:00
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (CHECK_RIG_ARG(rig))
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (rig->caps->set_ext_parm == NULL)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_ENAVAIL;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
return rig->caps->set_ext_parm(rig, token, val);
|
2002-11-04 22:22:30 +00:00
|
|
|
}
|
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
|
2002-11-04 22:22:30 +00:00
|
|
|
/**
|
|
|
|
* \brief get the value of a parm extra parameter
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param token The parameter
|
|
|
|
* \param val The location where to store the value of \a token
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
2007-11-26 20:54:12 +00:00
|
|
|
* Retrieves the value of a parm extra parameter associated with \a token.
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
Fix spelling errors
Fixed using the following command:
codespell --write-changes --summary --skip=*.m4 --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
codespell --write-changes --summary --skip=aclocal.m4,lib --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
Codespell home page: https://github.com/codespell-project/codespell
2020-07-24 07:02:12 +00:00
|
|
|
* \return RIG_OK if the operation has been successful, otherwise
|
|
|
|
* a negative value if an error occurred (in which case, cause is
|
2002-11-04 22:22:30 +00:00
|
|
|
* set appropriately).
|
|
|
|
*
|
|
|
|
* \sa rig_set_ext_parm()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
int HAMLIB_API rig_get_ext_parm(RIG *rig, token_t token, value_t *val)
|
2002-11-04 22:22:30 +00:00
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (CHECK_RIG_ARG(rig) || !val)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (rig->caps->get_ext_parm == NULL)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_ENAVAIL;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
return rig->caps->get_ext_parm(rig, token, val);
|
2002-11-04 22:22:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief basically convert setting_t expressed 2^n to n
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param s The setting to convert to
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
* Converts a setting_t value expressed by 2^n to the value of n.
|
|
|
|
*
|
|
|
|
* \return the index such that 2^n is the setting, otherwise 0
|
|
|
|
* if the setting was not found.
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
int HAMLIB_API rig_setting2idx(setting_t s)
|
2002-11-04 22:22:30 +00:00
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
for (i = 0; i < RIG_SETTING_MAX; i++)
|
|
|
|
{
|
|
|
|
if (s & rig_idx2setting(i))
|
|
|
|
{
|
2020-12-16 23:47:49 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: idx=%d\n", __func__, i);
|
2017-08-05 14:09:12 +00:00
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
return 0;
|
2002-11-04 22:22:30 +00:00
|
|
|
}
|
|
|
|
|
2006-10-15 00:27:52 +00:00
|
|
|
/*! @} */
|