当前位置: 首页>>代码示例>>C++>>正文


C++ C_PARAMS函数代码示例

本文整理汇总了C++中C_PARAMS函数的典型用法代码示例。如果您正苦于以下问题:C++ C_PARAMS函数的具体用法?C++ C_PARAMS怎么用?C++ C_PARAMS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了C_PARAMS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gp_abilities_list_get_abilities

/**
 * \brief Retrieve the camera abilities of entry with supplied index number.
 *
 * \param list a CameraAbilitiesList
 * \param index index
 * \param abilities pointer to CameraAbilities for returned data.
 * \return a gphoto2 error code
 *
 * Retrieves the camera abilities of entry with supplied
 * index number. Typically, you would call gp_camera_set_abilities()
 * afterwards in order to prepare the initialization of a camera.
 */
int
gp_abilities_list_get_abilities (CameraAbilitiesList *list, int index,
				 CameraAbilities *abilities)
{
	C_PARAMS (list && abilities);
	C_PARAMS (0 <= index && index < list->count);

	memcpy (abilities, &list->abilities[index], sizeof (CameraAbilities));

	return (GP_OK);
}
开发者ID:axxel,项目名称:libgphoto2,代码行数:23,代码来源:gphoto2-abilities-list.c

示例2: gp_abilities_list_count

/**
 * \brief Count the entries in the supplied list.
 * \param list a #CameraAbilitiesList
 * \returns The number of entries or a gphoto2 error code
 */
int
gp_abilities_list_count (CameraAbilitiesList *list)
{
	C_PARAMS (list);

	return (list->count);
}
开发者ID:axxel,项目名称:libgphoto2,代码行数:12,代码来源:gphoto2-abilities-list.c

示例3: gp_port_check_int_fast

/**
 * \brief Check for interrupt without wait
 * \param port a GPPort
 * \param data a pointer to an allocated buffer
 * \param size the number of bytes that should be read
 *
 * Reads a specified number of bytes from the inerrupt endpoint
 * into the supplied buffer.
 * Function waits 50 miliseconds for data on interrupt endpoint.
 *
 * \return a gphoto2 error code
 **/
int
gp_port_check_int_fast (GPPort *port, char *data, int size)
{
        int retval;

        gp_log (GP_LOG_DATA, __func__, "Reading %i = 0x%x bytes from interrupt endpoint...", size, size);

	C_PARAMS (port);
	CHECK_INIT (port);

	/* Check if we read as many bytes as expected */
	CHECK_SUPP (port, "check_int", port->pc->ops->check_int);
	retval = port->pc->ops->check_int (port, data, size, FAST_TIMEOUT);
	CHECK_RESULT (retval);

#ifdef IGNORE_EMPTY_INTR_READS
	/* For Canon cameras, we will make lots of
	   reads that will return zero length. Don't
	   bother to log them as errors. */
	if (retval != 0 )
#endif
		LOG_DATA (data, retval, size, "Read   ", "from interrupt endpoint (fast):");

	return (retval);
}
开发者ID:axxel,项目名称:libgphoto2,代码行数:37,代码来源:gphoto2-port.c

示例4: gp_camera_get_port_speed

/** 
 * Retrieve the current speed.
 *
 * @param camera a #Camera
 * @return The current speed or a gphoto2 error code
 *
 */
int
gp_camera_get_port_speed (Camera *camera)
{
	C_PARAMS (camera);

	return (camera->pc->speed);
}
开发者ID:Jay314,项目名称:libgphoto2,代码行数:14,代码来源:gphoto2-camera.c

示例5: gp_camera_set_port_speed

/**
 * Set the camera speed.
 *
 * @param camera a #Camera
 * @param speed the speed
 * @return a gphoto2 error code
 *
 * This function is typically used prior first initialization 
 * using #gp_camera_init for debugging purposes. Normally, a camera driver
 * will try to figure out the current speed of the camera and set the speed
 * to the optimal one automatically. Note that this function only works with 
 * serial ports. In other words, you have to set the camera's port to a 
 * serial one (using #gp_camera_set_port_path or #gp_camera_set_port_name)
 * prior calling this function.
 *
 */
int
gp_camera_set_port_speed (Camera *camera, int speed)
{
	GPPortSettings settings;

	C_PARAMS (camera);

	C_PARAMS_MSG (camera->port,
		      "You need to set a port prior trying to set the speed");
	C_PARAMS_MSG (camera->port->type == GP_PORT_SERIAL,
		      "You can specify a speed only with serial ports");

	/*
	 * If the camera is currently initialized, terminate that connection.
	 * We don't care if we are successful or not.
	 */
	if (camera->pc->lh)
		gp_camera_exit (camera, NULL);

	CR (camera, gp_port_get_settings (camera->port, &settings), NULL);
	settings.serial.speed = speed;
	CR (camera, gp_port_set_settings (camera->port, settings), NULL);
	camera->pc->speed = speed;

	return (GP_OK);
}
开发者ID:Jay314,项目名称:libgphoto2,代码行数:42,代码来源:gphoto2-camera.c

示例6: gp_libusb1_clear_halt_lib

