* \param rig The rig handle * \param cfunc callback function of each extlevel * \param data cookie to be passed to \a cfunc callback * \brief Executes cfunc on all the elements stored in the extlevels table * * The callback \a cfunc is called until it returns a value which is not * strictly positive. A zero value means a normal end of iteration, and a * negative value an abnormal end, whic
| 129 | * rig_ext_level_foreach. |
| 130 | */ |
| 131 | int HAMLIB_API rig_ext_level_foreach(RIG *rig, |
| 132 | int (*cfunc)(RIG *, |
| 133 | const struct confparams *, |
| 134 | rig_ptr_t), |
| 135 | rig_ptr_t data) |
| 136 | { |
| 137 | const struct confparams *cfp; |
| 138 | |
| 139 | rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); |
| 140 | |
| 141 | if (!rig || !rig->caps || !cfunc) |
| 142 | { |
| 143 | return -RIG_EINVAL; |
| 144 | } |
| 145 | |
| 146 | for (cfp = rig->caps->extlevels; cfp && cfp->name; cfp++) |
| 147 | { |
| 148 | if (!rig_has_ext_token(rig, cfp->token)) |
| 149 | { |
| 150 | continue; |
| 151 | } |
| 152 | |
| 153 | int ret = (*cfunc)(rig, cfp, data); |
| 154 | |
| 155 | if (ret == 0) |
| 156 | { |
| 157 | return RIG_OK; |
| 158 | } |
| 159 | |
| 160 | if (ret < 0) |
| 161 | { |
| 162 | return ret; |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | return RIG_OK; |
| 167 | } |
| 168 | |
| 169 | |
| 170 | /** |
no test coverage detected