* \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
| 65 | * \retval -RIG_EINVAL \a amp or \a cfunc is NULL or inconsistent. |
| 66 | */ |
| 67 | int 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 | /** |
no test coverage detected