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

int HAMLIB_API rig_get_split_mode ( RIG rig,
vfo_t  vfo,
rmode_t tx_mode,
pbwidth_t tx_width 
)

get the current split modes

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

Returns:
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:
rig_set_split_mode()

Definition at line 1772 of file rig.c.

References caps, rig_state::current_vfo, rig_caps::get_mode, rig_caps::get_split_mode, RIG_EINVAL, RIG_ENAVAIL, rig_has_vfo_op(), RIG_MODE_NONE, RIG_OK, RIG_OP_TOGGLE, rig_passband_normal(), RIG_VFO_CURR, RIG_VFO_TX, rig_caps::set_vfo, state, rig_caps::targetable_vfo, rig_state::tx_vfo, and rig_caps::vfo_op.

{
      const struct rig_caps *caps;
      int retcode;
      vfo_t curr_vfo, tx_vfo;

      if (CHECK_RIG_ARG(rig) || !tx_mode || !tx_width)
            return -RIG_EINVAL;

      caps = rig->caps;

      if (caps->get_split_mode &&
                  ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || 
                   vfo == RIG_VFO_CURR || vfo == RIG_VFO_TX ||
                   vfo == rig->state.current_vfo))
            return caps->get_split_mode(rig, vfo, tx_mode, tx_width);

      /* Assisted mode */

      curr_vfo = rig->state.current_vfo;

      /* Use previously setup TxVFO */
      if (vfo == RIG_VFO_CURR || vfo == RIG_VFO_TX)
            tx_vfo = rig->state.tx_vfo;
      else
            tx_vfo = vfo;

      if (caps->get_mode && (caps->targetable_vfo&RIG_TARGETABLE_MODE))
            return caps->get_mode(rig, tx_vfo, tx_mode, tx_width);


      if (caps->set_vfo) {
            retcode = caps->set_vfo(rig, tx_vfo);
      } else if (rig_has_vfo_op(rig, RIG_OP_TOGGLE) && caps->vfo_op) {
            retcode = caps->vfo_op(rig, vfo, RIG_OP_TOGGLE);
      } else {
            return -RIG_ENAVAIL;
      }
      if (retcode != RIG_OK)
            return retcode;

      if (caps->get_split_mode)
            retcode = caps->get_split_mode(rig, vfo, tx_mode, tx_width);
      else
            retcode = caps->get_mode(rig, RIG_VFO_CURR, tx_mode, tx_width);

      if (caps->set_vfo) {
            caps->set_vfo(rig, curr_vfo);
      } else {
            caps->vfo_op(rig, vfo, RIG_OP_TOGGLE);
      }

      if (*tx_width == RIG_PASSBAND_NORMAL && *tx_mode != RIG_MODE_NONE)
            *tx_width = rig_passband_normal (rig, *tx_mode);

      return retcode;
}


Generated by  Doxygen 1.6.0   Back to index