static int
gp_libusb1_clear_halt_lib(GPPort *port, int ep)
{
	unsigned char internal_ep;

	C_PARAMS (port && port->pl->dh);

	switch (ep) {
	case GP_PORT_USB_ENDPOINT_IN :
		internal_ep = port->settings.usb.inep;
		break;
	case GP_PORT_USB_ENDPOINT_OUT :
		internal_ep = port->settings.usb.outep;
		break;
	case GP_PORT_USB_ENDPOINT_INT :
		internal_ep = port->settings.usb.intep;
		break;
	default:
		gp_port_set_error (port, "bad EndPoint argument 0x%x", ep);
		return GP_ERROR_BAD_PARAMETERS;
	}

	C_LIBUSB (libusb_clear_halt(port->pl->dh, internal_ep), GP_ERROR_IO_USB_CLEAR_HALT);

	return GP_OK;
}
开发者ID:Jay314,项目名称:libgphoto2,代码行数:26,代码来源:libusb1.c

示例7: gp_libusb1_check_int

static int
gp_libusb1_check_int (GPPort *port, char *bytes, int size, int timeout)
{
	int 		ret;
	struct timeval	tv;

	C_PARAMS (port && port->pl->dh && timeout >= 0);

	if (port->pl->nrofirqs)
		goto handleirq;

	tv.tv_sec = timeout/1000;
	tv.tv_usec = (timeout%1000)*1000;

	ret = LOG_ON_LIBUSB_E (libusb_handle_events_timeout(port->pl->ctx, &tv));

	if (port->pl->nrofirqs)
		goto handleirq;

	if (ret < LIBUSB_SUCCESS)
		return translate_libusb_error(ret, GP_ERROR_IO_READ);

	return GP_ERROR_TIMEOUT;

handleirq:
	if (size > port->pl->irqlens[0])
		size = port->pl->irqlens[0];
	memcpy(bytes, port->pl->irqs[0], size);

	memmove(port->pl->irqs,port->pl->irqs+1,sizeof(port->pl->irqs[0])*(port->pl->nrofirqs-1));
	memmove(port->pl->irqlens,port->pl->irqlens+1,sizeof(port->pl->irqlens[0])*(port->pl->nrofirqs-1));
	port->pl->nrofirqs--;
        return size;
}
开发者ID:Jay314,项目名称:libgphoto2,代码行数:34,代码来源:libusb1.c

示例8: gp_camera_new

/**
 * Allocates the memory for a #Camera.
 *
 * @param camera the #Camera object to initialize.
 * @return a gphoto2 error code
 *
 */
int
gp_camera_new (Camera **camera)
{
	int result;

	C_PARAMS (camera);

        C_MEM (*camera = calloc (1, sizeof (Camera)));

        (*camera)->functions = calloc (1, sizeof (CameraFunctions));
        (*camera)->pc        = calloc (1, sizeof (CameraPrivateCore));
	if (!(*camera)->functions || !(*camera)->pc) {
		result = GP_ERROR_NO_MEMORY;
		goto error;
	}

        (*camera)->pc->ref_count = 1;

	/* Create the filesystem */
	result = gp_filesystem_new (&(*camera)->fs);
	if (result < GP_OK)
		goto error;

	/* Create the port */
	result = gp_port_new (&(*camera)->port);
	if (result < GP_OK)
		goto error;

        return(GP_OK);

error:
	gp_camera_free (*camera);
	return result;
}
开发者ID:Jay314,项目名称:libgphoto2,代码行数:41,代码来源:gphoto2-camera.c

示例9: gp_camera_start_timeout

/**
 * @param camera a #Camera
 * @param timeout number of seconds that should pass between each call to
 * 	     \c func
 * @param func the function that should be called each \c timeout seconds
 * @return The id of the background process or a gphoto2 error code
 *
 * This function should be called by the camera driver during camera_init()
 * if the camera needs to be sent messages periodically in order to prevent
 * it from shutting down.
 *
 */
int
gp_camera_start_timeout (Camera *camera, unsigned int timeout,
			 CameraTimeoutFunc func)
{
	int id;

	C_PARAMS (camera && camera->pc);

	if (!camera->pc->timeout_start_func)
		return (GP_ERROR_NOT_SUPPORTED);

	/*
	 * We remember the id here in order to automatically remove
	 * the timeout on gp_camera_exit.
	 */
	C_MEM (camera->pc->timeout_ids =
			realloc (camera->pc->timeout_ids, sizeof (int) *
					(camera->pc->timeout_ids_len + 1)));

	id = camera->pc->timeout_start_func (camera, timeout, func,
					     camera->pc->timeout_data);
	if (id < 0)
		return (id);
	camera->pc->timeout_ids[camera->pc->timeout_ids_len] = id;
	camera->pc->timeout_ids_len++;

	return (id);
}
开发者ID:Jay314,项目名称:libgphoto2,代码行数:40,代码来源:gphoto2-camera.c

示例10: gp_camera_file_read

