MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / amp_ext_level_foreach

Function amp_ext_level_foreach

src/extamp.c:67–98  ·  view source on GitHub ↗

* \brief Executes \a cfunc on all the elements stored in the amp_caps::extlevels * extension levels table. * * \param amp The #AMP handle. * \param cfunc Callback function of each amp_caps::extlevels. * \param data Cookie to be passed to the callback function \a cfunc. * * The callback function \a cfunc is called until it returns a value which is * not strictly positive. * * \returns A z

Source from the content-addressed store, hash-verified

65 * \retval -RIG_EINVAL \a amp or \a cfunc is NULL or inconsistent.
66 */
67int HAMLIB_API amp_ext_level_foreach(AMP *amp,
68 int (*cfunc)(AMP *,
69 const struct confparams *,
70 amp_ptr_t),
71 amp_ptr_t data)
72{
73 const struct confparams *cfp;
74
75 rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
76
77 if (!amp || !amp->caps || !cfunc)
78 {
79 return -RIG_EINVAL;
80 }
81
82 for (cfp = amp->caps->extlevels; cfp && cfp->name; cfp++)
83 {
84 int ret = (*cfunc)(amp, cfp, data);
85
86 if (ret == 0)
87 {
88 return RIG_OK;
89 }
90
91 if (ret < 0)
92 {
93 return ret;
94 }
95 }
96
97 return RIG_OK;
98}
99
100
101/**

Callers 1

never_usedFunction · 0.85

Calls 1

rig_debugFunction · 0.85

Tested by

no test coverage detected