MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / rig_get_split_vfo

Function rig_get_split_vfo

src/rig.c:5999–6081  ·  view source on GitHub ↗

* \brief get the current split mode * \param rig The rig handle * \param vfo The target VFO * \param split The location where to store the current split mode * \param tx_vfo The transmit VFO * * Retrieves 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).

Source from the content-addressed store, hash-verified

5997 * \sa rig_set_split_vfo()
5998 */
5999int HAMLIB_API rig_get_split_vfo(RIG *rig,
6000 vfo_t vfo,
6001 split_t *split,
6002 vfo_t *tx_vfo)
6003{
6004 const struct rig_caps *caps;
6005 struct rig_state *rs;
6006 struct rig_cache *cachep;
6007 int retcode;
6008 int cache_ms;
6009 int use_cache = 0;
6010
6011 if (CHECK_RIG_ARG(rig))
6012 {
6013 rig_debug(RIG_DEBUG_ERR, "%s: rig or rig->caps is null\n", __func__);
6014 return -RIG_EINVAL;
6015 }
6016
6017 ELAPSED1;
6018 ENTERFUNC;
6019
6020 if (!split || !tx_vfo)
6021 {
6022 rig_debug(RIG_DEBUG_ERR, "%s: split or tx_vfo is null, split=%p, tx_vfo=%p\n",
6023 __func__, split, tx_vfo);
6024 ELAPSED2;
6025 RETURNFUNC(-RIG_EINVAL);
6026 }
6027
6028 caps = rig->caps;
6029 rs = STATE(rig);
6030 cachep = CACHE(rig);
6031
6032 if (MUTEX_CHECK(&morse_mutex))
6033 {
6034 use_cache = 1;
6035 }
6036
6037 if (caps->get_split_vfo == NULL || use_cache)
6038 {
6039 rig_debug(RIG_DEBUG_TRACE, "%s: ?get_split_vfo=%d use_cache=%d\n", __func__,
6040 caps->get_split_vfo != NULL, use_cache);
6041 // if we can't get the vfo we will return whatever we have cached
6042 *split = cachep->split;
6043 *tx_vfo = cachep->split_vfo;
6044 ELAPSED2;
6045 RETURNFUNC(RIG_OK);
6046 }
6047
6048 cache_ms = elapsed_ms(&cachep->time_split, HAMLIB_ELAPSED_GET);
6049 rig_debug(RIG_DEBUG_TRACE, "%s: cache check age=%dms\n", __func__, cache_ms);
6050
6051 if (cache_ms < cachep->timeout_ms)
6052 {
6053 *split = cachep->split;
6054 *tx_vfo = cachep->split_vfo;
6055 rig_debug(RIG_DEBUG_TRACE, "%s: cache hit age=%dms, split=%d, tx_vfo=%s\n",
6056 __func__, cache_ms, *split, rig_strvfo(*tx_vfo));

Callers 13

flrig_openFunction · 0.85
newcat_set_modeFunction · 0.85
kenwood_set_split_vfoFunction · 0.85
getSplitVFOMethod · 0.85
rig_openFunction · 0.85
rig_get_vfo_infoFunction · 0.85
multicast_status_changedFunction · 0.85
generic_save_channelFunction · 0.85
mainFunction · 0.85
handle_ts2000Function · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 4

rig_debugFunction · 0.85
MUTEX_CHECKFunction · 0.85
elapsed_msFunction · 0.85
rig_strvfoFunction · 0.85

Tested by 3

mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68