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

Function flrig_init

rigs/dummy/flrig.c:645–694  ·  view source on GitHub ↗

* flrig_init * Assumes rig!=NULL */

Source from the content-addressed store, hash-verified

643* Assumes rig!=NULL
644*/
645static int flrig_init(RIG *rig)
646{
647 struct flrig_priv_data *priv;
648 hamlib_port_t *rp = RIGPORT(rig);
649
650 ENTERFUNC;
651 rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version);
652
653 STATE(rig)->priv = (struct flrig_priv_data *)calloc(1, sizeof(
654 struct flrig_priv_data));
655
656 if (!STATE(rig)->priv)
657 {
658 RETURNFUNC(-RIG_ENOMEM);
659 }
660
661 priv = STATE(rig)->priv;
662
663 memset(priv, 0, sizeof(struct flrig_priv_data));
664 memset(priv->parms, 0, RIG_SETTING_MAX * sizeof(value_t));
665
666 /*
667 * set arbitrary initial status
668 */
669 STATE(rig)->current_vfo = RIG_VFO_A;
670 priv->split = 0;
671 priv->ptt = 0;
672 priv->curr_modeA = -1;
673 priv->curr_modeB = -1;
674 priv->curr_widthA = -1;
675 priv->curr_widthB = -1;
676 priv->get_SWR = 1; // we'll try getSWR once to see if it works
677
678 if (!rig->caps)
679 {
680 RETURNFUNC(-RIG_EINVAL);
681 }
682
683 strncpy(rp->pathname, DEFAULTPATH, sizeof(rp->pathname));
684
685 priv->ext_parms = alloc_init_ext(flrig_ext_parms);
686
687 if (!priv->ext_parms)
688 {
689 RETURNFUNC(-RIG_ENOMEM);
690 }
691
692
693 RETURNFUNC(RIG_OK);
694}
695
696/*
697* modeMapGetFLRig

Callers

nothing calls this directly

Calls 2

rig_debugFunction · 0.85
alloc_init_extFunction · 0.70

Tested by

no test coverage detected