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

int HAMLIB_API rig_get_dcd ( RIG rig,
vfo_t  vfo,
dcd_t dcd 
)

get the status of the DCD

Parameters:
rig The rig handle
vfo The target VFO
dcd The location where to store the status of the DCD
Retrieves the status of DCD (is squelch open?).

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

Definition at line 1244 of file rig.c.

References caps, rig_state::current_vfo, hamlib_port_t::dcd, rig_state::dcdport, rig_caps::get_dcd, par_dcd_get(), RIG_DCD_NONE, RIG_DCD_OFF, RIG_DCD_ON, RIG_DCD_PARALLEL, RIG_DCD_RIG, RIG_DCD_SERIAL_CAR, RIG_DCD_SERIAL_CTS, RIG_DCD_SERIAL_DSR, RIG_EINVAL, RIG_ENAVAIL, RIG_ENIMPL, RIG_ENTARGET, RIG_OK, RIG_VFO_CURR, ser_get_car(), ser_get_cts(), ser_get_dsr(), rig_caps::set_vfo, state, rig_caps::status, rig_caps::targetable_vfo, and hamlib_port_t::type.

{     
      const struct rig_caps *caps;
      int retcode, status;
      vfo_t curr_vfo;

      if (CHECK_RIG_ARG(rig) || !dcd)
            return -RIG_EINVAL;

      caps = rig->caps;

      switch (rig->state.dcdport.type.dcd) {
      case RIG_DCD_RIG:
            if (caps->get_dcd == NULL)
                  return -RIG_ENIMPL;

            if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || 
                        vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo)
                  return caps->get_dcd(rig, vfo, dcd);
      
            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->get_dcd(rig, vfo, dcd);
            caps->set_vfo(rig, curr_vfo);
            return retcode;

            break;

      case RIG_DCD_SERIAL_CTS:
            retcode = ser_get_cts(&rig->state.dcdport, &status);
            *dcd = status ? RIG_DCD_ON : RIG_DCD_OFF;
            return retcode;

      case RIG_DCD_SERIAL_DSR:
            retcode = ser_get_dsr(&rig->state.dcdport, &status);
            *dcd = status ? RIG_DCD_ON : RIG_DCD_OFF;
            return retcode;

      case RIG_DCD_SERIAL_CAR:
            retcode = ser_get_car(&rig->state.dcdport, &status);
            *dcd = status ? RIG_DCD_ON : RIG_DCD_OFF;
            return retcode;

            
      case RIG_DCD_PARALLEL:
            return par_dcd_get(&rig->state.dcdport, dcd);

      case RIG_DCD_NONE:
            return -RIG_ENAVAIL;    /* not available */

      default:
            return -RIG_EINVAL;
      }

      return RIG_OK;
}


Generated by  Doxygen 1.6.0   Back to index