Logo Search packages:      
Sourcecode: hamlib version File versions  Download package

int HAMLIB_API rig_token_foreach ( RIG rig,
int(*)(const struct confparams *, rig_ptr_t)  cfunc,
rig_ptr_t  data 
)

call a function against each configuration token of a rig

Parameters:
rig The rig handle
cfunc The function to perform on each token
data Any data to be passed to cfunc
Executes cfunc on all the elements stored in the conf table. rig_token_foreach starts first with backend conf table, then finish with frontend table.

Returns:
RIG_OK if the operation has been sucessful, otherwise a negative value if an error occured (in which case, cause is set appropriately).

Definition at line 456 of file conf.c.

References caps, rig_caps::cfgparams, confparams::name, rig_caps::port_type, RIG_EINVAL, RIG_OK, and RIG_PORT_SERIAL.

{
      const struct confparams *cfp;

      if (!rig || !rig->caps || !cfunc)
            return -RIG_EINVAL;

      for (cfp = frontend_cfg_params; cfp->name; cfp++)
            if ((*cfunc)(cfp, data) == 0)
                  return RIG_OK;

      if (rig->caps->port_type == RIG_PORT_SERIAL) {
            for (cfp = frontend_serial_cfg_params; cfp->name; cfp++)
                  if ((*cfunc)(cfp, data) == 0)
                        return RIG_OK;
      }

      for (cfp = rig->caps->cfgparams; cfp && cfp->name; cfp++)
            if ((*cfunc)(cfp, data) == 0)
                  return RIG_OK;

      return RIG_OK;
}


Generated by  Doxygen 1.6.0   Back to index