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

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

Returns:
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:
rig_get_ptt()

Definition at line 1132 of file rig.c.

References rig::caps, rig_state::current_vfo, hamlib_port_t::ptt, rig_state::pttport, RIG_PTT_NONE, RIG_PTT_ON, RIG_PTT_PARALLEL, RIG_PTT_RIG, RIG_PTT_SERIAL_DTR, RIG_PTT_SERIAL_RTS, RIG_VFO_CURR, rig_caps::set_ptt, rig_caps::set_vfo, rig::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;

            break;

      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 */
      default:
            return -RIG_EINVAL;
      }

      return RIG_OK;
}


Generated by  Doxygen 1.6.0   Back to index