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

Function rot_ext_func_foreach

src/rot_ext.c:92–128  ·  view source on GitHub ↗

* \brief Executes \a cfunc on all the elements stored in the * rot_caps::extfuncs table. * * \param rot The #ROT handle. * \param cfunc Callback function of each rot_caps::extfunc. * \param data Cookie to be passed to the callback function \a cfunc. * * The callback \a cfunc is called until it returns a value which is not * strictly positive. * * \returns A zero value means a normal end

Source from the content-addressed store, hash-verified

90 * \retval -RIG_EINVAL \a rot or \a cfunc is NULL or inconsistent.
91 */
92int HAMLIB_API rot_ext_func_foreach(ROT *rot,
93 int (*cfunc)(ROT *,
94 const struct confparams *,
95 rig_ptr_t),
96 rig_ptr_t data)
97{
98 const struct confparams *cfp;
99
100 rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
101
102 if (!rot || !rot->caps || !cfunc)
103 {
104 return -RIG_EINVAL;
105 }
106
107 for (cfp = rot->caps->extfuncs; cfp && cfp->name; cfp++)
108 {
109 if (!rot_has_ext_token(rot, cfp->token))
110 {
111 continue;
112 }
113
114 int ret = (*cfunc)(rot, cfp, data);
115
116 if (ret == 0)
117 {
118 return RIG_OK;
119 }
120
121 if (ret < 0)
122 {
123 return ret;
124 }
125 }
126
127 return RIG_OK;
128}
129
130
131/**

Callers 1

dumpcaps_rotFunction · 0.85

Calls 2

rig_debugFunction · 0.85
rot_has_ext_tokenFunction · 0.85

Tested by

no test coverage detected