/**
 * Reads a file partially from the #Camera.
 *
 * @param camera a #Camera
 * @param folder a folder
 * @param file the name of a file
 * @param type the #CameraFileType
 * @param offset the offset into the camera file
 * @param data the buffer receiving the data
 * @param size the size to be read and that was read
 * @param context a #GPContext
 * @return a gphoto2 error code
 *
 **/
int
gp_camera_file_read (Camera *camera, const char *folder, const char *file,
		    CameraFileType type,
		    uint64_t offset, char *buf, uint64_t *size,
		    GPContext *context)
{
	GP_LOG_D ("Getting file '%s' in folder '%s'...", file, folder);

	C_PARAMS (camera && folder && file && buf && size);
	CHECK_INIT (camera, context);

	/* Did we get reasonable foldername/filename? */
	if (strlen (folder) == 0) {
		CAMERA_UNUSED (camera, context);
		return (GP_ERROR_DIRECTORY_NOT_FOUND);
	}
	if (strlen (file) == 0) {
		CAMERA_UNUSED (camera, context);
		return (GP_ERROR_FILE_NOT_FOUND);
	}
  
	CHECK_RESULT_OPEN_CLOSE (camera, gp_filesystem_read_file (camera->fs,
			folder, file, type, offset, buf, size, context), context);

	CAMERA_UNUSED (camera, context);
	return (GP_OK);
}
开发者ID:Jay314,项目名称:libgphoto2,代码行数:41,代码来源:gphoto2-camera.c

示例11: gp_camera_capture_preview

/**
 * Captures a preview that won't be stored on the camera but returned in 
 * supplied file. 
 *
 * @param camera a #Camera
 * @param file a #CameraFile
 * @param context a #GPContext
 * @return a gphoto2 error code
 *
 * For example, you could use gp_capture_preview() for taking some sample
 * pictures before calling gp_capture().
 *
 **/
int
gp_camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context)
{
	char *xname;
	C_PARAMS (camera && file);
	CHECK_INIT (camera, context);

	CR (camera, gp_file_clean (file), context);

	if (!camera->functions->capture_preview) {
		gp_context_error (context, _("This camera can "
			"not capture previews."));
		CAMERA_UNUSED (camera, context);
                return (GP_ERROR_NOT_SUPPORTED);
	}

	CHECK_RESULT_OPEN_CLOSE (camera, camera->functions->capture_preview (
					camera, file, context), context);
	gp_file_get_name_by_type (file, "capture_preview", GP_FILE_TYPE_NORMAL, &xname);
	/* FIXME: Marcus ... will go away, just keep compatible now. */
	gp_file_set_name (file, xname);
	free (xname);

	CAMERA_UNUSED (camera, context);
	return (GP_OK);
}
开发者ID:Jay314,项目名称:libgphoto2,代码行数:39,代码来源:gphoto2-camera.c

示例12: gp_port_vusb_clear_halt_lib

static int
gp_port_vusb_clear_halt_lib(GPPort *port, int ep)
{
        unsigned char internal_ep;

	gp_log(GP_LOG_DEBUG,__FUNCTION__,"()");
        C_PARAMS (port && port->pl);

        switch (ep) {
        case GP_PORT_USB_ENDPOINT_IN :
                internal_ep = port->settings.usb.inep;
                break;
        case GP_PORT_USB_ENDPOINT_OUT :
                internal_ep = port->settings.usb.outep;
                break;
        case GP_PORT_USB_ENDPOINT_INT :
                internal_ep = port->settings.usb.intep;
                break;
        default:
                gp_port_set_error (port, "Bad EndPoint argument 0x%x", ep);
                return GP_ERROR_BAD_PARAMETERS;
        }
	gp_log(GP_LOG_DEBUG,"gp_port_vusb_clear_halt_lib","clearing halt on ep 0x%x", internal_ep);
	/* now clear halt */
        return GP_OK;
}
开发者ID:timelapseplus,项目名称:libgphoto2,代码行数:26,代码来源:vusb.c

示例13: gp_abilities_list_sort

static int
gp_abilities_list_sort (CameraAbilitiesList *list)
{
	C_PARAMS (list);

	qsort (list->abilities, list->count, sizeof(CameraAbilities), cmp_abilities);
	return (GP_OK);
}
开发者ID:axxel,项目名称:libgphoto2,代码行数:8,代码来源:gphoto2-abilities-list.c

示例14: gp_port_vusb_check_int

static int
gp_port_vusb_check_int (GPPort *port, char *bytes, int size, int timeout)
{
	gp_log(GP_LOG_DEBUG,__FUNCTION__,"()");
        C_PARAMS (port && port->pl && timeout >= 0);

	return port->pl->vcamera->readint(port->pl->vcamera, (unsigned char*)bytes, size, timeout);
}
开发者ID:timelapseplus,项目名称:libgphoto2,代码行数:8,代码来源:vusb.c

示例15: gp_port_vusb_reset

static int
gp_port_vusb_reset(GPPort *port)
{
	gp_log(GP_LOG_DEBUG,__FUNCTION__,"()");
        C_PARAMS (port && port->pl);

        return GP_OK;
}
开发者ID:timelapseplus,项目名称:libgphoto2,代码行数:8,代码来源:vusb.c


注:本文中的C_PARAMS函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。