* \brief get the current split frequencies * \param rig The rig handle * \param vfo The target VFO * \param tx_freq The location where to store the current transmit split frequency * * Retrieves the current split(TX) frequency. * * \return RIG_OK if the operation has been successful, otherwise * a negative value if an error occurred (in which case, cause is * set appropriately). *
| 4937 | * \sa rig_set_split_freq() |
| 4938 | */ |
| 4939 | int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) |
| 4940 | { |
| 4941 | const struct rig_caps *caps; |
| 4942 | const struct rig_state *rs; |
| 4943 | struct rig_cache *cachep; |
| 4944 | int retcode = -RIG_EPROTO, rc2; |
| 4945 | vfo_t tx_vfo; |
| 4946 | |
| 4947 | if (CHECK_RIG_ARG(rig)) |
| 4948 | { |
| 4949 | rig_debug(RIG_DEBUG_ERR, "%s: rig or rig->caps is null\n", __func__); |
| 4950 | return -RIG_EINVAL; |
| 4951 | } |
| 4952 | |
| 4953 | ELAPSED1; |
| 4954 | ENTERFUNC; |
| 4955 | |
| 4956 | if (!tx_freq) |
| 4957 | { |
| 4958 | ELAPSED2; |
| 4959 | RETURNFUNC(-RIG_EINVAL); |
| 4960 | } |
| 4961 | |
| 4962 | caps = rig->caps; |
| 4963 | rs = STATE(rig); |
| 4964 | cachep = CACHE(rig); |
| 4965 | |
| 4966 | // Always use the previously selected TX VFO for split. The targeted VFO will have no effect. |
| 4967 | tx_vfo = rs->tx_vfo; |
| 4968 | |
| 4969 | if (cachep->split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE |
| 4970 | || tx_vfo == RIG_VFO_CURR) |
| 4971 | { |
| 4972 | // Split frequency not available if split is off |
| 4973 | *tx_freq = 0; |
| 4974 | ELAPSED2; |
| 4975 | RETURNFUNC(RIG_OK); |
| 4976 | } |
| 4977 | |
| 4978 | // Use get_split_freq directly if implemented and frequency is targetable |
| 4979 | if (caps->get_split_freq && (caps->targetable_vfo & RIG_TARGETABLE_FREQ)) |
| 4980 | { |
| 4981 | HAMLIB_TRACE; |
| 4982 | retcode = caps->get_split_freq(rig, tx_vfo, tx_freq); |
| 4983 | ELAPSED2; |
| 4984 | |
| 4985 | if (retcode == RIG_OK) |
| 4986 | { |
| 4987 | rig_set_cache_freq(rig, tx_vfo, *tx_freq); |
| 4988 | } |
| 4989 | |
| 4990 | RETURNFUNC(retcode); |
| 4991 | } |
| 4992 | |
| 4993 | // Alternatively, use get_freq if frequency is targetable |
| 4994 | if (caps->get_freq && (caps->targetable_vfo & RIG_TARGETABLE_FREQ)) |
| 4995 | { |
| 4996 | HAMLIB_TRACE; |
no test coverage detected