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

Function rig_get_ant

src/rig.c:6632–6702  ·  view source on GitHub ↗

* \brief get the current antenna * \param rig The rig handle * \param vfo The target VFO * \param ant The antenna to query option for * \param option The option value for the antenna, rig specific. * \param ant_curr The currently selected antenna * \param ant_tx The currently selected TX antenna * \param ant_rx The currently selected RX antenna * * Retrieves the current antenna

Source from the content-addressed store, hash-verified

6630 * \sa rig_set_ant()
6631 */
6632int HAMLIB_API rig_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
6633 ant_t *ant_curr, ant_t *ant_tx, ant_t *ant_rx)
6634{
6635 const struct rig_caps *caps;
6636 int retcode, rc2;
6637 vfo_t curr_vfo;
6638
6639 if (CHECK_RIG_ARG(rig))
6640 {
6641 rig_debug(RIG_DEBUG_ERR, "%s: rig or rig->caps is null\n", __func__);
6642 return -RIG_EINVAL;
6643 }
6644
6645 ENTERFUNC;
6646
6647 if (ant_curr == NULL || ant_tx == NULL || ant_rx == NULL)
6648 {
6649 rig_debug(RIG_DEBUG_ERR,
6650 "%s: null pointer in ant_curr=%p, ant_tx=%p, ant_rx=%p\n", __func__, ant_curr,
6651 ant_tx, ant_rx);
6652 RETURNFUNC(-RIG_EINVAL);
6653 }
6654
6655 caps = rig->caps;
6656
6657 if (caps->get_ant == NULL)
6658 {
6659 RETURNFUNC(-RIG_ENAVAIL);
6660 }
6661
6662 /* Set antenna default to unknown and clear option.
6663 * So we have sane defaults for all backends */
6664 *ant_tx = *ant_rx = *ant_curr = RIG_ANT_UNKNOWN;
6665 option->i = 0;
6666
6667 if ((caps->targetable_vfo & RIG_TARGETABLE_ANT)
6668 || vfo == RIG_VFO_CURR
6669 || vfo == STATE(rig)->current_vfo)
6670 {
6671 HAMLIB_TRACE;
6672 retcode = caps->get_ant(rig, vfo, ant, option, ant_curr, ant_tx, ant_rx);
6673 RETURNFUNC(retcode);
6674 }
6675
6676 if (!caps->set_vfo)
6677 {
6678 RETURNFUNC(-RIG_ENAVAIL);
6679 }
6680
6681 curr_vfo = STATE(rig)->current_vfo;
6682 HAMLIB_TRACE;
6683 retcode = caps->set_vfo(rig, vfo);
6684
6685 if (retcode != RIG_OK)
6686 {
6687 RETURNFUNC(retcode);
6688 }
6689

Callers 4

icom_set_antFunction · 0.85
getAntMethod · 0.85
generic_save_channelFunction · 0.85
rigctl_parse.cFile · 0.85

Calls 1

rig_debugFunction · 0.85

Tested by

no test coverage detected