* \brief get the current split frequency and mode * \param rig The rig handle * \param vfo The target VFO * \param tx_freq The location where to store the current transmit frequency * \param tx_mode The location where to store the current transmit split mode * \param tx_width The location where to store the current transmit split width * * Retrieves the current split(TX) frequency,
| 5658 | * \sa rig_get_split_freq(), rig_get_split_mode(), rig_set_split_freq_mode() |
| 5659 | */ |
| 5660 | int HAMLIB_API rig_get_split_freq_mode(RIG *rig, |
| 5661 | vfo_t vfo, |
| 5662 | freq_t *tx_freq, |
| 5663 | rmode_t *tx_mode, |
| 5664 | pbwidth_t *tx_width) |
| 5665 | { |
| 5666 | const struct rig_caps *caps; |
| 5667 | const struct rig_state *rs; |
| 5668 | struct rig_cache *cachep; |
| 5669 | vfo_t tx_vfo; |
| 5670 | int retcode; |
| 5671 | |
| 5672 | if (CHECK_RIG_ARG(rig)) |
| 5673 | { |
| 5674 | rig_debug(RIG_DEBUG_ERR, "%s: rig or rig->caps is null\n", __func__); |
| 5675 | return -RIG_EINVAL; |
| 5676 | } |
| 5677 | |
| 5678 | ELAPSED1; |
| 5679 | ENTERFUNC; |
| 5680 | |
| 5681 | if (!tx_freq || !tx_mode || !tx_width) |
| 5682 | { |
| 5683 | ELAPSED2; |
| 5684 | RETURNFUNC(-RIG_EINVAL); |
| 5685 | } |
| 5686 | |
| 5687 | caps = rig->caps; |
| 5688 | rs = STATE(rig); |
| 5689 | cachep = CACHE(rig); |
| 5690 | |
| 5691 | // Always use the previously selected TX VFO for split. The targeted VFO will have no effect. |
| 5692 | tx_vfo = rs->tx_vfo; |
| 5693 | |
| 5694 | if (cachep->split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE |
| 5695 | || tx_vfo == RIG_VFO_CURR) |
| 5696 | { |
| 5697 | // Split frequency, mode and filter width are not available if split is off |
| 5698 | *tx_freq = 0; |
| 5699 | *tx_mode = RIG_MODE_NONE; |
| 5700 | *tx_width = 0; |
| 5701 | ELAPSED2; |
| 5702 | RETURNFUNC(RIG_OK); |
| 5703 | } |
| 5704 | |
| 5705 | if (caps->get_split_freq_mode) |
| 5706 | { |
| 5707 | retcode = caps->get_split_freq_mode(rig, tx_vfo, tx_freq, tx_mode, tx_width); |
| 5708 | ELAPSED2; |
| 5709 | |
| 5710 | if (retcode == RIG_OK) |
| 5711 | { |
| 5712 | rig_set_cache_freq(rig, tx_vfo, *tx_freq); |
| 5713 | rig_set_cache_mode(rig, tx_vfo, *tx_mode, *tx_width); |
| 5714 | } |
| 5715 | |
| 5716 | RETURNFUNC(retcode); |
| 5717 | } |
no test coverage detected