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

Function rig_get_xit

src/rig.c:6320–6381  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

6318 * \sa rig_set_xit()
6319 */
6320int HAMLIB_API rig_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit)
6321{
6322 const struct rig_caps *caps;
6323 int retcode, rc2;
6324 vfo_t curr_vfo;
6325
6326 if (CHECK_RIG_ARG(rig))
6327 {
6328 rig_debug(RIG_DEBUG_ERR, "%s: rig or rig->caps is null\n", __func__);
6329 return -RIG_EINVAL;
6330 }
6331
6332 ENTERFUNC;
6333
6334 if (!xit)
6335 {
6336 RETURNFUNC(-RIG_EINVAL);
6337 }
6338
6339 caps = rig->caps;
6340
6341 if (caps->get_xit == NULL)
6342 {
6343 RETURNFUNC(-RIG_ENAVAIL);
6344 }
6345
6346 if ((caps->targetable_vfo & RIG_TARGETABLE_RITXIT)
6347 || vfo == RIG_VFO_CURR
6348 || vfo == STATE(rig)->current_vfo)
6349 {
6350 HAMLIB_TRACE;
6351 retcode = caps->get_xit(rig, vfo, xit);
6352 RETURNFUNC(retcode);
6353 }
6354
6355 if (!caps->set_vfo)
6356 {
6357 RETURNFUNC(-RIG_ENAVAIL);
6358 }
6359
6360 curr_vfo = STATE(rig)->current_vfo;
6361 HAMLIB_TRACE;
6362 retcode = caps->set_vfo(rig, vfo);
6363
6364 if (retcode != RIG_OK)
6365 {
6366 RETURNFUNC(retcode);
6367 }
6368
6369 HAMLIB_TRACE;
6370 retcode = caps->get_xit(rig, vfo, xit);
6371 /* try and revert even if we had an error above */
6372 rc2 = caps->set_vfo(rig, curr_vfo);
6373
6374 if (RIG_OK == retcode)
6375 {
6376 /* Return the first error code */
6377 retcode = rc2;

Callers 3

getXitMethod · 0.85
generic_save_channelFunction · 0.85
rigctl_parse.cFile · 0.85

Calls 1

rig_debugFunction · 0.85

Tested by

no test coverage detected