Logo Search packages:      
Sourcecode: hamlib version File versions  Download package

int HAMLIB_API rig_set_ptt ( RIG rig,
vfo_t  vfo,
ptt_t  ptt 

set PTT on/off

rig The rig handle
vfo The target VFO
ptt The PTT status to set to
Sets "Push-To-Talk" on/off.

RIG_OK if the operation has been sucessful, otherwise a negative value if an error occured (in which case, cause is set appropriately).
See also:

Definition at line 1138 of file rig.c.

References caps, rig_state::current_vfo, par_ptt_set(), hamlib_port_t::ptt, rig_state::pttport, RIG_EINVAL, RIG_ENAVAIL, RIG_ENIMPL, RIG_ENTARGET, RIG_OK, RIG_PTT_NONE, RIG_PTT_ON, RIG_PTT_PARALLEL, RIG_PTT_RIG, RIG_PTT_SERIAL_DTR, RIG_PTT_SERIAL_RTS, RIG_VFO_CURR, ser_set_dtr(), ser_set_rts(), rig_caps::set_ptt, rig_caps::set_vfo, state, rig_caps::targetable_vfo, and hamlib_port_t::type.

      const struct rig_caps *caps;
      int retcode;
      vfo_t curr_vfo;

      if (CHECK_RIG_ARG(rig))
            return -RIG_EINVAL;

      caps = rig->caps;

      switch (rig->state.pttport.type.ptt) {
      case RIG_PTT_RIG:
            if (caps->set_ptt == NULL)
            return -RIG_ENIMPL;

            if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || 
                        vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo)
            return caps->set_ptt(rig, vfo, ptt);
            if (!caps->set_vfo)
            return -RIG_ENTARGET;
            curr_vfo = rig->state.current_vfo;
            retcode = caps->set_vfo(rig, vfo);
            if (retcode != RIG_OK)
                  return retcode;
            retcode = caps->set_ptt(rig, vfo, ptt);
            caps->set_vfo(rig, curr_vfo);
            return retcode;


      case RIG_PTT_SERIAL_DTR:
            return ser_set_dtr(&rig->state.pttport, ptt==RIG_PTT_ON);

      case RIG_PTT_SERIAL_RTS:
            return ser_set_rts(&rig->state.pttport, ptt==RIG_PTT_ON);

      case RIG_PTT_PARALLEL:
            return par_ptt_set(&rig->state.pttport, ptt);

      case RIG_PTT_NONE:
            return -RIG_ENAVAIL;    /* not available */
            return -RIG_EINVAL;

      return RIG_OK;

Generated by  Doxygen 1.6.0   Back to index