示例#1
0
文件: mem.c 项目: airween/hamlib
/**
 * \brief set all channel data
 * \param rig   The rig handle
 * \param chans The location of data to set for all channels
 *
 * Write 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_set_chan_all_cb(), rig_get_chan_all()
 */
int HAMLIB_API rig_set_chan_all(RIG *rig, const 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 = (channel_t *) chans;

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


    /* if not available, emulate it */
    retval = set_chan_all_cb_generic(rig, map_chan, (rig_ptr_t)&map_arg);

    return retval;
}
示例#2
0
文件: mem.c 项目: DF4OR/hamlib
/**
 * \brief set all channel data, by callback
 * \param rig	The rig handle
 * \param chan_cb	Pointer to a callback function to provide channel data
 * \param arg	Arbitrary argument passed back to \a chan_cb
 *
 *  Write the data associated with a all the memory channels.
 *  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_set_chan_all(), rig_get_chan_all_cb()
 */
int HAMLIB_API rig_set_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->set_chan_all_cb)
		return rc->set_chan_all_cb(rig, chan_cb, arg);


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

	return retval;
}
示例#3
0
文件: mem.c 项目: DF4OR/hamlib
/**
 * \brief set all channel data
 * \param rig	The rig handle
 * \param chans	The location of data to set for all channels
 *
 * Write 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_set_chan_all_cb(), rig_get_chan_all()
 */
int HAMLIB_API rig_set_chan_all (RIG *rig, const 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 = (channel_t *) chans;

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


	/* if not available, emulate it */
	retval = set_chan_all_cb_generic (rig, map_chan, (rig_ptr_t)&map_arg);

	return retval;
}
示例#4
0
文件: mem.c 项目: airween/hamlib
/**
 * \brief set all channel data, by callback
 * \param rig       The rig handle
 * \param chan_cb   Pointer to a callback function to provide channel data
 * \param arg       Arbitrary argument passed back to \a chan_cb
 *
 *  Write the data associated with a all the memory channels.
 *  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_set_chan_all(), rig_get_chan_all_cb()
 */
int HAMLIB_API rig_set_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->set_chan_all_cb)
    {
        return rc->set_chan_all_cb(rig, chan_cb, arg);
    }

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

    return retval;
}