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

Function rig_get_mode

src/rig.c:3039–3192  ·  view source on GitHub ↗

* \brief get the mode of the target VFO * \param rig The rig handle * \param vfo The target VFO * \param mode The location where to store the current mode * \param width The location where to store the current passband width * * Retrieves the mode and passband of the target VFO. * If the backend is unable to determine the width, the \a width * will be set to RIG_PASSBAND_NORMAL as

Source from the content-addressed store, hash-verified

3037 * \sa rig_set_mode()
3038 */
3039int HAMLIB_API rig_get_mode(RIG *rig,
3040 vfo_t vfo,
3041 rmode_t *mode,
3042 pbwidth_t *width)
3043{
3044 const struct rig_caps *caps;
3045 struct rig_state *rs;
3046 int retcode;
3047 int use_cache = 0;
3048 freq_t freq;
3049 vfo_t curr_vfo;
3050 struct rig_cache *cachep;
3051
3052 if (CHECK_RIG_ARG(rig))
3053 {
3054 rig_debug(RIG_DEBUG_ERR, "%s: rig or rig->caps is null\n", __func__);
3055 return -RIG_EINVAL;
3056 }
3057
3058 ELAPSED1;
3059 ENTERFUNC;
3060
3061 if (!mode || !width)
3062 {
3063 ELAPSED2;
3064 RETURNFUNC(-RIG_EINVAL);
3065 }
3066
3067 caps = rig->caps;
3068 rs = STATE(rig);
3069 cachep = CACHE(rig);
3070
3071 if (caps->get_mode == NULL)
3072 {
3073 ELAPSED2;
3074 RETURNFUNC(-RIG_ENAVAIL);
3075 }
3076
3077 curr_vfo = rs->current_vfo;
3078 vfo = vfo_fixup(rig, vfo, cachep->split);
3079
3080 if (vfo == RIG_VFO_CURR) { vfo = curr_vfo; }
3081
3082 *mode = RIG_MODE_NONE;
3083 rig_cache_show(rig, __func__, __LINE__);
3084 int cache_ms_freq, cache_ms_mode, cache_ms_width;
3085 rig_get_cache(rig, vfo, &freq, &cache_ms_freq, mode, &cache_ms_mode, width,
3086 &cache_ms_width);
3087 rig_debug(RIG_DEBUG_TRACE, "%s: %s cache check age=%dms\n", __func__,
3088 rig_strvfo(vfo), cache_ms_mode);
3089
3090 rig_cache_show(rig, __func__, __LINE__);
3091
3092 if (MUTEX_CHECK(&morse_mutex))
3093 {
3094 use_cache = 1;
3095 }
3096

Callers 15

barrett_set_modeFunction · 0.85
mds_set_modeFunction · 0.85
rig2icom_modeFunction · 0.85
icom_set_modeFunction · 0.85
newcat_set_freqFunction · 0.85
newcat_set_modeFunction · 0.85
ft1000mp_get_split_modeFunction · 0.85
ftx1_get_ts_exFunction · 0.85
ftx1_set_ts_exFunction · 0.85
kenwood_set_modeFunction · 0.85

Calls 8

rig_debugFunction · 0.85
vfo_fixupFunction · 0.85
rig_cache_showFunction · 0.85
rig_get_cacheFunction · 0.85
rig_strvfoFunction · 0.85
MUTEX_CHECKFunction · 0.85
rig_passband_normalFunction · 0.85
rig_set_cache_modeFunction · 0.85

Tested by 3

mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68