2006-10-15 00:27:52 +00:00
|
|
|
/**
|
|
|
|
* \addtogroup rig
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2002-02-12 22:15:27 +00:00
|
|
|
/**
|
|
|
|
* \file src/tones.c
|
2002-11-04 22:22:30 +00:00
|
|
|
* \brief CTCSS and DCS interface and tables
|
2002-02-12 22:15:27 +00:00
|
|
|
* \author Stephane Fillod
|
2010-03-05 18:48:40 +00:00
|
|
|
* \date 2000-2010
|
2002-02-12 22:15:27 +00:00
|
|
|
*/
|
2001-12-19 03:18:44 +00:00
|
|
|
/*
|
2002-11-04 22:22:30 +00:00
|
|
|
* Hamlib Interface - CTCSS and DCS interface and tables
|
2010-03-05 18:48:40 +00:00
|
|
|
* Copyright (c) 2000-2010 by Stephane Fillod
|
2001-12-19 03:18:44 +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.
|
2001-12-19 03:18:44 +00:00
|
|
|
*
|
2011-08-22 01:07:57 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2001-12-19 03:18:44 +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.
|
2001-12-19 03:18:44 +00:00
|
|
|
*
|
2011-08-22 01:07:57 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2001-12-19 03:18:44 +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
|
2001-12-19 03:18:44 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2022-02-04 13:41:36 +00:00
|
|
|
#include <hamlib/config.h>
|
2001-12-19 03:18:44 +00:00
|
|
|
|
2003-10-01 19:32:04 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
#include <hamlib/rig.h>
|
2003-04-16 22:33:18 +00:00
|
|
|
#include "tones.h"
|
|
|
|
|
|
|
|
#if !defined(_WIN32) && !defined(__CYGWIN__)
|
2001-12-19 03:18:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 52 CTCSS sub-audible tones
|
|
|
|
*/
|
2021-04-29 15:49:29 +00:00
|
|
|
tone_t full_ctcss_list[] = { FULL_CTCSS_LIST };
|
2001-12-19 03:18:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 50 CTCSS sub-audible tones, from 67.0Hz to 254.1Hz
|
|
|
|
*
|
|
|
|
* \note Don't even think about changing a bit of this array, several
|
2011-08-22 01:07:57 +00:00
|
|
|
* backends depend on it. If you need to, create a copy for your
|
2001-12-19 03:18:44 +00:00
|
|
|
* own caps. --SF
|
|
|
|
*/
|
2021-04-29 15:49:29 +00:00
|
|
|
tone_t common_ctcss_list[] = { COMMON_CTCSS_LIST };
|
2001-12-19 03:18:44 +00:00
|
|
|
|
2009-06-01 16:51:41 +00:00
|
|
|
/**
|
|
|
|
* 104 DCS codes
|
|
|
|
*/
|
2021-04-29 15:49:29 +00:00
|
|
|
tone_t common_dcs_list[] = { COMMON_DCS_LIST };
|
2009-06-01 16:51:41 +00:00
|
|
|
|
2001-12-19 03:18:44 +00:00
|
|
|
/**
|
|
|
|
* 106 DCS codes
|
|
|
|
*/
|
2021-04-29 15:49:29 +00:00
|
|
|
tone_t full_dcs_list[] = { FULL_DCS_LIST };
|
2003-04-16 22:33:18 +00:00
|
|
|
|
|
|
|
#endif
|
2001-12-19 03:18:44 +00:00
|
|
|
|
2002-11-04 22:22:30 +00:00
|
|
|
|
|
|
|
#ifndef DOC_HIDDEN
|
|
|
|
|
|
|
|
#define CHECK_RIG_ARG(r) (!(r) || !(r)->caps || !(r)->state.comm_state)
|
|
|
|
|
|
|
|
#endif /* !DOC_HIDDEN */
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief set CTCSS sub-tone frequency
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param vfo The target VFO
|
|
|
|
* \param tone The tone to set to
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
2011-08-22 01:07:57 +00:00
|
|
|
* Sets the current Continuous Tone Controlled Squelch System (CTCSS)
|
2019-12-05 08:01:59 +00:00
|
|
|
* sub-audible tone frequency for the transmitter only.
|
2002-11-04 22:22:30 +00:00
|
|
|
* \note the \a tone integer is NOT in Hz, but in tenth of Hz! This way,
|
|
|
|
* if you want to set a subaudible tone of 88.5 Hz for example,
|
|
|
|
* then pass 885 to this function.
|
2010-04-05 09:42:04 +00:00
|
|
|
*
|
|
|
|
* NB: CTCSS encoding has to be explicitly enabled or disabled through
|
|
|
|
* a call to rig_set_func() with arg RIG_FUNC_TONE, unless it is
|
|
|
|
* unavailable and the \a tone arg has to be set to 0.
|
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_ctcss_tone(), rig_set_ctcss_sql()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
int HAMLIB_API rig_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
|
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;
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (caps->set_ctcss_tone == 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
|
|
|
if ((caps->targetable_vfo & RIG_TARGETABLE_TONE)
|
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_ctcss_tone(rig, vfo, tone);
|
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->set_ctcss_tone(rig, vfo, tone);
|
|
|
|
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 current CTCSS sub-tone frequency
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param vfo The target VFO
|
|
|
|
* \param tone The location where to store the current tone
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
2011-08-22 01:07:57 +00:00
|
|
|
* Retrieves the current Continuous Tone Controlled Squelch System (CTCSS)
|
2019-12-05 08:01:59 +00:00
|
|
|
* sub-audible tone frequency for the transmitter only.
|
2002-11-04 22:22:30 +00:00
|
|
|
* \note the \a *tone integer is NOT in Hz, but in tenth of Hz! This way,
|
|
|
|
* if the function rig_get_ctcss_tone() returns a subaudible tone of 885
|
2011-08-22 01:07:57 +00:00
|
|
|
* for example, then the real tone is 88.5 Hz.
|
2002-11-04 22:22:30 +00:00
|
|
|
* Also, a value of 0 for \a *tone means the Tone encoding is disabled.
|
|
|
|
*
|
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_ctcss_tone(), rig_get_ctcss_sql()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
int HAMLIB_API rig_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)
|
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) || !tone)
|
|
|
|
{
|
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->get_ctcss_tone == 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
|
|
|
if ((caps->targetable_vfo & RIG_TARGETABLE_TONE)
|
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_ctcss_tone(rig, vfo, tone);
|
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_ctcss_tone(rig, vfo, tone);
|
|
|
|
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 the current encoding DCS code
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param vfo The target VFO
|
|
|
|
* \param code The tone to set to
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
* Sets the current encoding Digitally-Coded Squelch code.
|
|
|
|
*
|
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_dcs_code(), rig_set_dcs_sql()
|
|
|
|
*/
|
|
|
|
|
2004-10-02 10:32:09 +00:00
|
|
|
int HAMLIB_API rig_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code)
|
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_dcs_code == 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
|
|
|
if ((caps->targetable_vfo & RIG_TARGETABLE_TONE)
|
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_dcs_code(rig, vfo, code);
|
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->set_dcs_code(rig, vfo, code);
|
|
|
|
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 current encoding DCS code
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param vfo The target VFO
|
|
|
|
* \param code The location where to store the current tone
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
2011-08-22 01:07:57 +00:00
|
|
|
* Retrieves the current encoding Digitally-Coded Squelch code.
|
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_dcs_code(), rig_get_dcs_sql()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
int HAMLIB_API rig_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code)
|
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) || !code)
|
|
|
|
{
|
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->get_dcs_code == 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
|
|
|
if ((caps->targetable_vfo & RIG_TARGETABLE_TONE)
|
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_dcs_code(rig, vfo, code);
|
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_dcs_code(rig, vfo, code);
|
|
|
|
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 CTCSS squelch
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param vfo The target VFO
|
|
|
|
* \param tone The PL tone to set the squelch to
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
* Sets the current Continuous Tone Controlled Squelch System (CTCSS)
|
|
|
|
* sub-audible *squelch* tone.
|
|
|
|
* \note \a tone is NOT in Hz, but in tenth of Hz! This way,
|
|
|
|
* if you want to set subaudible squelch tone of 88.5 Hz for example,
|
|
|
|
* then pass 885 to this function.
|
2010-04-05 09:42:04 +00:00
|
|
|
*
|
|
|
|
* NB: the tone squelch has to be explicitly enabled or disabled through
|
|
|
|
* a call to rig_set_func() with arg RIG_FUNC_TSQL, unless it is
|
|
|
|
* unavailable and the \a tone arg has to be set to 0.
|
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_ctcss_sql(), rig_set_ctcss_tone()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
int HAMLIB_API rig_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone)
|
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;
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-10-05 02:32:08 +00:00
|
|
|
if (caps->set_ctcss_sql == 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
|
|
|
if ((caps->targetable_vfo & RIG_TARGETABLE_TONE)
|
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_ctcss_sql(rig, vfo, tone);
|
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->set_ctcss_sql(rig, vfo, tone);
|
|
|
|
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 current CTCSS squelch
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param vfo The target VFO
|
|
|
|
* \param tone The location where to store the current tone
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
2011-08-22 01:07:57 +00:00
|
|
|
* Retrieves the current Continuous Tone Controlled Squelch System (CTCSS)
|
2002-11-04 22:22:30 +00:00
|
|
|
* sub-audible *squelch* tone.
|
|
|
|
* \note \a *tone is NOT in Hz, but in tenth of Hz! This way,
|
|
|
|
* if the function rig_get_ctcss_sql() returns a subaudible tone of 885
|
2011-08-22 01:07:57 +00:00
|
|
|
* for example, then the real tone is 88.5 Hz.
|
2002-11-04 22:22:30 +00:00
|
|
|
* Also, a value of 0 for \a tone means the Tone squelch is disabled.
|
|
|
|
*
|
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_ctcss_sql(), rig_get_ctcss_tone()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
int HAMLIB_API rig_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone)
|
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) || !tone)
|
|
|
|
{
|
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->get_ctcss_sql == 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
|
|
|
if ((caps->targetable_vfo & RIG_TARGETABLE_TONE)
|
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_ctcss_sql(rig, vfo, tone);
|
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_ctcss_sql(rig, vfo, tone);
|
|
|
|
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 the current DCS code
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param vfo The target VFO
|
|
|
|
* \param code The tone to set to
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
|
|
|
* Sets the current Digitally-Coded *Squelch* code.
|
|
|
|
*
|
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 returns RIG_OK if the operation has been successful, ortherwise
|
|
|
|
* a negative value if an error occurred (in which case, cause is set
|
2002-11-04 22:22:30 +00:00
|
|
|
* appropriately).
|
|
|
|
*
|
|
|
|
* \sa rig_get_dcs_sql(), rig_set_dcs_code()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
int HAMLIB_API rig_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code)
|
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_dcs_sql == NULL)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_ENAVAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((caps->targetable_vfo & RIG_TARGETABLE_TONE)
|
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_dcs_sql(rig, vfo, code);
|
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;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
retcode = caps->set_dcs_sql(rig, vfo, code);
|
|
|
|
caps->set_vfo(rig, curr_vfo);
|
2002-11-04 22:22:30 +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 current DCS code
|
2017-08-05 14:09:12 +00:00
|
|
|
* \param rig The rig handle
|
|
|
|
* \param vfo The target VFO
|
|
|
|
* \param code The location where to store the current tone
|
2002-11-04 22:22:30 +00:00
|
|
|
*
|
2011-08-22 01:07:57 +00:00
|
|
|
* Retrieves the current Digitally-Coded *Squelch* code.
|
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, ortherwise
|
|
|
|
* 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_dcs_sql(), rig_get_dcs_code()
|
|
|
|
*/
|
2004-10-02 10:32:09 +00:00
|
|
|
int HAMLIB_API rig_get_dcs_sql(RIG *rig, vfo_t vfo, tone_t *code)
|
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) || !code)
|
|
|
|
{
|
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_dcs_sql == NULL)
|
|
|
|
{
|
2017-08-05 14:09:12 +00:00
|
|
|
return -RIG_ENAVAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((caps->targetable_vfo & RIG_TARGETABLE_TONE)
|
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_dcs_sql(rig, vfo, code);
|
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;
|
|
|
|
}
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
retcode = caps->get_dcs_sql(rig, vfo, code);
|
|
|
|
caps->set_vfo(rig, curr_vfo);
|
2002-11-04 22:22:30 +00:00
|
|
|
|
2017-08-05 14:09:12 +00:00
|
|
|
return retcode;
|
2002-11-04 22:22:30 +00:00
|
|
|
}
|
|
|
|
|
2006-10-15 00:27:52 +00:00
|
|
|
/*! @} */
|