Michael Black W9MDB 2021-01-02 23:37:54 -06:00
rodzic 1994abd031
commit 90bdf5248c
2 zmienionych plików z 39 dodań i 0 usunięć

Wyświetl plik

@ -2876,6 +2876,10 @@ extern HAMLIB_EXPORT(int)
rig_list_foreach HAMLIB_PARAMS((int (*cfunc)(const struct rig_caps *, rig_ptr_t), rig_list_foreach HAMLIB_PARAMS((int (*cfunc)(const struct rig_caps *, rig_ptr_t),
rig_ptr_t data)); rig_ptr_t data));
extern HAMLIB_EXPORT(int)
rig_list_foreach_model HAMLIB_PARAMS((int (*cfunc)(const rig_model_t rig_model, rig_ptr_t),
rig_ptr_t data));
extern HAMLIB_EXPORT(int) extern HAMLIB_EXPORT(int)
rig_load_backend HAMLIB_PARAMS((const char *be_name)); rig_load_backend HAMLIB_PARAMS((const char *be_name));

Wyświetl plik

@ -382,6 +382,41 @@ int HAMLIB_API rig_list_foreach(int (*cfunc)(const struct rig_caps *,
} }
//! @endcond //! @endcond
/*
* rig_list_foreach_model
* executes cfunc on all the elements stored in the rig hash list
*/
//! @cond Doxygen_Suppress
int HAMLIB_API rig_list_foreach_model(int (*cfunc)(const rig_model_t rig_model,
rig_ptr_t),
rig_ptr_t data)
{
struct rig_list *p;
int i;
if (!cfunc)
{
return -RIG_EINVAL;
}
for (i = 0; i < RIGLSTHASHSZ; i++)
{
struct rig_list *next = NULL;
for (p = rig_hash_table[i]; p; p = next)
{
next = p->next; /* read before call in case it is unregistered */
if ((*cfunc)(p->caps->rig_model, data) == 0)
{
return RIG_OK;
}
}
}
return RIG_OK;
}
//! @endcond
//! @cond Doxygen_Suppress //! @cond Doxygen_Suppress
static int dummy_rig_probe(const hamlib_port_t *p, static int dummy_rig_probe(const hamlib_port_t *p,