Merge branch 'master' into fix/pytest

This commit is contained in:
dforsi 2025-07-27 18:22:26 +02:00 committed by GitHub
commit 96d5abab47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 1207 additions and 498 deletions

View file

@ -481,6 +481,21 @@ autogenerated tests must be updated:
and the handwritten tests should be updated to reflect the change.
The Python tests can also be run against a simulator or an actual rig, but
they aren't guaranteed to succeed because the CI only tests the dummy rig.
To execute the tests from the build tree, add the path to the libraries
that you built, using the PYTHONPATH environment variable, eg:
PYTHONPATH=bindings/:bindings/.libs/ bindings/python/test_rig.py \
--model 1035 --rig-file /dev/ttyUSB0 --serial-speed 4800
Only the following long arguments are supported:
--model ID
--rig-file DEVICE
--serial-speed BAUD
--hamlib-verbose
The argument --hamlib-verbose can be repeated as many times as the --verbose
argument accepted by rigctl.
1.4. Feedback

View file

@ -0,0 +1,42 @@
"""Tests of the Python bindings for Hamlib
"""
import pytest
import sys
def pytest_addoption(parser):
# using long options only because short options conflict with pytest's
if sys.argv[1].endswith("amp.py"):
parser.addoption('--model', type=int, default=1,
metavar='ID', help='select amplifier model number')
parser.addoption('--amp-file', default=None,
metavar='DEVICE', help='set device of the amplifier to operate on')
if sys.argv[1].endswith("rig.py"):
parser.addoption('--model', type=int, default=1,
metavar='ID', help='select radio model number')
parser.addoption('--rig-file', default=None,
metavar='DEVICE', help='set device of the radio to operate on')
elif sys.argv[1].endswith("rot.py"):
parser.addoption('--model', type=int, default=1,
metavar='ID', help='select rotator model number')
parser.addoption('--rot-file', default=None,
metavar='DEVICE', help='set device of the rotator to operate on')
parser.addoption('--serial-speed', type=int, default=0,
metavar='BAUD', help='set serial speed of the serial port')
parser.addoption('--hamlib-verbose', action='count', default=0,
help='set verbose mode, cumulative')
@pytest.fixture
def model(request):
return request.config.getoption("--model")
@pytest.fixture
def rig_file(request):
return request.config.getoption("--rig-file")
@pytest.fixture
def serial_speed(request):
return request.config.getoption("--serial-speed")
@pytest.fixture
def hamlib_verbose(request):
return request.config.getoption("--hamlib-verbose")

View file

@ -9,14 +9,12 @@ import Hamlib
Hamlib.rig_set_debug(Hamlib.RIG_DEBUG_NONE)
AMP_MODEL = Hamlib.AMP_MODEL_DUMMY
class TestClass:
"""Container class for tests"""
def test_without_open(self):
def test_without_open(self, model):
"""Call all the methods that do not depend on open()"""
amp = Hamlib.Amp(AMP_MODEL)
amp = Hamlib.Amp(model)
assert amp is not None
assert amp.do_exception == 0
assert amp.error_status == Hamlib.RIG_OK
@ -38,9 +36,9 @@ class TestClass:
assert amp.token_lookup("") is None
def test_with_open(self):
def test_with_open(self, model):
"""Call all the methods that depend on open()"""
amp = Hamlib.Amp(AMP_MODEL)
amp = Hamlib.Amp(model)
assert amp is not None
assert amp.state.comm_state == 0
@ -70,9 +68,9 @@ class TestClass:
assert info is None
def test_object_creation(self):
def test_object_creation(self, model):
"""Create all objects available"""
amp = Hamlib.Rig(AMP_MODEL)
amp = Hamlib.Rig(model)
assert amp is not None
assert isinstance(amp.caps, Hamlib.rig_caps)

View file

