Пример #1
0
/**
 * \brief get all channel data
 * \param rig   The rig handle
 * \param chans The location where to store all the channel data
 *
 * Retrieves the data associated with all the memory channels.
 *
 * \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_chan_all_cb(), rig_set_chan_all()
 */
int HAMLIB_API rig_get_chan_all(RIG *rig, channel_t chans[])
{
    struct rig_caps *rc;
    struct map_all_s map_arg;
    int retval;

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

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

    rc = rig->caps;
    map_arg.chans = chans;

    if (rc->get_chan_all_cb)
    {
        return rc->get_chan_all_cb(rig, map_chan, (rig_ptr_t)&map_arg);
    }

    /*
     * if not available, emulate it
     *
     * TODO: save_current_state, restore_current_state
     */
    retval = get_chan_all_cb_generic(rig, map_chan, (rig_ptr_t)&map_arg);

    return retval;
}
Пример #2
0
/**
 * \brief get all channel data, by callback
 * \param rig       The rig handle
 * \param chan_cb   Pointer to a callback function to retrieve channel data
 * \param arg       Arbitrary argument passed back to \a chan_cb
 *
 *  Retrieves the data associated with a all the memory channels.
 *  This is the preferred method to support clonable rigs.
 *
 *  \a chan_cb is called first with no data in chan (chan equals NULL).
 *  This means the application has to provide a struct where to store
 *  future data for channel channel_num. If channel_num == chan->channel_num,
 *  the application does not need to provide a new allocated structure.
 *
 * \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_chan_all(), rig_set_chan_all_cb()
 */
int HAMLIB_API rig_get_chan_all_cb(RIG *rig, chan_cb_t chan_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_chan_all_cb)
    {
        return rc->get_chan_all_cb(rig, chan_cb, arg);
    }


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

    return retval;
}
Пример #3
0
Файл: mem.c Проект: DF4OR/hamlib
/**
 * \brief get all channel data, by callback
 * \param rig	The rig handle
 * \param chan_cb	Pointer to a callback function to retrieve channel data
 * \param arg	Arbitrary argument passed back to \a chan_cb
 *
 *  Retrieves the data associated with a all the memory channels.
 *  This is the preferred method to support clonable rigs.
 *
 *  \a chan_cb is called first with no data in chan (chan equals NULL).
 *  This means the application has to provide a struct where to store
 *  future data for channel channel_num. If channel_num == chan->channel_num,
 *  the application does not need to provide a new allocated structure.
 *
 * \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_chan_all(), rig_set_chan_all_cb()
 */
int HAMLIB_API rig_get_chan_all_cb (RIG *rig, chan_cb_t chan_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_chan_all_cb)
		return rc->get_chan_all_cb(rig, chan_cb, arg);


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

	return retval;
}
Пример #4
0
Файл: mem.c Проект: DF4OR/hamlib
/**
 * \brief get all channel data
 * \param rig	The rig handle
 * \param chans	The location where to store all the channel data
 *
 * Retrieves the data associated with all the memory channels.
 *
 * \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_chan_all_cb(), rig_set_chan_all()
 */
int HAMLIB_API rig_get_chan_all (RIG *rig, channel_t chans[])
{
	struct rig_caps *rc;
	struct map_all_s map_arg;
	int retval;

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

	rc = rig->caps;
	map_arg.chans = chans;

	if (rc->get_chan_all_cb)
		return rc->get_chan_all_cb(rig, map_chan, (rig_ptr_t)&map_arg);

	/*
	 * if not available, emulate it
	 *
	 * TODO: save_current_state, restore_current_state
	 */
	retval = get_chan_all_cb_generic (rig, map_chan, (rig_ptr_t)&map_arg);

	return retval;
}