Exemple #1
0
/**
 * \brief get all channel and non-channel data by call-back
 * \param rig	The rig handle
 * \param chan_cb	The callback for channel data
 * \param parm_cb	The callback for non-channel(aka parm) data
 * \param arg	Cookie passed to \a chan_cb and \a parm_cb
 *
 * Retrieves the data associated with all the memory channels,
 * and rigs memory parameters, by callback.
 * This is the preferred method to support clonable rigs.
 *
 * \return RIG_OK if the operation has been sucessful, otherwise
 * a negative value if an error occured (in which case, cause is
 * set appropriately).
 *
 * \sa rig_get_mem_all_cb(), rig_set_mem_all()
 *
 * \todo get all parm's
 * \todo finish coding and testing of mem_all functions
 */
int HAMLIB_API rig_get_mem_all_cb (RIG *rig, chan_cb_t chan_cb, confval_cb_t parm_cb, rig_ptr_t arg)
{
	struct rig_caps *rc;
	int retval;

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

	rc = rig->caps;

	if (rc->get_mem_all_cb)
		return rc->get_mem_all_cb(rig, chan_cb, parm_cb, arg);


	/* if not available, emulate it */
	retval = rig_get_chan_all_cb (rig, chan_cb, arg);
	if (retval != RIG_OK)
		return retval;

#if 0
	retval = rig_get_parm_cb (rig, parm_cb, arg);
	if (retval != RIG_OK)
		return retval;
#else
	return -RIG_ENIMPL;
#endif

	return retval;
}
Exemple #2
0
/**
 * \brief get all channel and non-channel data by call-back
 * \param rig       The rig handle
 * \param chan_cb   The callback for channel data
 * \param parm_cb   The callback for non-channel(aka parm) data
 * \param arg       Cookie passed to \a chan_cb and \a parm_cb
 *
 * Retrieves the data associated with all the memory channels,
 * and rigs memory parameters, by callback.
 * This is the preferred method to support clonable rigs.
 *
 * \return RIG_OK if the operation has been sucessful, otherwise
 * a negative value if an error occured (in which case, cause is
 * set appropriately).
 *
 * \sa rig_get_mem_all_cb(), rig_set_mem_all()
 *
 * \todo get all parm's
 * \todo finish coding and testing of mem_all functions
 */
int HAMLIB_API rig_get_mem_all_cb(RIG *rig,
                                  chan_cb_t chan_cb,
                                  confval_cb_t parm_cb,
                                  rig_ptr_t arg)
{
    struct rig_caps *rc;
    int retval;

    rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);

    if (CHECK_RIG_ARG(rig) || !chan_cb)
    {
        return -RIG_EINVAL;
    }

    rc = rig->caps;

    if (rc->get_mem_all_cb)
    {
        return rc->get_mem_all_cb(rig, chan_cb, parm_cb, arg);
    }

    /* if not available, emulate it */
    retval = rig_get_chan_all_cb(rig, chan_cb, arg);

    if (retval != RIG_OK)
    {
        return retval;
    }

#if 0
    retval = rig_get_parm_cb(rig, parm_cb, arg);

    if (retval != RIG_OK)
    {
        return retval;
    }

#else
    return -RIG_ENIMPL;
#endif

    return retval;
}
Exemple #3
0
int csv_save(RIG *rig, const char *outfilename)
{
    int status;
    FILE *f;

    f = fopen(outfilename, "w");

    if (!f)
    {
        return -1;
    }

    if (rig->caps->clone_combo_get)
    {
        printf("About to save data, enter cloning mode: %s\n",
               rig->caps->clone_combo_get);
    }

    status = rig_get_chan_all_cb(rig, dump_csv_chan, f);

    fclose(f);

    return status;
}