@ -5,20 +5,18 @@ Running this script directly will use the installed bindings.
For an in-tree run use "make check", or set PYTHONPATH to point to
the directories containing Hamlib.py and _Hamlib.so.
"""
from pytest import raises
import pytest
import Hamlib
Hamlib.rig_set_debug(Hamlib.RIG_DEBUG_NONE)
RIG_MODEL = Hamlib.RIG_MODEL_DUMMY
class TestClass:
"""Container class for tests"""
def test_without_open(self):
def test_without_open(self, model):
"""Call all the methods that do not depend on open()"""
rig = Hamlib.Rig(RIG_MODEL)
rig = Hamlib.Rig(model)
assert rig is not None
assert rig.do_exception == 0
assert rig.error_status == Hamlib.RIG_OK
@ -35,17 +33,22 @@ class TestClass:
assert isinstance(conf, str)
assert rig.set_conf("mcfg", "foo") is None
conf = rig.get_conf("mcfg")
assert conf == "foo"
if model == Hamlib.RIG_MODEL_DUMMY:
assert conf == "foo"
else:
assert conf == ""
assert rig.token_lookup("") is None
def test_with_open(self):
def test_with_open(self, model, rig_file, serial_speed):
"""Call all the methods that depend on open()"""
rig = Hamlib.Rig(RIG_MODEL)
rig = Hamlib.Rig(model)
assert rig is not None
assert rig.state.comm_state == 0
assert rig.set_conf("rig_pathname", rig_file) is None
assert rig.set_conf("serial_speed", str(serial_speed)) is None
assert rig.open() is None
assert rig.state.comm_state == 1
info = rig.get_info()
@ -117,9 +120,10 @@ class TestClass:
assert info is None
def test_misc(self):
@pytest.mark.skipif('config.getoption("model") != Hamlib.RIG_MODEL_DUMMY')
def test_misc(self, model):
"""Just call all the methods"""
rig = Hamlib.Rig(RIG_MODEL)
rig = Hamlib.Rig(model)
assert rig is not None
assert rig.close() is None
@ -232,9 +236,10 @@ class TestClass:
assert rig.vfo_op(0, 0) is None
def test_object_creation(self):
@pytest.mark.skipif('config.getoption("model") != Hamlib.RIG_MODEL_DUMMY')
def test_object_creation(self, model):
"""Create all objects available"""
rig = Hamlib.Rig(RIG_MODEL)
rig = Hamlib.Rig(model)
assert rig is not None
assert isinstance(rig.caps, Hamlib.rig_caps)

19
bindings/python/test_rot.py Normal file → Executable file
View file

@ -11,8 +11,6 @@ import Hamlib
Hamlib.rig_set_debug(Hamlib.RIG_DEBUG_NONE)
ROT_MODEL = Hamlib.ROT_MODEL_DUMMY
class TestClass:
"""Container class for tests"""
@ -23,9 +21,9 @@ class TestClass:
# TOK_EL_ROT_MAGICCOMBO = 5 # handled by get_ext_level/set_ext_level
TOK_EL_ROT_MAGICEXTFUNC = 6
def test_without_open(self):
def test_without_open(self, model):
"""Call all the methods that do not depend on open()"""
rot = Hamlib.Rot(ROT_MODEL)
rot = Hamlib.Rot(model)
assert rot is not None
assert rot.do_exception == 0
assert rot.error_status == Hamlib.RIG_OK
@ -42,14 +40,17 @@ class TestClass:
assert isinstance(conf, str)
assert rot.set_conf("mcfg", "foo") is None
conf = rot.get_conf("mcfg")
assert conf == "foo"
if model == Hamlib.ROT_MODEL_DUMMY:
assert conf == "foo"
else:
assert conf == ""
assert rot.token_lookup("") is None
def test_with_open(self):
def test_with_open(self, model):
"""Call all the methods that depend on open()"""
rot = Hamlib.Rot(ROT_MODEL)
rot = Hamlib.Rot(model)
assert rot is not None
assert rot.state.comm_state == 0
@ -106,9 +107,9 @@ class TestClass:
assert info is None
def test_object_creation(self):
def test_object_creation(self, model):
"""Create all objects available"""
rot = Hamlib.Rig(ROT_MODEL)
rot = Hamlib.Rig(model)
assert rot is not None
assert isinstance(rot.caps, Hamlib.rig_caps)

97
doc/README.Doxygen Normal file
View file

@ -0,0 +1,97 @@
Some tips on writing comments for the Doxygen documentation generator.
Doxygen is a flexible and powerful tool that not only reads and processes
specially formatted comments but also the actual code such as functions,
structures, enumerations, and defines. Sometimes it needs a few hints to
generate output in a consistent manner. As usual, there are multiple ways to
do one thing and it's likely that nearly all of them are present in the Hamlib
code base.
Markdown
Doxygen has supported the use of Markdown formatting elements in running text
for some time. Markdown has become rather universal over the past several
years for simple markup of text. It is widely supported by GitHub, Reddit, and
other Web sites. Those familiar with Markdown can use it the running Doxygen
comment text and it will be formatted as such in the output.
Common formatting is to emphasize text as italic, bold, or constant width font.
A string will be output in italics when it is has a single asterisk or
underscore preceding and succeeding the string, e.g. *italic*. Likewise the
string will be emboldened with two asterisks or underscores, e.g. **bold**. As
most text output will be in proportional text, a string surrounded by backticks
will be output in a constant width font, e.b. `constant width`.
Special commands
Doxygen will associate a comment block that immediately precedes the item. For
example, a comment block immediately precedes a structure declaration. It is
not necessary to include a line such as `\struct foo` in the comment block.
This is only necessary if the comment block must be separated from the item.
One example of the latter is a group of #define macros where the comment block
is placed above the group rather than interspersed. In this case, each #define
will need to be called out in the comment block with the \def command. The
choice is yours. Sometimes the source file will look more clean with a
separate comment block and at others interspersed comments will seem more
appropriate.
Notable exceptions are in the rotlist.h and amplist.h files where the #define
statements for the individual models have beem grouped together and the
comments grouped preceding them. This is true even in the case of a backend
with a single model as others may be added in the future. Including the \def
command in each comment block is appropriate.
Related to the previous section, sometimes a single comment will be appropriate
for a group of elements, particularly macros. An anonymous group will apply
the comment to all elements. The anonymous group uses the ///@{ and ///@}
constructs.
Reference links
Elements can be explicitly referenced with the # character. This is done in
running text to force Doxygen to create a link to the documentation for the RIG
handle, for example. Otherwise, it is rarely needed. Check the output as the
comment is being written and use the # character if needed.
Functions have two methods of forcing a reference. The first is to precede the
function name with a pair of colons, e.g. ::rig_init. This acts much like #
where it is sort of a hard instruction to Doxygen and a warning will be printed
if the function is not found in the list of files passed to Doxygen or it has
no associated comment. The second is to place a pair of parentheses
immediately after the function, e.g. rig_init(). This second construct is
preferred as Doxygen will not print a warning if the function is not found or
commented.
Links to external Web sites can be done in the Markdown syntax.
Code blocks in comments
Code blocks can be delimited with use of the \code and \endcode special
commands or with a Markdown "fence" which consists of three backticks on a line
preceding and succeeding the code block. Backticks are shorter to type.
Check the output
Always check the output to be sure it is what you want! I edit in one terminal
window, switch to another to run `make doc` from within the 'doc' directory and
reload the local page in the browser. This will show if a reference command is
required.
Be aware the members of an enumeration or structure cannot be linked to even
though they are documented. In that case, surround the member name with
backticks to render it in a constant width font.
What to document
For now the frontend part of the library is being documented. This includes
most files in `include/hamlib` and `src`. No decision has been made on
expanding this to the individual backends. That would be a Herculean task!
73, Nate, N0NB

View file

@ -190,10 +190,13 @@ GNU/Linux.
/*! Define groups for Doxygen
* \defgroup rig Rig (transceiver) API
* \defgroup riglist Rig (radio) Model List
* \defgroup rig_internal Rig (transceiver) Internal API
* \defgroup rotator Rotator API
* \defgroup rotlist Rotator Model List
* \defgroup rot_internal Rotator Internal API
* \defgroup amplifier Amplifier API
* \defgroup amplist Amplifier Model list
* \defgroup amp_internal Amplifier Internal API
* \defgroup port Port data structure for accessing devices
* \defgroup utilities Utility Routines API

View file

@ -80,7 +80,19 @@ struct amp_state
#define AMPSTATE(a) (&(a)->state)
#endif
/** Macro for application access to amp_state data structure. */
/** Macro for application access to amp_state data structure using the #AMP
* handle.
*
* Example code.
* ```
* AMP *my_amp;
*
* //Instantiate an amp
* my_amp = amp_init(AMP_MODEL_DUMMY); // your amp (amplifier) model.
*
* const struct amp_state *my_as = HAMLIB_AMPSTATE(my_amp);
* ```
*/
#define HAMLIB_AMPSTATE(a) ((struct amp_state *)amp_data_pointer(a, RIG_PTRX_AMPSTATE))
__END_DECLS

View file

@ -69,9 +69,8 @@ typedef struct amp AMP;
* \brief Type definition for
* <a href="https://en.wikipedia.org/wiki/Standing_wave_ratio" >SWR (Standing Wave Ratio)</a>.
*
* \typedef typedef float swr_t
*
* The \a swr_t type is used as a parameter for the amp_get_swr() function.
* \noop amp_get_swr() is not implemented.
* \noop The \a swr_t type is used as a parameter for the amp_get_swr() function.
*
* The unit of \a swr_t is 1.0 to the maximum value reported by the amplifier's
* internal antenna system tuner, i.e.
@ -89,8 +88,6 @@ typedef float swr_t;
* and
* <a href="https://en.wikipedia.org/wiki/Inductance" >inductance</a>.
*
* \typedef typedef float tune_value_t
*
* The \a tune_value_t type is used as a parameter for amp_get_level().
*
* The unit of \a tune_value_t is
@ -107,36 +104,35 @@ typedef int tune_value_t;
#define NETAMPCTL_RET "RPRT "
//! @cond Doxygen_Suppress
typedef enum
/** \brief Amplifier reset tokens. */
typedef enum amp_reset_e
{
AMP_RESET_MEM, // erase tuner memory
AMP_RESET_FAULT, // reset any fault
AMP_RESET_AMP // for kpa1500
AMP_RESET_MEM, /*!< Erase tuner memory. */
AMP_RESET_FAULT, /*!< Reset any fault. */
AMP_RESET_AMP /*!< For Elecraft KPA-1500. */
} amp_reset_t;
//! @endcond
/**
* \brief Amplifier type flags
*/
typedef enum
/** \brief Amplifier type flags. */
typedef enum amp_type_e
{
AMP_FLAG_1 = (1 << 1), /*!< TBD */
AMP_FLAG_2 = (1 << 2) /*!< TBD */
} amp_type_t;
//! @cond Doxygen_Suppress
// TBD AMP_TYPE
///@{
/// Amplifier type bit masks.
#define AMP_TYPE_MASK (AMP_FLAG_1|AMP_FLAG_2)
#define AMP_TYPE_OTHER 0
#define AMP_TYPE_1 AMP_FLAG_1
#define AMP_TYPE_2 AMP_FLAG_2
#define AMP_TYPE_ALL (AMP_FLAG_1|AMP_FLAG_2)
//! @endcond
///@}
//! @cond Doxygen_Suppress
///@{
/// Amplifier levels as bit masks.
enum amp_level_e
{
AMP_LEVEL_NONE = 0, /*!< '' -- No Level. */
@ -150,9 +146,10 @@ enum amp_level_e
AMP_LEVEL_FAULT = (1 << 7), /*!< \c Fault code. */
AMP_LEVEL_PWR = (1 << 8), /*!< \c Power setting. */
};
//! @endcond
///@}
//! @cond Doxygen_Suppress
// Not used yet.
#define AMP_LEVEL_FLOAT_LIST (AMP_LEVEL_SWR)
#define AMP_LEVEL_STRING_LIST (AMP_LEVEL_FAULT)
#define AMP_LEVEL_IS_FLOAT(l) ((l)&AMP_LEVEL_FLOAT_LIST)
@ -164,15 +161,16 @@ enum amp_level_e
* enquiries about capabilities.
*/
//! @cond Doxygen_Suppress
/**
* Convenience macro to map the `amp_model` number and `macro_name` string from amplist.h.
*
* Used when populating a backend amp_caps structure.
*/
#define AMP_MODEL(arg) .amp_model=arg,.macro_name=#arg
//! @endcond
/**
* \brief Amplifier capabilities.
*
* \struct amp_caps
*
* The main idea of this struct is that it will be defined by the backend
* amplifier driver and will remain read-only for the application. Fields
* that need to be modifiable by the application are copied into the
@ -225,39 +223,37 @@ struct amp_caps
*
*/
int (*amp_init)(AMP *amp); /*!< Pointer to backend implementation of ::amp_init(). */
int (*amp_cleanup)(AMP *amp); /*!< Pointer to backend implementation of ::amp_cleanup(). */
int (*amp_open)(AMP *amp); /*!< Pointer to backend implementation of ::amp_open(). */
int (*amp_close)(AMP *amp); /*!< Pointer to backend implementation of ::amp_close(). */
int (*amp_init)(AMP *amp); /*!< Pointer to backend implementation of amp_init(). */
int (*amp_cleanup)(AMP *amp); /*!< Pointer to backend implementation of amp_cleanup(). */
int (*amp_open)(AMP *amp); /*!< Pointer to backend implementation of amp_open(). */
int (*amp_close)(AMP *amp); /*!< Pointer to backend implementation of amp_close(). */
int (*set_freq)(AMP *amp, freq_t val); /*!< Pointer to backend implementation of ::amp_set_freq(). */
int (*get_freq)(AMP *amp, freq_t *val); /*!< Pointer to backend implementation of ::amp_get_freq(). */
int (*set_freq)(AMP *amp, freq_t val); /*!< Pointer to backend implementation of amp_set_freq(). */
int (*get_freq)(AMP *amp, freq_t *val); /*!< Pointer to backend implementation of amp_get_freq(). */
int (*set_conf)(AMP *amp, hamlib_token_t token, const char *val); /*!< Pointer to backend implementation of ::amp_set_conf(). */
int (*get_conf2)(AMP *amp, hamlib_token_t token, char *val, int val_len); /*!< Pointer to backend implementation of ::amp_get_conf(). */
int (*get_conf)(AMP *amp, hamlib_token_t token, char *val); /*!< Pointer to backend implementation of ::amp_get_conf(). */
int (*set_conf)(AMP *amp, hamlib_token_t token, const char *val); /*!< Pointer to backend implementation of amp_set_conf(). */
int (*get_conf2)(AMP *amp, hamlib_token_t token, char *val, int val_len); /*!< Pointer to backend implementation of amp_get_conf(). */
int (*get_conf)(AMP *amp, hamlib_token_t token, char *val); /*!< Pointer to backend implementation of amp_get_conf(). */
/*
* General API commands, from most primitive to least.. :()
* List Set/Get functions pairs
*/
int (*reset)(AMP *amp, amp_reset_t reset); /*!< Pointer to backend implementation of ::amp_reset(). */
int (*get_level)(AMP *amp, setting_t level, value_t *val); /*!< Pointer to backend implementation of ::amp_get_level(). */
int (*set_level)(AMP *amp, setting_t level, value_t val); /*!< Pointer to backend implementation of ::amp_get_level(). */
int (*get_ext_level)(AMP *amp, hamlib_token_t level, value_t *val); /*!< Pointer to backend implementation of ::amp_get_ext_level(). */
int (*set_ext_level)(AMP *amp, hamlib_token_t level, value_t val); /*!< Pointer to backend implementation of ::amp_set_ext_level(). */
int (*set_powerstat)(AMP *amp, powerstat_t status); /*!< Pointer to backend implementation of ::amp_set_powerstat(). */
int (*get_powerstat)(AMP *amp, powerstat_t *status); /*!< Pointer to backend implementation of ::amp_get_powerstat(). */
int (*reset)(AMP *amp, amp_reset_t reset); /*!< Pointer to backend implementation of amp_reset(). */
int (*get_level)(AMP *amp, setting_t level, value_t *val); /*!< Pointer to backend implementation of amp_get_level(). */
int (*set_level)(AMP *amp, setting_t level, value_t val); /*!< Pointer to backend implementation of amp_get_level(). */
int (*get_ext_level)(AMP *amp, hamlib_token_t level, value_t *val); /*!< Pointer to backend implementation of amp_get_ext_level(). */
int (*set_ext_level)(AMP *amp, hamlib_token_t level, value_t val); /*!< Pointer to backend implementation of amp_set_ext_level(). */
int (*set_powerstat)(AMP *amp, powerstat_t status); /*!< Pointer to backend implementation of amp_set_powerstat(). */
int (*get_powerstat)(AMP *amp, powerstat_t *status); /*!< Pointer to backend implementation of amp_get_powerstat(). */
/* get firmware info, etc. */
const char *(*get_info)(AMP *amp); /*!< Pointer to backend implementation of ::amp_get_info(). */
const char *(*get_info)(AMP *amp); /*!< Pointer to backend implementation of amp_get_info(). */
//! @cond Doxygen_Suppress
setting_t levels;
unsigned ext_levels;
//! @endcond
setting_t levels; /*!< Levels bit mask */
unsigned ext_levels; /*!< Extension levels value. */
const struct confparams *extlevels; /*!< Extension levels list. \sa extamp.c */
const struct confparams *extparms; /*!< Extension parameters list. \sa extamp.c */
@ -281,8 +277,6 @@ __BEGIN_DECLS
/**
* \brief Master amplifier structure.
*
* \struct amp
*
* Master amplifier data structure acting as the #AMP handle for the
* controlled amplifier. A pointer to this structure is returned by the
* amp_init() API function and is passed as a parameter to every amplifier
@ -432,8 +426,6 @@ extern HAMLIB_EXPORT(void *) amp_data_pointer(AMP *amp, rig_ptrx_t idx);
/**
* \brief Convenience macro for generating debugging messages.
*
* \def amp_debug
*
* This is an alias of the rig_debug() function call and is used in the same
* manner.
*/

View file

@ -25,17 +25,12 @@
#ifndef _AMPLIST_H
#define _AMPLIST_H 1
//! @cond Doxygen_Suppress
#define AMP_MAKE_MODEL(a,b) ((a)*100+(b))
#define AMP_BACKEND_NUM(a) ((a)/100)
//! @endcond
/**
* \addtogroup amplifier
* \addtogroup amplist
* @{
*/
/**
* \brief Hamlib amplifier model definitions.
*
@ -55,6 +50,27 @@
* wishes to use which is passed to the amp_init() API call.
*/
/**
* \brief The amp model number is held in a signed integer.
*
* Model numbers are a simple decimal value that increments by a value of
* 100 for each backend, e.g. the `DUMMY` backend has model numbers 1
* to 100, the `ELECRAFT` backend has model numbers 201 to 300 and so on
* (101 to 200 is currently unassigned).
*
* \note A limitation is that with ::amp_model_t being a signed integer that on
* some systems such a value may be 16 bits. This limits the number of backends
* to 326 of 100 models each (32768 / 100 thus leaving only 68 models for
* backend number 327 so round down to 326). So far this doesn't seem like an
* extreme limitation.
*
* \sa amp_model_t
*/
#define AMP_MAKE_MODEL(a,b) ((a)*100+(b))
/** Convenience macro to derive the backend family number from the model number. */
#define AMP_BACKEND_NUM(a) ((a)/100)
/**
* \brief A macro that returns the model number for an unknown model.
@ -67,71 +83,63 @@
#define AMP_MODEL_NONE 0
/** The `DUMMY` family. Also contains network models. */
#define AMP_DUMMY 0
/** Used in amp_reg.c for the `be_name`. */
#define AMP_BACKEND_DUMMY "dummy"
/**
* \brief A macro that returns the model number for the DUMMY backend.
* \brief A macro that returns the model number for `DUMMY`.
*
* \def AMP_MODEL_DUMMY
*
* The DUMMY backend, as the name suggests, is a backend which performs no
* The `DUMMY` model, as the name suggests, is a model which performs no
* hardware operations and always behaves as one would expect. It can be
* thought of as a hardware simulator and is very useful for testing client
* applications.
*/
/**
* \brief A macro that returns the model number for the NETAMPCTL backend.
*
* \def AMP_MODEL_NETAMPCTL
*
* The NETAMPCTL backend allows use of the `ampctld` daemon through the normal
* Hamlib API.
*/
//! @cond Doxygen_Suppress
#define AMP_DUMMY 0
#define AMP_BACKEND_DUMMY "dummy"
//! @endcond
#define AMP_MODEL_DUMMY AMP_MAKE_MODEL(AMP_DUMMY, 1)
/**
* \brief A macro that returns the model number for `NETAMPCTL`.
*
* The `NETAMPCTL` model allows use of the `ampctld` daemon through the normal
* Hamlib C API.
*/
#define AMP_MODEL_NETAMPCTL AMP_MAKE_MODEL(AMP_DUMMY, 2)
/** The `ELECRAFT` family. */
#define AMP_ELECRAFT 2
/** Used in amp_reg.c for the `be_name`. */
#define AMP_BACKEND_ELECRAFT "elecraft"
/**
* \brief A macro that returns the model number of the KPA1500 backend.
* \brief A macro that returns the model number of `KPA1500`.
*
* \def AMP_MODEL_ELECRAFT_KPA1500
*
* The KPA1500 backend can be used with amplifiers that support the Elecraft
* The `KPA1500` model can be used with amplifiers that support the Elecraft
* KPA-1500 protocol.
*/
//! @cond Doxygen_Suppress
#define AMP_ELECRAFT 2
#define AMP_BACKEND_ELECRAFT "elecraft"
//! @endcond
#define AMP_MODEL_ELECRAFT_KPA1500 AMP_MAKE_MODEL(AMP_ELECRAFT, 1)
//#define AMP_MODEL_ELECRAFT_KPA500 AMP_MAKE_MODEL(AMP_ELECRAFT, 2)
/** The `GEMINI` family. */
#define AMP_GEMINI 3
/** Used in amp_reg.c for the `be_name`. */
#define AMP_BACKEND_GEMINI "gemini"
/**
* \brief A macro that returns the model number of the DX1200 backend.
*
* \def AMP_MODEL_GEMINI_DX1200
* \brief A macro that returns the model number of `DX1200`.
*
* The Gemini DX1200 covers 160 trhough 4 meters.
*/
//! @cond Doxygen_Suppress
#define AMP_GEMINI 3
#define AMP_BACKEND_GEMINI "gemini"
//! @endcond
#define AMP_MODEL_GEMINI_DX1200 AMP_MAKE_MODEL(AMP_GEMINI, 1)
/** The `EXPERT` family. */
#define AMP_EXPERT 4
/** Used in amp_reg.c for the `be_name`. */
#define AMP_BACKEND_EXPERT "expert"
/**
* \brief A macro that returns the model number of the FA backend.
*
* \def AMP_MODEL_EXPERT_FA
* \brief A macro that returns the model number of `FA`.
*
* The Expert FA series of amplifiers is supported by this backend.
*/
//! @cond Doxygen_Suppress
#define AMP_EXPERT 4
#define AMP_BACKEND_EXPERT "expert"
//! @endcond
#define AMP_MODEL_EXPERT_FA AMP_MAKE_MODEL(AMP_EXPERT, 1)

View file

@ -739,10 +739,14 @@ typedef enum {
RIG_RESET_MASTER = (1 << 3) /*!< Master reset */
} reset_t;
typedef enum {
RIG_CLIENT_UNKNOWN,
RIG_CLIENT_WSJTX,
RIG_CLIENT_GPREDICT
/**
* The client application using Hamlib.
*/
typedef enum client_e {
RIG_CLIENT_UNKNOWN, /*!< Not known, could be any application. */
RIG_CLIENT_WSJTX, /*!< Well known digital application that includes FT8 and FT4. */
RIG_CLIENT_GPREDICT /*!< Satellite prediction and tracking application. */
} client_t;
@ -1206,7 +1210,7 @@ enum multicast_item_e {
//! @endcond
/**
* \brief Setting
* \brief Setting bit mask.
*
* This can be a func, a level or a parm.
* Each bit designates one of them.
@ -1893,6 +1897,16 @@ struct deferred_config_header {
};
typedef struct deferred_config_header deferred_config_header_t;
/**
* Convenience macro to map the `rig_model` number and `macro_name` string from riglist.h.
*
* Used when populating a backend rig_caps structure.
*/
#define RIG_MODEL(arg) .rig_model=arg,.macro_name=#arg
#define HAMLIB_CHECK_RIG_CAPS "HAMLIB_CHECK_RIG_CAPS"
/**
* \brief Rig data structure.
*
@ -1912,9 +1926,6 @@ typedef struct deferred_config_header deferred_config_header_t;
* mdblack: Don't move or add fields around without bumping the version numbers
* DLL or shared library replacement depends on order
*/
//! @cond Doxygen_Suppress
#define RIG_MODEL(arg) .rig_model=arg,.macro_name=#arg
#define HAMLIB_CHECK_RIG_CAPS "HAMLIB_CHECK_RIG_CAPS"
struct rig_caps {
rig_model_t rig_model; /*!< Rig model. */
const char *model_name; /*!< Model name. */

View file

@ -25,6 +25,21 @@
#define _RIG_STATE_H 1
__BEGIN_DECLS
/**
* \addtogroup rig
* @{
*/
/**
* \brief Hamlib rig state data structure.
*
* \file rig_state.h
*
* This file contains the live data structure of the rig (radio).
*/
/**
* \brief Rig state containing live data and customized fields.
*
@ -44,13 +59,13 @@ struct rig_state {
// this should allow changes to hamlib_port_t without breaking shared libraries
// these will maintain a copy of the new port_t for backwards compatibility
// to these offsets -- note these must stay until a major version update is done like 5.0
hamlib_port_t_deprecated rigport_deprecated; /*!< Rig port (internal use). */
hamlib_port_t_deprecated pttport_deprecated; /*!< PTT port (internal use). */
hamlib_port_t_deprecated dcdport_deprecated; /*!< DCD port (internal use). */
hamlib_port_t_deprecated rigport_deprecated; /*!< \deprecated Rig port (internal use). */
hamlib_port_t_deprecated pttport_deprecated; /*!< \deprecated PTT port (internal use). */
hamlib_port_t_deprecated dcdport_deprecated; /*!< \deprecated DCD port (internal use). */
double vfo_comp; /*!< VFO compensation in PPM, 0.0 to disable */
int deprecated_itu_region; /*!< ITU region to select among freq_range_t */
int deprecated_itu_region; /*!< \deprecated ITU region to select among freq_range_t */
freq_range_t rx_range_list[HAMLIB_FRQRANGESIZ]; /*!< Receive frequency range list */
freq_range_t tx_range_list[HAMLIB_FRQRANGESIZ]; /*!< Transmit frequency range list */
@ -111,7 +126,7 @@ struct rig_state {
int twiddle_timeout; /*!< timeout to resume from twiddling */
// uplink allows gpredict to behave better by no reading the uplink VFO
int uplink; /*!< uplink=1 will not read Sub, uplink=2 will not read Main */
struct rig_cache_deprecated cache; // Only here for backward compatibility
struct rig_cache_deprecated cache; /*!< \deprecated Only here for backward compatibility */
int vfo_opt; /*!< Is -o switch turned on? */
int auto_power_on; /*!< Allow Hamlib to power on rig
automatically if supported */
@ -129,15 +144,15 @@ struct rig_state {
int twiddle_state; /*!< keeps track of twiddle status */
vfo_t rx_vfo; /*!< Rx VFO currently set */
volatile unsigned int snapshot_packet_sequence_number;
volatile unsigned int snapshot_packet_sequence_number; /*!< Sequence number for JSON output. */
volatile int multicast_publisher_run;
void *multicast_publisher_priv_data;
volatile int async_data_handler_thread_run;
void *async_data_handler_priv_data;
volatile int poll_routine_thread_run;
void *poll_routine_priv_data;
pthread_mutex_t mutex_set_transaction;
volatile int multicast_publisher_run; /*!< Multicast publisher run flag. */
void *multicast_publisher_priv_data; /*!< Pointer to multicast_publisher_priv_data. */
volatile int async_data_handler_thread_run; /*!< Async data handler thread run flag. */
void *async_data_handler_priv_data; /*!< Pointer to async_data_handler_priv_data. */
volatile int poll_routine_thread_run; /*!< Poll routine thread run flag. */
void *poll_routine_priv_data; /*!< Pointer to rig_poll_routine_priv_data. */
pthread_mutex_t mutex_set_transaction; /*!< Thread mutex flag. */
hamlib_port_t rigport; /*!< Rig port (internal use). */
hamlib_port_t pttport; /*!< PTT port (internal use). */
hamlib_port_t dcdport; /*!< DCD port (internal use). */
@ -204,36 +219,37 @@ struct rig_state {
freq_t spectrum_spans[HAMLIB_MAX_SPECTRUM_SPANS]; /*!< Supported spectrum scope frequency spans in Hz in center mode. Last entry must be 0. */
struct rig_spectrum_avg_mode spectrum_avg_modes[HAMLIB_MAX_SPECTRUM_AVG_MODES]; /*!< Supported spectrum scope averaging modes. Last entry must have NULL name. */
int spectrum_attenuator[HAMLIB_MAXDBLSTSIZ]; /*!< Spectrum attenuator list in dB, 0 terminated */
volatile int morse_data_handler_thread_run;
void *morse_data_handler_priv_data;
FIFO_RIG *fifo_morse;
volatile int morse_data_handler_thread_run; /*!< Morse data handler thread flag. */
void *morse_data_handler_priv_data; /*!< Morse data handler private structure. */
FIFO_RIG *fifo_morse; /*!< FIFO queue for Morse Code transmission. */
int doppler; /*!< True if doppler changing detected */
char *multicast_data_addr; /*!< Multicast data UDP address for publishing rig data and state */
int multicast_data_port; /*!< Multicast data UDP port for publishing rig data and state */
char *multicast_cmd_addr; /*!< Multicast command server UDP address for sending commands to rig */
int multicast_cmd_port; /*!< Multicast command server UDP port for sending commands to rig */
volatile int multicast_receiver_run;
void *multicast_receiver_priv_data;
rig_comm_status_t comm_status; /*!< Detailed rig control status */
char device_id[HAMLIB_RIGNAMSIZ];
int dual_watch; /*!< Boolean DUAL_WATCH status */
int post_ptt_delay; /*!< delay after PTT to allow for relays and such */
struct timespec freq_event_elapsed;
volatile int multicast_receiver_run; /*!< Multicast receiver run flag. */
void *multicast_receiver_priv_data; /*!< Multicast receiver private data structure, */
rig_comm_status_t comm_status; /*!< Detailed rig control status */
char device_id[HAMLIB_RIGNAMSIZ]; /*!< Device name, */
int dual_watch; /*!< Boolean DUAL_WATCH status */
int post_ptt_delay; /*!< delay after PTT to allow for relays and such */
struct timespec freq_event_elapsed; /*!< Time struct used by various caches. */
int freq_skip; /*!< allow frequency skip for gpredict RX/TX freq set */
client_t client;
pthread_mutex_t api_mutex; // Lock for any API entry
client_t client; /*!< Client application of the library. */
pthread_mutex_t api_mutex; /*!< Lock for any API entry. */
// New rig_state items go before this line ============================================
};
//---Start cut here---
/**
* \brief Deprecated Rig state containing live data and customized fields.
* Due to DLL problems this remains in-place in the rig_caps structure but is no longer referred to
* A new rig_state has been added at the end of the structure instead of the middle
*
* This struct contains no data and is just a place holder for DLL alignment
*
* It is NOT fine to touch this struct AT ALL!!!
* \deprecated
* Due to DLL problems this remains in-place in the rig_caps structure but is no
* longer referred to.\n\n A new rig_state has been added at the end of the
* structure instead of the middle.\n\n This struct contains no data and is just a
* place holder for DLL alignment.\n\n It is NOT fine to touch this struct AT
* ALL!!!\n\n Do not use in new code.
*/
struct rig_state_deprecated {
/********* ENSURE YOU DO NOT EVER MODIFY THIS STRUCTURE *********/
@ -312,7 +328,7 @@ struct rig_state_deprecated {
int twiddle_timeout; /*!< timeout to resume from twiddling */
// uplink allows gpredict to behave better by no reading the uplink VFO
int uplink; /*!< uplink=1 will not read Sub, uplink=2 will not read Main */
struct rig_cache_deprecated cache; // Here for backward compatibility
struct rig_cache_deprecated cache; /*!< Here for backward compatibility. */
int vfo_opt; /*!< Is -o switch turned on? */
int auto_power_on; /*!< Allow Hamlib to power on rig
automatically if supported */
@ -330,15 +346,15 @@ struct rig_state_deprecated {
int twiddle_state; /*!< keeps track of twiddle status */
vfo_t rx_vfo; /*!< Rx VFO currently set */
volatile unsigned int snapshot_packet_sequence_number;
volatile unsigned int snapshot_packet_sequence_number; /*!< Sequence number for JSON output. */
volatile int multicast_publisher_run;
void *multicast_publisher_priv_data;
volatile int async_data_handler_thread_run;
void *async_data_handler_priv_data;
volatile int poll_routine_thread_run;
void *poll_routine_priv_data;
pthread_mutex_t mutex_set_transaction;
volatile int multicast_publisher_run; /*!< Multicast publisher run flag. */
void *multicast_publisher_priv_data; /*!< Pointer to multicast_publisher_priv_data. */
volatile int async_data_handler_thread_run; /*!< Async data handler thread run flag. */
void *async_data_handler_priv_data; /*!< Pointer to async_data_handler_priv_data. */
volatile int poll_routine_thread_run; /*!< Poll routine thread run flag. */
void *poll_routine_priv_data; /*!< Pointer to rig_poll_routine_priv_data. */
pthread_mutex_t mutex_set_transaction; /*!< Thread mutex flag. */
hamlib_port_t rigport; /*!< Rig port (internal use). */
hamlib_port_t pttport; /*!< PTT port (internal use). */
hamlib_port_t dcdport; /*!< DCD port (internal use). */
@ -362,8 +378,23 @@ struct rig_state_deprecated {
#if defined(IN_HAMLIB)
#define STATE(r) (&(r)->state)
#endif
/** Macro for application access to rig_state data structure using the #RIG
* handle.
*
* Example code.
* ```
* RIG *my_rig;
*
* //Instantiate a rig
* my_rig = rig_init(RIG_MODEL_DUMMY); // your rig (radio) model.
*
* const struct rig_state *my_rs = HAMLIB_STATE(my_rig);
* ```
*/
#define HAMLIB_STATE(r) ((struct rig_state *)rig_data_pointer(r, RIG_PTRX_STATE))
__END_DECLS
#endif /* _RIG_STATE_H */
/** @} */

View file

@ -19,42 +19,52 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#ifndef _RIGLIST_H
#define _RIGLIST_H 1
//! @cond Doxygen_Suppress
// The rig model number is designed to fit in a 32-bit int
// As of 2024-07-14 we have 39 backends defined -- need to be careful about generating new ones
// Perhaps combine them under a MISC entry should work
// As of 2020-02-18 we have 33 backends defined
// With a max of 1000 models per backend we get total a model number range of 1001-33001
// This MAX was 100 prior to 2020-02-18 and Icom was close to running out of the 100 range
#define MAX_MODELS_PER_BACKEND 1000
#define RIG_MAKE_MODEL(a,b) (MAX_MODELS_PER_BACKEND*(a)+(b))
#define RIG_BACKEND_NUM(a) ((a)/MAX_MODELS_PER_BACKEND)
//! @endcond
/*! \file riglist.h
* \brief Hamlib rig(radio) model definitions.
*
* This file contains rig model definitions for the Hamlib rig API. Each
* distinct rig type has a unique model number (ID) and is used by hamlib to
* identify and distinguish between the different hardware drivers. The
* exact model numbers can be acquired using the macros in this file. To
* obtain a list of supported rig branches, one can use the statically
* defined RIG_BACKEND_LIST macro. To obtain a full list of supported rig
* (including each model in every branch), the foreach_opened_rig() API
* function can be used.
*
* The model number, or ID, is used to tell hamlib, which rig the client
* whishes to use. It is done with the rig_init() API call.
/**
* \addtogroup riglist
* @{
*/
/**
* \def RIG_MODEL_NONE
* \brief Hamlib rig (radio) model definitions.
*
* \file riglist.h
*
* This file contains rig (radio) model definitions for the Hamlib rig API.
* Each distinct rig type has a unique model number (ID) and is used by Hamlib
* to identify and distinguish between the different hardware drivers. The
* exact model numbers can be acquired using the macros in this file. To obtain
* a list of supported rig branches, one can use the statically defined
* RIG_BACKEND_LIST macro. To obtain a full list of supported rig (including
* each model in every branch), the foreach_opened_rig() API function can be
* used.
*
* The model number, or ID, is used to tell Hamlib, which rig the client
* wishes to use. It is done with the rig_init() API call.
*/
/** Number of models per backend family. */
#define MAX_MODELS_PER_BACKEND 1000
/**
* \brief The rig model number is held in an unsigned 32-bit integer.
*
* Model numbers are a simple decimal value that increments by a value of
* 1000 for each backend, e.g. the `DUMMY` backend has model numbers 1
* to 1000, the `YAESU` backend has model numbers 1001 to 1100 and so on.
*
* \sa rig_model_t
*/
#define RIG_MAKE_MODEL(a,b) (MAX_MODELS_PER_BACKEND*(a)+(b))
/** Convenience macro to derive the backend family number from the model number. */
#define RIG_BACKEND_NUM(a) ((a)/MAX_MODELS_PER_BACKEND)
/**
* \brief A macro that returns the model number for an unknown model.
*
* The none backend, as the name suggests, does nothing. It is mainly for
@ -62,23 +72,32 @@
*/
#define RIG_MODEL_NONE 0
/*! \def RIG_MODEL_DUMMY
* \brief A macro that returns the model number for the dummy backend.
/**
* \brief The `DUMMY` family.
*
* The dummy backend, as the name suggests, is a backend which performs no
* It has also been expanded to provide support to "virtual" type of rigs such
* as the network rig control backend and W1HKJ's Flrig application and many
* more, especially SDR (Software Defined Radio) applications.
*/
#define RIG_DUMMY 0
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_DUMMY "dummy"
/**
* \brief A macro that returns the model number for `DUMMY`.
*
* The `DUMMY model, as the name suggests, is a model which performs no
* hardware operations and always behaves as one would expect. It can be
* thought of as a hardware simulator and is very useful for testing client
* applications.
*
* It has also been expanded to provide support to "virtual" type of rigs
* such as the network rig control backend and W1HKJ's Flrig application.
*/
//! @cond Doxygen_Suppress
#define RIG_DUMMY 0
#define RIG_BACKEND_DUMMY "dummy"
//! @endcond
#define RIG_MODEL_DUMMY RIG_MAKE_MODEL(RIG_DUMMY, 1)
//! @cond Doxygen_Suppress
/**
* \name NETWORK
* Network models.
*/
///@{
/// Model of the `RIG_DUMMY` backend family.
#define RIG_MODEL_NETRIGCTL RIG_MAKE_MODEL(RIG_DUMMY, 2)
#define RIG_MODEL_ARMSTRONG RIG_MAKE_MODEL(RIG_DUMMY, 3)
#define RIG_MODEL_FLRIG RIG_MAKE_MODEL(RIG_DUMMY, 4)
@ -89,12 +108,22 @@
#define RIG_MODEL_SDRSHARP RIG_MAKE_MODEL(RIG_DUMMY, 9)
#define RIG_MODEL_QUISK RIG_MAKE_MODEL(RIG_DUMMY, 10)
#define RIG_MODEL_GQRX RIG_MAKE_MODEL(RIG_DUMMY, 11)
///@}
/*
* Yaesu
*/
/** The `YAESU` family. */
#define RIG_YAESU 1
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_YAESU "yaesu"
/**
* \name YAESU
* Yaesu models.
*/
///@{
/// Model of the `RIG_YAESU` backend family.
#define RIG_MODEL_FT847 RIG_MAKE_MODEL(RIG_YAESU, 1)
#define RIG_MODEL_FT1000 RIG_MAKE_MODEL(RIG_YAESU, 2)
#define RIG_MODEL_FT1000D RIG_MAKE_MODEL(RIG_YAESU, 3)
@ -146,12 +175,22 @@
#define RIG_MODEL_FT710 RIG_MAKE_MODEL(RIG_YAESU, 49)
#define RIG_MODEL_FT9000OLD RIG_MAKE_MODEL(RIG_YAESU, 50)
#define RIG_MODEL_FTX1 RIG_MAKE_MODEL(RIG_YAESU, 51)
///@}
/*
* Kenwood
*/
/** The `KENWOOD` family. */
#define RIG_KENWOOD 2
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_KENWOOD "kenwood"
/**
* \name KENWOOD
* Kenwood models.
*/
///@{
/// Model of the `RIG_KENWOOD` backend family.
#define RIG_MODEL_TS50 RIG_MAKE_MODEL(RIG_KENWOOD, 1)
#define RIG_MODEL_TS440 RIG_MAKE_MODEL(RIG_KENWOOD, 2)
#define RIG_MODEL_TS450S RIG_MAKE_MODEL(RIG_KENWOOD, 3)
@ -209,12 +248,22 @@
#define RIG_MODEL_TRUSDX RIG_MAKE_MODEL(RIG_KENWOOD, 55)
#define RIG_MODEL_SDRCONSOLE RIG_MAKE_MODEL(RIG_KENWOOD, 56)
#define RIG_MODEL_QRPLABS_QMX RIG_MAKE_MODEL(RIG_KENWOOD,57)
///@}
/*
* Icom
*/
/** The `ICOM` family. */
#define RIG_ICOM 3
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_ICOM "icom"
/**
* \name ICOM
* Icom models.
*/
///@{
/// Model of the `RIG_ICOM` backend family.
#define RIG_MODEL_IC1271 RIG_MAKE_MODEL(RIG_ICOM, 1)
#define RIG_MODEL_IC1275 RIG_MAKE_MODEL(RIG_ICOM, 2)
#define RIG_MODEL_IC271 RIG_MAKE_MODEL(RIG_ICOM, 3)
@ -315,22 +364,42 @@
#define RIG_MODEL_OMNIVIP RIG_MAKE_MODEL(RIG_ICOM, 51) /* OMNI-VI+ */
#define RIG_MODEL_PARAGON2 RIG_MAKE_MODEL(RIG_ICOM, 59)
#define RIG_MODEL_DELTAII RIG_MAKE_MODEL(RIG_ICOM, 64)
///@}
/*
* Icom PCR
*/
/** The `PCR` family. */
#define RIG_PCR 4
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_PCR "pcr"
/**
* \name PCR
* PCR models.
*/
///@{
/// Model of the `RIG_PCR` backend family.
#define RIG_MODEL_PCR1000 RIG_MAKE_MODEL(RIG_PCR, 1)
#define RIG_MODEL_PCR100 RIG_MAKE_MODEL(RIG_PCR, 2)
#define RIG_MODEL_PCR1500 RIG_MAKE_MODEL(RIG_PCR, 3)
#define RIG_MODEL_PCR2500 RIG_MAKE_MODEL(RIG_PCR, 4)
///@}
/*
* AOR
*/
/** The `AOR` family. */
#define RIG_AOR 5
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_AOR "aor"
/**
* \name AOR
* AOR models.
*/
///@{
/// Model of the `RIG_AOR` backend family.
#define RIG_MODEL_AR8200 RIG_MAKE_MODEL(RIG_AOR, 1)
#define RIG_MODEL_AR8000 RIG_MAKE_MODEL(RIG_AOR, 2)
#define RIG_MODEL_AR7030 RIG_MAKE_MODEL(RIG_AOR, 3)
@ -347,12 +416,22 @@
#define RIG_MODEL_AR5000A RIG_MAKE_MODEL(RIG_AOR, 14)
#define RIG_MODEL_AR7030P RIG_MAKE_MODEL(RIG_AOR, 15)
#define RIG_MODEL_SR2200 RIG_MAKE_MODEL(RIG_AOR, 16)
///@}
/*
* JRC
*/
/** The `JRC` family. */
#define RIG_JRC 6
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_JRC "jrc"
/**
* \name JRC
* JRC models.
*/
///@{
/// Model of the `RIG_JRC` backend family.
#define RIG_MODEL_JST145 RIG_MAKE_MODEL(RIG_JRC, 1)
#define RIG_MODEL_JST245 RIG_MAKE_MODEL(RIG_JRC, 2)
#define RIG_MODEL_CMH530 RIG_MAKE_MODEL(RIG_JRC, 3)
@ -360,25 +439,45 @@
#define RIG_MODEL_NRD525 RIG_MAKE_MODEL(RIG_JRC, 5)
#define RIG_MODEL_NRD535 RIG_MAKE_MODEL(RIG_JRC, 6)
#define RIG_MODEL_NRD545 RIG_MAKE_MODEL(RIG_JRC, 7)
///@}
/*
* Radio Shack
* Actually, they might be either Icom or Uniden. TBC --SF
*/
/** The `RADIOSHACK` family. */
#define RIG_RADIOSHACK 7
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_RADIOSHACK "radioshack"
/**
* \name RADIOSHACK
* RadioShack models.
*/
///@{
/// Model of the `RIG_RADIOSHACK` backend family.
#define RIG_MODEL_RS64 RIG_MAKE_MODEL(RIG_RADIOSHACK, 1) /* PRO-64 */
#define RIG_MODEL_RS2005 RIG_MAKE_MODEL(RIG_RADIOSHACK, 2) /* w/ OptoElectronics OS456 Board */
#define RIG_MODEL_RS2006 RIG_MAKE_MODEL(RIG_RADIOSHACK, 3) /* w/ OptoElectronics OS456 Board */
#define RIG_MODEL_RS2035 RIG_MAKE_MODEL(RIG_RADIOSHACK, 4) /* w/ OptoElectronics OS435 Board */
#define RIG_MODEL_RS2042 RIG_MAKE_MODEL(RIG_RADIOSHACK, 5) /* w/ OptoElectronics OS435 Board */
#define RIG_MODEL_RS2041 RIG_MAKE_MODEL(RIG_RADIOSHACK, 6) /* PRO-2041 */
///@}
/*
* Uniden
*/
/** The `UNIDEN` family. */
#define RIG_UNIDEN 8
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_UNIDEN "uniden"
/**
* \name UNIDEN
* Uniden models.
*/
///@{
/// Model of the `RIG_UNIDEN` backend family.
#define RIG_MODEL_BC780 RIG_MAKE_MODEL(RIG_UNIDEN, 1) /* Uniden BC780 - Trunk Tracker "Desktop Radio" */
#define RIG_MODEL_BC245 RIG_MAKE_MODEL(RIG_UNIDEN, 2)
#define RIG_MODEL_BC895 RIG_MAKE_MODEL(RIG_UNIDEN, 3)
@ -391,73 +490,143 @@
#define RIG_MODEL_BCD396T RIG_MAKE_MODEL(RIG_UNIDEN, 10)
#define RIG_MODEL_BCD996T RIG_MAKE_MODEL(RIG_UNIDEN, 11)
#define RIG_MODEL_BC898 RIG_MAKE_MODEL(RIG_UNIDEN, 12)
///@}
/*
* Drake
*/
/** The `DRAKE` family. */
#define RIG_DRAKE 9
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_DRAKE "drake"
/**
* \name DRAKE
* Drake models.
*/
///@{
/// Model of the `RIG_DRAKE` backend family.
#define RIG_MODEL_DKR8 RIG_MAKE_MODEL(RIG_DRAKE, 1)
#define RIG_MODEL_DKR8A RIG_MAKE_MODEL(RIG_DRAKE, 2)
#define RIG_MODEL_DKR8B RIG_MAKE_MODEL(RIG_DRAKE, 3)
///@}
/*
* Lowe
*/
/** The `LOWE` family. */
#define RIG_LOWE 10
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_LOWE "lowe"
/**
* \name LOWE
* Lowe models.
*/
///@{
/// Model of the `RIG_LOWE` backend family.
#define RIG_MODEL_HF150 RIG_MAKE_MODEL(RIG_LOWE, 1)
#define RIG_MODEL_HF225 RIG_MAKE_MODEL(RIG_LOWE, 2)
#define RIG_MODEL_HF250 RIG_MAKE_MODEL(RIG_LOWE, 3)
#define RIG_MODEL_HF235 RIG_MAKE_MODEL(RIG_LOWE, 4)
///@}
/*
* Racal
*/
/** The `RACAL` family. */
#define RIG_RACAL 11
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_RACAL "racal"
/**
* \name RACAL
* Racal models.
*/
///@{
/// Model of the `RIG_RACAL` backend family.
#define RIG_MODEL_RA3790 RIG_MAKE_MODEL(RIG_RACAL, 1)
#define RIG_MODEL_RA3720 RIG_MAKE_MODEL(RIG_RACAL, 2)
#define RIG_MODEL_RA6790 RIG_MAKE_MODEL(RIG_RACAL, 3)
#define RIG_MODEL_RA3710 RIG_MAKE_MODEL(RIG_RACAL, 4)
#define RIG_MODEL_RA3702 RIG_MAKE_MODEL(RIG_RACAL, 5)
///@}
/*
* Watkins-Johnson
*/
/** The `WJ` family. */
#define RIG_WJ 12
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_WJ "wj"
/**
* \name WJ
* Watkins-Johnson models.
*/
///@{
/// Model of the `RIG_WJ` backend family.
#define RIG_MODEL_HF1000 RIG_MAKE_MODEL(RIG_WJ, 1)
#define RIG_MODEL_HF1000A RIG_MAKE_MODEL(RIG_WJ, 2)
#define RIG_MODEL_WJ8711 RIG_MAKE_MODEL(RIG_WJ, 3)
#define RIG_MODEL_WJ8888 RIG_MAKE_MODEL(RIG_WJ, 4)
///@}
/*
* Rohde & Schwarz--ek
*/
/** The `EK` family. */
#define RIG_EK 13
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_EK "ek"
/**
* \name EK
* Rohde & Schwarz EK models.
*/
///@{
/// Model of the `RIG_EK` backend family.
#define RIG_MODEL_ESM500 RIG_MAKE_MODEL(RIG_EK, 1)
#define RIG_MODEL_EK890 RIG_MAKE_MODEL(RIG_EK, 2)
#define RIG_MODEL_EK891 RIG_MAKE_MODEL(RIG_EK, 3)
#define RIG_MODEL_EK895 RIG_MAKE_MODEL(RIG_EK, 4)
#define RIG_MODEL_EK070 RIG_MAKE_MODEL(RIG_EK, 5)
///@}
/*
* Skanti
*/
/** The `SKANTI` family. */
#define RIG_SKANTI 14
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_SKANTI "skanti"
/**
* \name SKANTI
* Skanti models.
*/
///@{
/// Model of the `RIG_SKANTI` backend family.
#define RIG_MODEL_TRP7000 RIG_MAKE_MODEL(RIG_SKANTI, 1)
#define RIG_MODEL_TRP8000 RIG_MAKE_MODEL(RIG_SKANTI, 2)
#define RIG_MODEL_TRP9000 RIG_MAKE_MODEL(RIG_SKANTI, 3)
#define RIG_MODEL_TRP8255 RIG_MAKE_MODEL(RIG_SKANTI, 4)
///@}
/*
* WiNRADiO/LinRADiO
*/
/** The `WINRADIO` family. */
#define RIG_WINRADIO 15
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_WINRADIO "winradio"
/**
* \name WINRADIO
* WiNRADiO/LinRADiO models.
*/
///@{
/// Model of the `RIG_WINRADIO` backend family.
#define RIG_MODEL_WR1000 RIG_MAKE_MODEL(RIG_WINRADIO, 1)
#define RIG_MODEL_WR1500 RIG_MAKE_MODEL(RIG_WINRADIO, 2)
#define RIG_MODEL_WR1550 RIG_MAKE_MODEL(RIG_WINRADIO, 3)
@ -469,12 +638,22 @@
#define RIG_MODEL_G313 RIG_MAKE_MODEL(RIG_WINRADIO, 9)
#define RIG_MODEL_G305 RIG_MAKE_MODEL(RIG_WINRADIO, 10)
#define RIG_MODEL_G315 RIG_MAKE_MODEL(RIG_WINRADIO, 11)
///@}
/*
* Ten Tec
*/
/** The `TENTEC` family. */
#define RIG_TENTEC 16
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_TENTEC "tentec"
/**
* \name TENTEC
* Ten Tec models.
*/
///@{
/// Model of the `RIG_TENTEC` backend family.
#define RIG_MODEL_TT550 RIG_MAKE_MODEL(RIG_TENTEC, 1) /* Pegasus */
#define RIG_MODEL_TT538 RIG_MAKE_MODEL(RIG_TENTEC, 2) /* Jupiter */
#define RIG_MODEL_RX320 RIG_MAKE_MODEL(RIG_TENTEC, 3)
@ -487,54 +666,114 @@
#define RIG_MODEL_TT588 RIG_MAKE_MODEL(RIG_TENTEC, 11) /* Omni-VII */
#define RIG_MODEL_RX331 RIG_MAKE_MODEL(RIG_TENTEC, 12)
#define RIG_MODEL_TT599 RIG_MAKE_MODEL(RIG_TENTEC, 13) /* Eagle */
///@}
/*
* Alinco
*/
/** The `ALINCO` family. */
#define RIG_ALINCO 17
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_ALINCO "alinco"
/**
* \name ALINCO
* Alinco models.
*/
///@{
/// Model of the `RIG_ALINCO` backend family.
#define RIG_MODEL_DX77 RIG_MAKE_MODEL(RIG_ALINCO, 1)
#define RIG_MODEL_DXSR8 RIG_MAKE_MODEL(RIG_ALINCO, 2)
///@}
/*
* Kachina
*/
/** The `KACHINA` family. */
#define RIG_KACHINA 18
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_KACHINA "kachina"
/**
* \name KACHINA
* Kachina model.
*/
///@{
/// Model of the `RIG_KACHINA` backend family.
#define RIG_MODEL_505DSP RIG_MAKE_MODEL(RIG_KACHINA, 1)
///@}
/*
* Gnuradio backend
*/
/** The `GNURADIO` family. */
#define RIG_GNURADIO 20
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_GNURADIO "gnuradio"
/**
* \name GNURADIO
* GNU Radio models.
*/
///@{
/// Model of the `RIG_GNURADIO` backend family.
#define RIG_MODEL_GNURADIO RIG_MAKE_MODEL(RIG_GNURADIO, 1) /* dev model, Chirp source */
#define RIG_MODEL_MC4020 RIG_MAKE_MODEL(RIG_GNURADIO, 2) /* MC4020 */
#define RIG_MODEL_GRAUDIO RIG_MAKE_MODEL(RIG_GNURADIO, 3) /* Sound card source */
#define RIG_MODEL_GRAUDIOIQ RIG_MAKE_MODEL(RIG_GNURADIO, 4) /* I&Q stereo sound card source */
#define RIG_MODEL_USRP_G RIG_MAKE_MODEL(RIG_GNURADIO, 5) /* Universal Software Radio Peripheral */
///@}
/*
* Microtune tuners
*/
/** The `MICROTUNE` family. */
#define RIG_MICROTUNE 21
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_MICROTUNE "microtune"
/**
* \name MICROTUNE
* Microtune models.
*/
///@{
/// Model of the `RIG_MICROTUNE` backend family.
#define RIG_MODEL_MICROTUNE_4937 RIG_MAKE_MODEL(RIG_MICROTUNE, 1) /* eval board */
#define RIG_MODEL_MICROTUNE_4702 RIG_MAKE_MODEL(RIG_MICROTUNE, 2) /* Alan's */
#define RIG_MODEL_MICROTUNE_4707 RIG_MAKE_MODEL(RIG_MICROTUNE, 3)
///@}
/*
* TAPR
*/
/** The `TAPR` family. */
#define RIG_TAPR 22
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_TAPR "tapr"
/**
* \name TAPR
* TAPR model.
*/
///@{
/// Model of the `RIG_TAPR` backend family.
#define RIG_MODEL_DSP10 RIG_MAKE_MODEL(RIG_TAPR, 1)
///@}
/*
* Flex-radio
*/
/** The `FLEXRADIO` family. */
#define RIG_FLEXRADIO 23
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_FLEXRADIO "flexradio"
/**
* \name FLEXRADIO
* FlexRadio models.
*/
///@{
/// Model of the `RIG_FLEXRADIO` backend family.
#define RIG_MODEL_SDR1000 RIG_MAKE_MODEL(RIG_FLEXRADIO, 1)
#define RIG_MODEL_SDR1000RFE RIG_MAKE_MODEL(RIG_FLEXRADIO, 2)
#define RIG_MODEL_DTTSP RIG_MAKE_MODEL(RIG_FLEXRADIO, 3)
@ -547,19 +786,39 @@
#define RIG_MODEL_SMARTSDR_F RIG_MAKE_MODEL(RIG_FLEXRADIO, 10)
#define RIG_MODEL_SMARTSDR_G RIG_MAKE_MODEL(RIG_FLEXRADIO, 11)
#define RIG_MODEL_SMARTSDR_H RIG_MAKE_MODEL(RIG_FLEXRADIO, 12)
///@}
/*
* VEB Funkwerk Köpenick RFT
*/
/** The `RFT` family. */
#define RIG_RFT 24
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_RFT "rft"
/**
* \name RFT
* VEB Funkwerk Köpenick RFT model.
*/
///@{
/// Model of the `RIG_RFT` backend family.
#define RIG_MODEL_EKD500 RIG_MAKE_MODEL(RIG_RFT, 1)
///@}
/*
* Various kits
*/
/** The `KIT` family. */
#define RIG_KIT 25
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_KIT "kit"
/**
* \name KIT
* Various kit models.
*/
///@{
/// Model of the `RIG_KIT` backend family.
#define RIG_MODEL_ELEKTOR304 RIG_MAKE_MODEL(RIG_KIT, 1)
#define RIG_MODEL_DRT1 RIG_MAKE_MODEL(RIG_KIT, 2)
#define RIG_MODEL_DWT RIG_MAKE_MODEL(RIG_KIT, 3)
@ -579,100 +838,213 @@
#define RIG_MODEL_SI570PEABERRY2 RIG_MAKE_MODEL(RIG_KIT, 17) /* Peaberry V2 */
#define RIG_MODEL_FUNCUBEDONGLEPLUS RIG_MAKE_MODEL(RIG_KIT, 18) /* FunCUBE Dongle Pro+ */
#define RIG_MODEL_RSHFIQ RIG_MAKE_MODEL(RIG_KIT, 19) /* RS-HFIQ */
///@}
/*
* SW/FM/TV tuner cards supported by Video4Linux,*BSD, ..
*/
/** The `TUNER` family. */
#define RIG_TUNER 26
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_TUNER "tuner"
/**
* \name TUNER
* Tuner models.
*/
///@{
/// Model of the `RIG_TUNER` backend family.
#define RIG_MODEL_V4L RIG_MAKE_MODEL(RIG_TUNER, 1)
#define RIG_MODEL_V4L2 RIG_MAKE_MODEL(RIG_TUNER, 2)
///@}
/*
* Rohde & Schwarz--rs
*/
/** The `RS` family. */
#define RIG_RS 27
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_RS "rs"
/**
* \name RS
* Rohde & Schwarz RS models.
*/
///@{
/// Model of the `RIG_RS` backend family.
#define RIG_MODEL_ESMC RIG_MAKE_MODEL(RIG_RS, 1)
#define RIG_MODEL_EB200 RIG_MAKE_MODEL(RIG_RS, 2)
#define RIG_MODEL_XK2100 RIG_MAKE_MODEL(RIG_RS, 3)
#define RIG_MODEL_EK89X RIG_MAKE_MODEL(RIG_RS, 4)
#define RIG_MODEL_XK852 RIG_MAKE_MODEL(RIG_RS, 5)
///@}
/*
* Phillips/Simoco PRM80
*/
/** The `PRM80` family. */
#define RIG_PRM80 28
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_PRM80 "prm80"
/**
* \name PRM80
* Phillips/Simoco PRM80 models.
*/
///@{
/// Model of the `RIG_PRM80` backend family.
#define RIG_MODEL_PRM8060 RIG_MAKE_MODEL(RIG_PRM80, 1)
#define RIG_MODEL_PRM8070 RIG_MAKE_MODEL(RIG_PRM80, 2)
///@}
/*
* ADAT by HB9CBU
*
* ADDED: frgo (DG1SBG), 2012-01-01
*/
/** The `ADAT` family. */
#define RIG_ADAT 29
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_ADAT "adat"
/**
* \name ADAT
* ADAT by HB9CBU model.
*/
///@{
/// Model of the `RIG_ADAT` backend family.
#define RIG_MODEL_ADT_200A RIG_MAKE_MODEL(RIG_ADAT, 1)
///@}
/*
* ICOM Marine
*/
/** The `ICMARINE` family. */
#define RIG_ICMARINE 30
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_ICMARINE "icmarine"
/**
* \name ICMARINE
* Icom Marine models.
*/
///@{
/// Model of the `RIG_ICMARINE` backend family.
#define RIG_MODEL_IC_M700PRO RIG_MAKE_MODEL(RIG_ICMARINE, 1)
#define RIG_MODEL_IC_M802 RIG_MAKE_MODEL(RIG_ICMARINE, 2)
#define RIG_MODEL_IC_M710 RIG_MAKE_MODEL(RIG_ICMARINE, 3)
#define RIG_MODEL_IC_M803 RIG_MAKE_MODEL(RIG_ICMARINE, 4)
///@}
/*
* Dorji transceiver modules
*/
/** The `DORJI` family. */
#define RIG_DORJI 31
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_DORJI "dorji"
/**
* \name DORJI
* Dorji models.
*/
///@{
/// Model of the `RIG_DORJI` backend family.
#define RIG_MODEL_DORJI_DRA818V RIG_MAKE_MODEL(RIG_DORJI, 1)
#define RIG_MODEL_DORJI_DRA818U RIG_MAKE_MODEL(RIG_DORJI, 2)
///@}
/*
* Barrett
*/
/** The `BARRET` family. */
#define RIG_BARRETT 32
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_BARRETT "barrett"
/**
* \name BARRET
* Barret models.
*/
///@{
/// Model of the `RIG_BARRETT` backend family.
#define RIG_MODEL_BARRETT_2050 RIG_MAKE_MODEL(RIG_BARRETT, 1)
#define RIG_MODEL_BARRETT_950 RIG_MAKE_MODEL(RIG_BARRETT, 2)
#define RIG_MODEL_BARRETT_4050 RIG_MAKE_MODEL(RIG_BARRETT, 3)
#define RIG_MODEL_BARRETT_4100 RIG_MAKE_MODEL(RIG_BARRETT, 4)
///@}
/*
* Elad
*/
/** The `ELAD` family. */
#define RIG_ELAD 33
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_ELAD "elad"
/**
* \name ELAD
* Elad model.
*/
///@{
/// Model of the `RIG_ELAD` backend family.
#define RIG_MODEL_ELAD_FDM_DUO RIG_MAKE_MODEL(RIG_ELAD, 1)
///@}
/*
* CODAN
*/
/** The `CODAN` family. */
#define RIG_CODAN 34
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_CODAN "codan"
/**
* \name CODAN
* Codan models.
*/
///@{
/// Model of the `RIG_CODAN` backend family.
#define RIG_MODEL_CODAN_ENVOY RIG_MAKE_MODEL(RIG_CODAN, 1)
#define RIG_MODEL_CODAN_NGT RIG_MAKE_MODEL(RIG_CODAN, 2)
#define RIG_MODEL_CODAN_2110 RIG_MAKE_MODEL(RIG_CODAN, 3)
///@}
/*
* Gomspace
*/
/** The `GOMSPACE` family. */
#define RIG_GOMSPACE 35
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_GOMSPACE "gomspace"
/**
* \name GOMSPACE
* GomSpace model.
*/
///@{
/// Model of the `RIG_GOMSPACE` backend family.
#define RIG_MODEL_GS100 RIG_MAKE_MODEL(RIG_GOMSPACE, 1)
///@}
/*
* MDS Microwave Data Systems https://en.wikipedia.org/wiki/Microwave_Data_Systems
*/
/** The `MDS` family. */
#define RIG_MDS 36
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_MDS "MDS"
/**
* \name MDS
* Microwave Data Systems models.
*/
///@{
/// Model of the `RIG_MDS` backend family.
#define RIG_MODEL_MDS4710 RIG_MAKE_MODEL(RIG_MDS, 1)
#define RIG_MODEL_MDS9710 RIG_MAKE_MODEL(RIG_MDS, 2)
///@}
/*
* TODO:
RIG_MODEL_KWZ30, KNEISNER +DOERING
@ -683,37 +1055,73 @@
/*
* AnyTone rigs
*/
/** The `ANYTONE` family. */
#define RIG_ANYTONE 37
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_ANYTONE "AnyTone"
/**
* \name ANYTONE
* AnyTone model.
*/
///@{
/// Model of the `RIG_ANYTONE` backend family.
#define RIG_MODEL_ATD578UVIII RIG_MAKE_MODEL(RIG_ANYTONE, 1)
///@}
/*
* Motorola rigs
*/
/** The `MOTOROLA` family. */
#define RIG_MOTOROLA 38
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_MOTOROLA "Motorola"
/**
* \name MOTOROLA
* Motorola model.
*/
///@{
/// Model of the `RIG_MOTOROLA` backend family.
#define RIG_MODEL_MICOM2 RIG_MAKE_MODEL(RIG_MOTOROLA, 1)
///@}
/*
* Commradio / AeroStream Communications
*/
/** The `COMMRADIO` family. */
#define RIG_COMMRADIO 39
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_COMMRADIO "commradio"
/**
* \name COMMRADIO
* Commradio / AeroStream Communications model.
*/
///@{
/// Model of the `RIG_COMMRADIO` backend family.
#define RIG_MODEL_CTX10 RIG_MAKE_MODEL(RIG_COMMRADIO, 1)
///@}
/*
* GUOHETEC
*/
/** The `GUOHETEC` family. */
#define RIG_GUOHETEC 40
/** Used in register.c for the `be_name`. */
#define RIG_BACKEND_GUOHETEC "guohetec"
/**
* \name GUOHETEC
* GUOHETEC models.
*/
///@{
/// Model of the `RIG_GUOHETEC` backend family.
#define RIG_MODEL_PMR171 RIG_MAKE_MODEL(RIG_GUOHETEC, 1)
#define RIG_MODEL_Q900 RIG_MAKE_MODEL(RIG_GUOHETEC, 2)
///@}
//! @endcond
/*! \typedef typedef int rig_model_t
\brief Convenience type definition for rig model.
*/
/** Convenience type definition for rig model. */
typedef uint32_t rig_model_t;
@ -729,3 +1137,5 @@ typedef uint32_t rig_model_t;
*/
#endif /* _RIGLIST_H */
/** @} */

View file

@ -97,7 +97,19 @@ __END_DECLS
#if defined(IN_HAMLIB)
#define ROTSTATE(r) (&(r)->state)
#endif
/** Macro for application access to rot_state data structure. */
/** Macro for application access to rot_state data structure using the #ROT
* handle
*
* Example code.
* ```
* ROT *my_rot;
*
* //Instantiate a rotator
* my_rot = rot_init(ROT_MODEL_DUMMY); // your rot (rotator) model.
*
* const struct rot_state *my_rs = HAMLIB_ROTSTATE(my_rot);
* ```
*/
#define HAMLIB_ROTSTATE(r) ((struct rot_state *)rot_data_pointer(r, RIG_PTRX_ROTSTATE))
#endif /* _ROT_STATE_H */

View file

@ -510,56 +510,60 @@ struct rot_caps {
*
*/
int (*rot_init)(ROT *rot); /*!< Pointer to backend implementation of ::rot_init(). */
int (*rot_cleanup)(ROT *rot); /*!< Pointer to backend implementation of ::rot_cleanup(). */
int (*rot_open)(ROT *rot); /*!< Pointer to backend implementation of ::rot_open(). */
int (*rot_close)(ROT *rot); /*!< Pointer to backend implementation of ::rot_close(). */
int (*rot_init)(ROT *rot); /*!< Pointer to backend implementation of rot_init(). */
int (*rot_cleanup)(ROT *rot); /*!< Pointer to backend implementation of rot_cleanup(). */
int (*rot_open)(ROT *rot); /*!< Pointer to backend implementation of rot_open(). */
int (*rot_close)(ROT *rot); /*!< Pointer to backend implementation of rot_close(). */
int (*set_conf)(ROT *rot, hamlib_token_t token, const char *val); /*!< Pointer to backend implementation of ::rot_set_conf(). */
int (*get_conf)(ROT *rot, hamlib_token_t token, char *val); /*!< Pointer to backend implementation of ::rot_get_conf(). */
int (*set_conf)(ROT *rot, hamlib_token_t token, const char *val); /*!< Pointer to backend implementation of rot_set_conf(). */
int (*get_conf)(ROT *rot, hamlib_token_t token, char *val); /*!< Pointer to backend implementation of rot_get_conf(). */
/*
* General API commands, from most primitive to least.. :()
* List Set/Get functions pairs
*/
int (*set_position)(ROT *rot, azimuth_t azimuth, elevation_t elevation); /*!< Pointer to backend implementation of ::rot_set_position(). */
int (*get_position)(ROT *rot, azimuth_t *azimuth, elevation_t *elevation); /*!< Pointer to backend implementation of ::rot_get_position(). */
int (*set_position)(ROT *rot, azimuth_t azimuth, elevation_t elevation); /*!< Pointer to backend implementation of rot_set_position(). */
int (*get_position)(ROT *rot, azimuth_t *azimuth, elevation_t *elevation); /*!< Pointer to backend implementation of rot_get_position(). */
int (*stop)(ROT *rot); /*!< Pointer to backend implementation of ::rot_stop(). */
int (*park)(ROT *rot); /*!< Pointer to backend implementation of ::rot_park(). */
int (*reset)(ROT *rot, rot_reset_t reset); /*!< Pointer to backend implementation of ::rot_reset(). */
int (*move)(ROT *rot, int direction, int speed); /*!< Pointer to backend implementation of ::rot_move(). */
int (*stop)(ROT *rot); /*!< Pointer to backend implementation of rot_stop(). */
int (*park)(ROT *rot); /*!< Pointer to backend implementation of rot_park(). */
int (*reset)(ROT *rot, rot_reset_t reset); /*!< Pointer to backend implementation of rot_reset(). */
int (*move)(ROT *rot, int direction, int speed); /*!< Pointer to backend implementation of rot_move(). */
/* get firmware info, etc. */
const char * (*get_info)(ROT *rot); /*!< Pointer to backend implementation of ::rot_get_info(). */
const char * (*get_info)(ROT *rot); /*!< Pointer to backend implementation of rot_get_info(). */
int (*set_level)(ROT *rot, setting_t level, value_t val); /*!< Pointer to backend implementation of ::rot_set_level(). */
int (*get_level)(ROT *rot, setting_t level, value_t *val); /*!< Pointer to backend implementation of ::rot_get_level(). */
int (*set_level)(ROT *rot, setting_t level, value_t val); /*!< Pointer to backend implementation of rot_set_level(). */
int (*get_level)(ROT *rot, setting_t level, value_t *val); /*!< Pointer to backend implementation of rot_get_level(). */
int (*set_func)(ROT *rot, setting_t func, int status); /*!< Pointer to backend implementation of ::rot_set_func(). */
int (*get_func)(ROT *rot, setting_t func, int *status); /*!< Pointer to backend implementation of ::rot_get_func(). */
int (*set_func)(ROT *rot, setting_t func, int status); /*!< Pointer to backend implementation of rot_set_func(). */
int (*get_func)(ROT *rot, setting_t func, int *status); /*!< Pointer to backend implementation of rot_get_func(). */
int (*set_parm)(ROT *rot, setting_t parm, value_t val); /*!< Pointer to backend implementation of ::rot_set_parm(). */
int (*get_parm)(ROT *rot, setting_t parm, value_t *val); /*!< Pointer to backend implementation of ::rot_get_parm(). */
int (*set_parm)(ROT *rot, setting_t parm, value_t val); /*!< Pointer to backend implementation of rot_set_parm(). */
int (*get_parm)(ROT *rot, setting_t parm, value_t *val); /*!< Pointer to backend implementation of rot_get_parm(). */
int (*set_ext_level)(ROT *rot, hamlib_token_t token, value_t val); /*!< Pointer to backend implementation of ::rot_set_ext_level(). */
int (*get_ext_level)(ROT *rot, hamlib_token_t token, value_t *val); /*!< Pointer to backend implementation of ::rot_get_ext_level(). */
int (*set_ext_level)(ROT *rot, hamlib_token_t token, value_t val); /*!< Pointer to backend implementation of rot_set_ext_level(). */
int (*get_ext_level)(ROT *rot, hamlib_token_t token, value_t *val); /*!< Pointer to backend implementation of rot_get_ext_level(). */
int (*set_ext_func)(ROT *rot, hamlib_token_t token, int status); /*!< Pointer to backend implementation of ::rot_set_ext_func(). */
int (*get_ext_func)(ROT *rot, hamlib_token_t token, int *status); /*!< Pointer to backend implementation of ::rot_get_ext_func(). */
int (*set_ext_func)(ROT *rot, hamlib_token_t token, int status); /*!< Pointer to backend implementation of rot_set_ext_func(). */
int (*get_ext_func)(ROT *rot, hamlib_token_t token, int *status); /*!< Pointer to backend implementation of rot_get_ext_func(). */
int (*set_ext_parm)(ROT *rot, hamlib_token_t token, value_t val); /*!< Pointer to backend implementation of ::rot_set_ext_parm(). */
int (*get_ext_parm)(ROT *rot, hamlib_token_t token, value_t *val); /*!< Pointer to backend implementation of ::rot_get_ext_parm(). */
int (*set_ext_parm)(ROT *rot, hamlib_token_t token, value_t val); /*!< Pointer to backend implementation of rot_set_ext_parm(). */
int (*get_ext_parm)(ROT *rot, hamlib_token_t token, value_t *val); /*!< Pointer to backend implementation of rot_get_ext_parm(). */
int (*get_status)(ROT *rot, rot_status_t *status); /*!< Pointer to backend implementation of ::rot_get_status(). */
int (*get_status)(ROT *rot, rot_status_t *status); /*!< Pointer to backend implementation of rot_get_status(). */
const char *macro_name; /*!< Rotator model macro name. */
int (*get_conf2)(ROT *rot, hamlib_token_t token, char *val, int val_len); /*!< Pointer to backend implementation of ::rot_get_conf2(). */
int (*get_conf2)(ROT *rot, hamlib_token_t token, char *val, int val_len); /*!< Pointer to backend implementation of rot_get_conf2(). */
};
//! @cond Doxygen_Suppress
/**
* Convenience macro to map the `rot_model` number and `macro_name` string from rotlist.h.
*
* Used when populating a backend rot_caps structure.
*/
#define ROT_MODEL(arg) .rot_model=arg,.macro_name=#arg
//! @endcond
//---Start cut here---
// Rotator state definition moved to include/hamlib/rot_state.h

File diff suppressed because it is too large Load diff

View file

@ -197,7 +197,7 @@ static void init_chan(RIG *rig, vfo_t vfo, channel_t *chan)
chan->rit = 0;
chan->xit = 0;
chan->tuning_step = 0;
chan->ant = 0;
chan->ant = RIG_ANT_NONE;
chan->funcs = (setting_t)0;
memset(chan->levels, 0, RIG_SETTING_MAX * sizeof(value_t));
@ -1114,11 +1114,25 @@ static int dummy_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
rig_debug(RIG_DEBUG_VERBOSE, "%s: split=%d, vfo=%s, tx_vfo=%s\n",
__func__, split, rig_strvfo(vfo), rig_strvfo(tx_vfo));
switch (split)
{
case RIG_SPLIT_OFF:
priv->split = RIG_SPLIT_OFF;
break;
case RIG_SPLIT_ON:
priv->split = RIG_SPLIT_ON;
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported split %d", __func__, split);
RETURNFUNC(-RIG_EINVAL);
}
if (tx_vfo == RIG_VFO_NONE || tx_vfo == RIG_VFO_CURR) { tx_vfo = priv->curr_vfo; }
if (tx_vfo == RIG_VFO_CURR || tx_vfo == RIG_VFO_TX) { tx_vfo = vfo_fixup(rig, vfo, CACHE(rig)->split); }
priv->split = split;
priv->tx_vfo = tx_vfo;
RETURNFUNC(RIG_OK);
@ -1823,6 +1837,7 @@ static int dummy_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
case RIG_ANT_2:
case RIG_ANT_3:
case RIG_ANT_4:
case RIG_ANT_5:
curr->ant = ant;
break;
@ -1860,6 +1875,7 @@ static int dummy_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
case RIG_ANT_2:
case RIG_ANT_3:
case RIG_ANT_4:
case RIG_ANT_5:
*ant_curr = ant;
break;
@ -2463,14 +2479,14 @@ struct rig_caps dummy_caps =
.agc_levels = { RIG_AGC_OFF, RIG_AGC_SUPERFAST, RIG_AGC_FAST, RIG_AGC_MEDIUM, RIG_AGC_SLOW, RIG_AGC_AUTO, RIG_AGC_USER },
.rx_range_list1 = { {
.startf = kHz(150), .endf = MHz(1500), .modes = DUMMY_MODES,
.low_power = -1, .high_power = -1, DUMMY_VFOS, RIG_ANT_1 | RIG_ANT_2 | RIG_ANT_3 | RIG_ANT_4,
.low_power = -1, .high_power = -1, DUMMY_VFOS, RIG_ANT_1 | RIG_ANT_2 | RIG_ANT_3 | RIG_ANT_4 | RIG_ANT_5,
.label = "Dummy#1"
},
RIG_FRNG_END,
},
.tx_range_list1 = { {
.startf = kHz(150), .endf = MHz(1500), .modes = DUMMY_MODES,
.low_power = W(5), .high_power = W(100), DUMMY_VFOS, RIG_ANT_1 | RIG_ANT_2 | RIG_ANT_3 | RIG_ANT_4,
.low_power = W(5), .high_power = W(100), DUMMY_VFOS, RIG_ANT_1 | RIG_ANT_2 | RIG_ANT_3 | RIG_ANT_4 | RIG_ANT_5,
.label = "Dummy#1"
},
RIG_FRNG_END,

View file

@ -1477,7 +1477,7 @@ int HAMLIB_API rig_set_conf(RIG *rig, hamlib_token_t token, const char *val)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!rig || !rig->caps)
if (!rig || !rig->caps || !val)
{
return -RIG_EINVAL;
}