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

Function rig_set_ptt

src/rig.c:3621–3940  ·  view source on GitHub ↗

* \brief set PTT on/off * \param rig The rig handle * \param vfo The target VFO * \param ptt The PTT status to set to * * Sets "Push-To-Talk" on/off. * * \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_get_ptt() */

Source from the content-addressed store, hash-verified

3619 * \sa rig_get_ptt()
3620 */
3621int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
3622{
3623 const struct rig_caps *caps;
3624 struct rig_state *rs;
3625 hamlib_port_t *rp, *pttp;
3626 struct rig_cache *cachep;
3627 int retcode = RIG_OK;
3628
3629 if (CHECK_RIG_ARG(rig))
3630 {
3631 rig_debug(RIG_DEBUG_ERR, "%s: rig or rig->caps is null\n", __func__);
3632 return -RIG_EINVAL;
3633 }
3634
3635 ELAPSED1;
3636 ENTERFUNC;
3637
3638 caps = rig->caps;
3639 rs = STATE(rig);
3640 cachep = CACHE(rig);
3641 rp = RIGPORT(rig);
3642 pttp = PTTPORT(rig);
3643
3644 LOCK(1);
3645
3646 switch (pttp->type.ptt)
3647 {
3648 case RIG_PTT_RIG:
3649 if (ptt == RIG_PTT_ON_MIC || ptt == RIG_PTT_ON_DATA)
3650 {
3651 ptt = RIG_PTT_ON;
3652 }
3653 HL_FALLTHROUGH
3654
3655 case RIG_PTT_RIG_MICDATA:
3656 if (caps->set_ptt == NULL)
3657 {
3658 ELAPSED2;
3659 LOCK(0);
3660 RETURNFUNC(-RIG_ENIMPL);
3661 }
3662
3663 if ((caps->targetable_vfo & RIG_TARGETABLE_PTT)
3664 || vfo == RIG_VFO_CURR
3665 || vfo == rs->current_vfo)
3666 {
3667 int retry = 3;
3668 ptt_t tptt;
3669
3670 do
3671 {
3672 HAMLIB_TRACE;
3673 retcode = caps->set_ptt(rig, vfo, ptt);
3674
3675 if (retcode != RIG_OK)
3676 {
3677 ELAPSED2;
3678 LOCK(0);

Callers 8

thg71_set_funcFunction · 0.85
setPTTMethod · 0.85
rig_set_freqFunction · 0.85
handle_ts2000Function · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
rigctl_parse.cFile · 0.85

Calls 12

rig_debugFunction · 0.85
hl_usleepFunction · 0.85
elapsed_msFunction · 0.85
rig_get_pttFunction · 0.85
rigerrorFunction · 0.85
ser_openFunction · 0.85
ser_set_rtsFunction · 0.85
ser_set_dtrFunction · 0.85
ser_closeFunction · 0.85
par_ptt_setFunction · 0.85
cm108_ptt_setFunction · 0.85
gpio_ptt_setFunction · 0.85

Tested by 2

mainFunction · 0.68
mainFunction · 0.68