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

Function rig_get_ts

src/rig.c:6470–6530  ·  view source on GitHub ↗

* \brief get the current Tuning Step * \param rig The rig handle * \param vfo The target VFO * \param ts The location where to store the current tuning step * * Retrieves the current tuning step. * * \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_ts() */

Source from the content-addressed store, hash-verified

6468 * \sa rig_set_ts()
6469 */
6470int HAMLIB_API rig_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts)
6471{
6472 const struct rig_caps *caps;
6473 int retcode, rc2;
6474 vfo_t curr_vfo;
6475
6476 if (CHECK_RIG_ARG(rig))
6477 {
6478 rig_debug(RIG_DEBUG_ERR, "%s: rig or rig->caps is null\n", __func__);
6479 return -RIG_EINVAL;
6480 }
6481
6482 ENTERFUNC;
6483
6484 if (!ts)
6485 {
6486 RETURNFUNC(-RIG_EINVAL);
6487 }
6488
6489 caps = rig->caps;
6490
6491 if (caps->get_ts == NULL)
6492 {
6493 RETURNFUNC(-RIG_ENAVAIL);
6494 }
6495
6496 if (vfo == RIG_VFO_CURR
6497 || vfo == STATE(rig)->current_vfo)
6498 {
6499 HAMLIB_TRACE;
6500 retcode = caps->get_ts(rig, vfo, ts);
6501 RETURNFUNC(retcode);
6502 }
6503
6504 if (!caps->set_vfo)
6505 {
6506 RETURNFUNC(-RIG_ENAVAIL);
6507 }
6508
6509 curr_vfo = STATE(rig)->current_vfo;
6510 HAMLIB_TRACE;
6511 retcode = caps->set_vfo(rig, vfo);
6512
6513 if (retcode != RIG_OK)
6514 {
6515 RETURNFUNC(retcode);
6516 }
6517
6518 HAMLIB_TRACE;
6519 retcode = caps->get_ts(rig, vfo, ts);
6520 /* try and revert even if we had an error above */
6521 rc2 = caps->set_vfo(rig, curr_vfo);
6522
6523 if (RIG_OK == retcode)
6524 {
6525 /* Return the first error code */
6526 retcode = rc2;
6527 }

Callers 3

getTsMethod · 0.85
generic_save_channelFunction · 0.85
rigctl_parse.cFile · 0.85

Calls 1

rig_debugFunction · 0.85

Tested by

no test coverage detected