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

int HAMLIB_API rig_get_mode ( RIG rig,
vfo_t  vfo,
rmode_t mode,
pbwidth_t width 

get the mode of the target VFO

rig The rig handle
vfo The target VFO
mode The location where to store the current mode
width The location where to store the current passband width
Retrieves the mode and passband of the target VFO. If the backend is unable to determine the width, the width will be set to RIG_PASSBAND_NORMAL as a default. The value stored at mode location equals RIG_MODE_NONE when the current mode of the VFO is not defined (e.g. blank memory).

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

Definition at line 893 of file rig.c.

References rig::caps, rig_state::current_mode, rig_state::current_vfo, rig_state::current_width, rig_caps::get_mode, RIG_VFO_CURR, rig_caps::set_vfo, rig::state, and rig_caps::targetable_vfo.

      const struct rig_caps *caps;
      int retcode;
      vfo_t curr_vfo;

      if (CHECK_RIG_ARG(rig) || !mode || !width)
            return -RIG_EINVAL;

      caps = rig->caps;

      if (caps->get_mode == NULL)
            return -RIG_ENAVAIL;

      if ((caps->targetable_vfo&RIG_TARGETABLE_MODE) || 
                  vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) {
            retcode = caps->get_mode(rig, vfo, mode, width);
      } else {

            if (!caps->set_vfo)
                  return -RIG_ENTARGET;
            curr_vfo = rig->state.current_vfo;
            retcode = caps->set_vfo(rig, vfo);
            if (retcode != RIG_OK)
                  return retcode;

            retcode = caps->get_mode(rig, vfo, mode, width);
            caps->set_vfo(rig, curr_vfo);

      if (retcode == RIG_OK &&
                  (vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo)) {
            rig->state.current_mode = *mode;
            rig->state.current_width = *width;

      return retcode;

Generated by  Doxygen 1.6.0   Back to index