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

int HAMLIB_API rig_get_freq ( RIG rig,
vfo_t  vfo,
freq_t freq 

get the frequency of the target VFO

rig The rig handle
vfo The target VFO
freq The location where to store the current frequency
Retrieves the frequency of the target VFO. The value stored at freq location equals RIG_FREQ_NONE when the current frequency 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 802 of file rig.c.

References caps, rig_state::current_freq, rig_state::current_vfo, rig_caps::get_freq, RIG_EINVAL, RIG_ENAVAIL, RIG_OK, RIG_VFO_CURR, rig_caps::set_vfo, state, rig_caps::targetable_vfo, and rig_state::vfo_comp.

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

      if (CHECK_RIG_ARG(rig) || !freq)
            return -RIG_EINVAL;

      caps = rig->caps;

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

      if ((caps->targetable_vfo&RIG_TARGETABLE_FREQ) || 
                  vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) {
            retcode = caps->get_freq(rig, vfo, freq);
      } else {
            if (!caps->set_vfo)
                  return -RIG_ENAVAIL;
            curr_vfo = rig->state.current_vfo;
            retcode = caps->set_vfo(rig, vfo);
            if (retcode != RIG_OK)
                  return retcode;
            retcode = caps->get_freq(rig, vfo, freq);
            caps->set_vfo(rig, curr_vfo);
      /* VFO compensation */
      if (rig->state.vfo_comp != 0.0)
            *freq += (freq_t)(rig->state.vfo_comp * (*freq));

      if (retcode == RIG_OK &&
                  (vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo))
            rig->state.current_freq = *freq;

      return retcode;

Generated by  Doxygen 1.6.0   Back to index