示例#1
0
文件: mem.c 项目: DF4OR/hamlib
/**
 * \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;
}
示例#2
0
文件: mem.c 项目: airween/hamlib
/**
 * \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;
}