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

Function rig_get_rit

src/rig.c:6170–6231  ·  view source on GitHub ↗

* \brief get the current RIT offset * \param rig The rig handle * \param vfo The target VFO * \param rit The location where to store the current RIT offset * * Retrieves the current RIT offset. * * \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_set_rit() */

Source from the content-addressed store, hash-verified

6168 * \sa rig_set_rit()
6169 */
6170int HAMLIB_API rig_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
6171{
6172 const struct rig_caps *caps;
6173 int retcode, rc2;
6174 vfo_t curr_vfo;
6175
6176 if (CHECK_RIG_ARG(rig))
6177 {
6178 rig_debug(RIG_DEBUG_ERR, "%s: rig or rig->caps is null\n", __func__);
6179 return -RIG_EINVAL;
6180 }
6181
6182 ENTERFUNC;
6183
6184 if (!rit)
6185 {
6186 RETURNFUNC(-RIG_EINVAL);
6187 }
6188
6189 caps = rig->caps;
6190
6191 if (caps->get_rit == NULL)
6192 {
6193 RETURNFUNC(-RIG_ENAVAIL);
6194 }
6195
6196 if ((caps->targetable_vfo & RIG_TARGETABLE_RITXIT)
6197 || vfo == RIG_VFO_CURR
6198 || vfo == STATE(rig)->current_vfo)
6199 {
6200 HAMLIB_TRACE;
6201 retcode = caps->get_rit(rig, vfo, rit);
6202 RETURNFUNC(retcode);
6203 }
6204
6205 if (!caps->set_vfo)
6206 {
6207 RETURNFUNC(-RIG_ENAVAIL);
6208 }
6209
6210 curr_vfo = STATE(rig)->current_vfo;
6211 HAMLIB_TRACE;
6212 retcode = caps->set_vfo(rig, vfo);
6213
6214 if (retcode != RIG_OK)
6215 {
6216 RETURNFUNC(retcode);
6217 }
6218
6219 HAMLIB_TRACE;
6220 retcode = caps->get_rit(rig, vfo, rit);
6221 /* try and revert even if we had an error above */
6222 rc2 = caps->set_vfo(rig, curr_vfo);
6223
6224 if (RIG_OK == retcode)
6225 {
6226 /* Return the first error code */
6227 retcode = rc2;

Callers 3

getRitMethod · 0.85
generic_save_channelFunction · 0.85
rigctl_parse.cFile · 0.85

Calls 1

rig_debugFunction · 0.85

Tested by

no test coverage detected