* \brief set the split mode * \param rig The rig handle * \param rx_vfo The receive VFO * \param split The split mode to set to * \param tx_vfo The transmit VFO * * Sets the current split mode. * * \return RIG_OK if the operation has been successful, otherwise * a negative value if an error occurred (in which case, cause is * set appropriately). * * \sa rig_get_split_vfo() */
| 5746 | * \sa rig_get_split_vfo() |
| 5747 | */ |
| 5748 | int HAMLIB_API rig_set_split_vfo(RIG *rig, |
| 5749 | vfo_t rx_vfo, |
| 5750 | split_t split, |
| 5751 | vfo_t tx_vfo) |
| 5752 | { |
| 5753 | const struct rig_caps *caps; |
| 5754 | struct rig_cache *cachep; |
| 5755 | int retcode; |
| 5756 | struct rig_state *rs; |
| 5757 | vfo_t curr_vfo; |
| 5758 | |
| 5759 | if (CHECK_RIG_ARG(rig)) |
| 5760 | { |
| 5761 | rig_debug(RIG_DEBUG_ERR, "%s: rig or rig->caps is null\n", __func__); |
| 5762 | return -RIG_EINVAL; |
| 5763 | } |
| 5764 | |
| 5765 | caps = rig->caps; |
| 5766 | rs = STATE(rig); |
| 5767 | cachep = CACHE(rig); |
| 5768 | |
| 5769 | ELAPSED1; |
| 5770 | ENTERFUNC; |
| 5771 | rig_debug(RIG_DEBUG_VERBOSE, |
| 5772 | "%s: rx_vfo=%s, split=%d, tx_vfo=%s, cache.split=%d\n", __func__, |
| 5773 | rig_strvfo(rx_vfo), split, rig_strvfo(tx_vfo), cachep->split); |
| 5774 | |
| 5775 | if (caps->set_split_vfo == NULL) |
| 5776 | { |
| 5777 | ELAPSED2; |
| 5778 | RETURNFUNC(-RIG_ENAVAIL); |
| 5779 | } |
| 5780 | |
| 5781 | if (cachep->ptt) |
| 5782 | { |
| 5783 | rig_debug(RIG_DEBUG_WARN, "%s: cannot execute when PTT is on\n", __func__); |
| 5784 | ELAPSED2; |
| 5785 | RETURNFUNC(RIG_OK); |
| 5786 | } |
| 5787 | |
| 5788 | if (rx_vfo == RIG_VFO_NONE || tx_vfo == RIG_VFO_NONE) |
| 5789 | { |
| 5790 | ELAPSED2; |
| 5791 | RETURNFUNC(-RIG_EINVAL); |
| 5792 | } |
| 5793 | |
| 5794 | // We fix up vfos for non-satmode rigs only |
| 5795 | if (caps->has_get_func & RIG_FUNC_SATMODE) |
| 5796 | { |
| 5797 | if (tx_vfo == RIG_VFO_CURR) |
| 5798 | { |
| 5799 | tx_vfo = rs->current_vfo; |
| 5800 | rx_vfo = vfo_fixup(rig, RIG_VFO_OTHER, split); |
| 5801 | } |
| 5802 | |
| 5803 | // Fix up only special cases to allow ambiguous parameters |
| 5804 | if (rx_vfo == tx_vfo) |
| 5805 | { |