libgphoto2 photo camera library (libgphoto2) API  2.5.10.1
gphoto2-camera.c File Reference
#include "config.h"
#include <gphoto2/gphoto2-camera.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <ltdl.h>
#include <gphoto2/gphoto2-result.h>
#include <gphoto2/gphoto2-library.h>
#include <gphoto2/gphoto2-port-log.h>
Include dependency graph for gphoto2-camera.c:

Data Structures

struct  _CameraPrivateCore
 

Macros

#define textdomain(String)   (String)
 
#define gettext(String)   (String)
 
#define dgettext(Domain, Message)   (Message)
 
#define dcgettext(Domain, Message, Type)   (Message)
 
#define bindtextdomain(Domain, Directory)   (Domain)
 
#define _(String)   (String)
 
#define N_(String)   (String)
 
#define CAMERA_UNUSED(c, ctx)
 
#define CR(c, result, ctx)
 
#define CHECK_OPEN(c, ctx)
 
#define CHECK_CLOSE(c, ctx)
 
#define CRS(c, res, ctx)
 
#define CRSL(c, res, ctx, list)
 
#define CHECK_RESULT_OPEN_CLOSE(c, result, ctx)
 
#define CHECK_INIT(c, ctx)
 

Functions

int gp_camera_exit (Camera *camera, GPContext *context)
 
int gp_camera_new (Camera **camera)
 
int gp_camera_set_abilities (Camera *camera, CameraAbilities abilities)
 Sets the camera abilities. More...
 
int gp_camera_get_abilities (Camera *camera, CameraAbilities *abilities)
 
int gp_camera_get_port_info (Camera *camera, GPPortInfo *info)
 
int gp_camera_set_port_info (Camera *camera, GPPortInfo info)
 
int gp_camera_set_port_speed (Camera *camera, int speed)
 
int gp_camera_get_port_speed (Camera *camera)
 
int gp_camera_ref (Camera *camera)
 
int gp_camera_unref (Camera *camera)
 
int gp_camera_free (Camera *camera)
 
int gp_camera_autodetect (CameraList *list, GPContext *context)
 
int gp_camera_init (Camera *camera, GPContext *context)
 
int gp_camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
 
int gp_camera_get_single_config (Camera *camera, const char *name, CameraWidget **widget, GPContext *context)
 
int gp_camera_list_config (Camera *camera, CameraList *list, GPContext *context)
 
int gp_camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
 
int gp_camera_set_single_config (Camera *camera, const char *name, CameraWidget *widget, GPContext *context)
 
int gp_camera_get_summary (Camera *camera, CameraText *summary, GPContext *context)
 
int gp_camera_get_manual (Camera *camera, CameraText *manual, GPContext *context)
 
int gp_camera_get_about (Camera *camera, CameraText *about, GPContext *context)
 
int gp_camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context)
 
int gp_camera_trigger_capture (Camera *camera, GPContext *context)
 
int gp_camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context)
 
int gp_camera_wait_for_event (Camera *camera, int timeout, CameraEventType *eventtype, void **eventdata, GPContext *context)
 
int gp_camera_folder_list_files (Camera *camera, const char *folder, CameraList *list, GPContext *context)
 
int gp_camera_folder_list_folders (Camera *camera, const char *folder, CameraList *list, GPContext *context)
 
int gp_camera_folder_delete_all (Camera *camera, const char *folder, GPContext *context)
 
int gp_camera_folder_put_file (Camera *camera, const char *folder, const char *filename, CameraFileType type, CameraFile *file, GPContext *context)
 
int gp_camera_file_get_info (Camera *camera, const char *folder, const char *file, CameraFileInfo *info, GPContext *context)
 
int gp_camera_file_set_info (Camera *camera, const char *folder, const char *file, CameraFileInfo info, GPContext *context)
 
int gp_camera_file_get (Camera *camera, const char *folder, const char *file, CameraFileType type, CameraFile *camera_file, GPContext *context)
 
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)
 
int gp_camera_file_delete (Camera *camera, const char *folder, const char *file, GPContext *context)
 
int gp_camera_folder_make_dir (Camera *camera, const char *folder, const char *name, GPContext *context)
 
int gp_camera_folder_remove_dir (Camera *camera, const char *folder, const char *name, GPContext *context)
 
int gp_camera_get_storageinfo (Camera *camera, CameraStorageInformation **sifs, int *nrofsifs, GPContext *context)
 Gets information on the camera attached storage. More...
 
void gp_camera_set_timeout_funcs (Camera *camera, CameraTimeoutStartFunc start_func, CameraTimeoutStopFunc stop_func, void *data)
 
int gp_camera_start_timeout (Camera *camera, unsigned int timeout, CameraTimeoutFunc func)
 
void gp_camera_stop_timeout (Camera *camera, unsigned int id)
 

Detailed Description

Implement Camera object representing a camera attached to the system.

Author
Copyright 2000 Scott Fritzinger
Copyright 2001-2002 Lutz Mueller lutz@.nosp@m.user.nosp@m.s.sf..nosp@m.net
Note
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Macro Definition Documentation

#define CAMERA_UNUSED (   c,
  ctx 
)
Value:
{ \
(c)->pc->used--; \
if (!(c)->pc->used) { \
if ((c)->pc->exit_requested) \
gp_camera_exit ((c), (ctx)); \
if (!(c)->pc->ref_count) \
} \
}
int gp_camera_exit(Camera *camera, GPContext *context)
Definition: gphoto2-camera.c:264
int gp_camera_free(Camera *camera)
Definition: gphoto2-camera.c:562
#define CHECK_CLOSE (   c,
  ctx 
)
Value:
{ \
if ((c)->functions->post_func) { \
int r3 = (c)->functions->post_func (c,ctx); \
if (r3 < 0) { \
CAMERA_UNUSED (c,ctx); \
return (r3); \
} \
} \
}
#define CHECK_INIT (   c,
  ctx 
)
Value:
{ \
if ((c)->pc->used) \
(c)->pc->used++; \
if (!(c)->pc->lh) \
CR((c), gp_camera_init (c, ctx), ctx); \
}
int gp_camera_init(Camera *camera, GPContext *context)
Definition: gphoto2-camera.c:683
#define GP_ERROR_CAMERA_BUSY
The camera is already busy.
Definition: gphoto2-result.h:90
#define CHECK_OPEN (   c,
  ctx 
)
Value:
{ \
if ((c)->functions->pre_func) { \
int r2 = (c)->functions->pre_func (c,ctx); \
if (r2 < 0) { \
CAMERA_UNUSED (c,ctx); \
return (r2); \
} \
} \
}
#define CHECK_RESULT_OPEN_CLOSE (   c,
  result,
  ctx 
)
Value:
{ \
int r6; \
\
CHECK_OPEN (c,ctx); \
r6 = (result); \
if (r6 < 0) { \
GP_LOG_E ("'%s' failed: %d", #result, r6); \
CHECK_CLOSE (c,ctx); \
CAMERA_UNUSED (c,ctx); \
return (r6); \
} \
CHECK_CLOSE (c,ctx); \
}
#define CR (   c,
  result,
  ctx 
)
Value:
{ \
int r1 = (result); \
\
if (r1 < 0) { \
/* libgphoto2_port doesn't have a GPContext */ \
gp_context_error ((ctx), _("An error occurred " \
"in the io-library ('%s'): %s"), \
gp_port_get_error ((c) ? (c)->port : NULL)); \
if (c) \
CAMERA_UNUSED (c,ctx); \
return (r1); \
} \
}
const char * gp_port_result_as_string(int result)
Definition: gphoto2-port-result.c:54
const char * gp_port_get_error(GPPort *port)
Get verbose port error message.
Definition: gphoto2-port.c:1206
#define CRS (   c,
  res,
  ctx 
)
Value:
{ \
int r4 = (res); \
\
if (r4 < 0) { \
CAMERA_UNUSED (c,ctx); \
return (r4); \
} \
}
#define CRSL (   c,
  res,
  ctx,
  list 
)
Value:
{ \
int r5 = (res); \
\
if (r5 < 0) { \
CAMERA_UNUSED (c,ctx); \
gp_list_free (list); \
return (r5); \
} \
}
int gp_list_free(CameraList *list)
Definition: gphoto2-list.c:120

Function Documentation

int gp_camera_autodetect ( CameraList list,
GPContext context 
)

Autodetect all detectable camera

Parameters
lista CameraList that receives the autodetected cameras
contexta GPContext
Returns
a gphoto2 error code

This camera will autodetected all cameras that can be autodetected. This will for instance detect all USB cameras.

CameraList *list; gp_list_new (&list); gp_camera_autodetect (list, context); ... done! ...

References gp_abilities_list_detect(), gp_abilities_list_free(), gp_abilities_list_load(), gp_abilities_list_new(), gp_list_append(), gp_list_count(), gp_list_free(), gp_list_get_name(), gp_list_get_value(), gp_list_new(), GP_OK, gp_port_info_list_count(), gp_port_info_list_free(), gp_port_info_list_load(), and gp_port_info_list_new().

int gp_camera_capture ( Camera camera,
CameraCaptureType  type,
CameraFilePath path,
GPContext context 
)

Captures an image, movie, or sound clip depending on the given type.

Parameters
cameraa Camera
typea CameraCaptureType
patha CameraFilePath
contexta GPContext
Returns
a gphoto2 error code

The resulting file will be stored on the camera. The location gets stored in path. The file can then be downloaded using gp_camera_file_get.

References _CameraFunctions::capture, GP_ERROR_NOT_SUPPORTED, and GP_OK.

int gp_camera_capture_preview ( Camera camera,
CameraFile file,
GPContext context 
)

Captures a preview that won't be stored on the camera but returned in supplied file.

Parameters
cameraa Camera
filea CameraFile
contexta GPContext
Returns
a gphoto2 error code

For example, you could use gp_capture_preview() for taking some sample pictures before calling gp_capture().

References _CameraFunctions::capture_preview, GP_ERROR_NOT_SUPPORTED, gp_file_clean(), gp_file_get_name_by_type(), gp_file_set_name(), GP_FILE_TYPE_NORMAL, and GP_OK.

int gp_camera_exit ( Camera camera,
GPContext context 
)

Close connection to camera.

Parameters
cameraa Camera object
contexta GPContext object
Returns
a gphoto2 error code.

Closes a connection to the camera and therefore gives other application the possibility to access the camera, too.

It is recommended that you call this function when you currently don't need the camera. The camera will get reinitialized by gp_camera_init() automatically if you try to access the camera again.

References _CameraFunctions::exit, gp_camera_stop_timeout(), gp_filesystem_reset(), GP_OK, gp_port_close(), gp_port_open(), CameraAbilities::model, and _Camera::pc.

Referenced by gp_camera_free(), gp_camera_get_abilities(), gp_camera_set_abilities(), and gp_camera_set_port_speed().

int gp_camera_file_delete ( Camera camera,
const char *  folder,
const char *  file,
GPContext context 
)

Deletes the file from folder.

Parameters
cameraa Camera
foldera folder
filethe name of a file
contexta GPContext
Returns
a gphoto2 error code

References gp_filesystem_delete_file(), and GP_OK.

int gp_camera_file_get ( Camera camera,
const char *  folder,
const char *  file,
CameraFileType  type,
CameraFile camera_file,
GPContext context 
)

Retrieves a file from the Camera.

Parameters
cameraa Camera
foldera folder
filethe name of a file
typethe CameraFileType
camera_filea CameraFile
contexta GPContext
Returns
a gphoto2 error code

References GP_ERROR_DIRECTORY_NOT_FOUND, GP_ERROR_FILE_NOT_FOUND, gp_file_clean(), gp_filesystem_get_file(), and GP_OK.

Referenced by gp_camera_file_get_info().

int gp_camera_file_get_info ( Camera camera,
const char *  folder,
const char *  file,
CameraFileInfo info,
GPContext context 
)
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 
)

Reads a file partially from the Camera.

Parameters
cameraa Camera
foldera folder
filethe name of a file
typethe CameraFileType
offsetthe offset into the camera file
datathe buffer receiving the data
sizethe size to be read and that was read
contexta GPContext
Returns
a gphoto2 error code

References GP_ERROR_DIRECTORY_NOT_FOUND, GP_ERROR_FILE_NOT_FOUND, gp_filesystem_read_file(), and GP_OK.

int gp_camera_file_set_info ( Camera camera,
const char *  folder,
const char *  file,
CameraFileInfo  info,
GPContext context 
)

Sets some file properties like name or permissions.

Parameters
cameraa Camera
foldera folder
filethe name of a file
infothe CameraFileInfo
contexta GPContext
Returns
a gphoto2 error code

References gp_filesystem_set_info(), and GP_OK.

int gp_camera_folder_delete_all ( Camera camera,
const char *  folder,
GPContext context 
)

Deletes all files in a given folder.

Parameters
cameraa Camera
foldera folder
contexta GPContext
Returns
a gphoto2 error code

References gp_filesystem_delete_all(), and GP_OK.

int gp_camera_folder_list_files ( Camera camera,
const char *  folder,
CameraList list,
GPContext context 
)

Lists the files in supplied folder.

Parameters
cameraa Camera
foldera folder
lista CameraList
contexta GPContext
Returns
a gphoto2 error code

References gp_filesystem_list_files(), gp_list_reset(), gp_list_sort(), and GP_OK.

int gp_camera_folder_list_folders ( Camera camera,
const char *  folder,
CameraList list,
GPContext context 
)

Lists the folders in supplied folder.

Parameters
cameraa Camera
foldera folder
lista CameraList
contexta GPContext
Returns
a gphoto2 error code

References gp_filesystem_list_folders(), gp_list_reset(), gp_list_sort(), and GP_OK.

int gp_camera_folder_make_dir ( Camera camera,
const char *  folder,
const char *  name,
GPContext context 
)

Creates a new directory called name in the given folder.

Parameters
cameraa Camera
folderthe location where to create the new directory
namethe name of the directory to be created
contexta GPContext
Returns
a gphoto2 error code

References gp_filesystem_make_dir(), and GP_OK.

int gp_camera_folder_put_file ( Camera camera,
const char *  folder,
const char *  filename,
CameraFileType  type,
CameraFile file,
GPContext context 
)

Uploads a file into given folder.

Parameters
cameraa Camera
foldera folder
filea CameraFile
contexta GPContext
Returns
a gphoto2 error code

References gp_filesystem_put_file(), and GP_OK.

int gp_camera_folder_remove_dir ( Camera camera,
const char *  folder,
const char *  name,
GPContext context 
)

Removes an (empty) directory called name from the given folder.

Parameters
cameraa Camera
folderthe folder from which to remove the directory
namethe name of the directory to be removed
contexta GPContext
Returns
a gphoto2 error code

References gp_filesystem_remove_dir(), and GP_OK.

int gp_camera_free ( Camera camera)

Free the camera.

Parameters
cameraa Camera
Returns
a gphoto2 error code
Deprecated:
This function should never be used. Please use gp_camera_unref instead.

References gp_camera_exit(), gp_filesystem_free(), GP_OK, gp_port_free(), and _Camera::pc.

Referenced by gp_camera_new(), and gp_camera_unref().

int gp_camera_get_abilities ( Camera camera,
CameraAbilities abilities 
)

Retrieve the abilities of the camera.

Parameters
cameraa Camera
abilities
Returns
a gphoto2 error code

References gp_camera_exit(), GP_OK, gp_port_get_info(), gp_port_info_get_name(), gp_port_info_get_path(), gp_port_set_info(), and _Camera::pc.

int gp_camera_get_about ( Camera camera,
CameraText about,
GPContext context 
)

Retrieves information about the camera driver.

Parameters
cameraa Camera
abouta CameraText
contexta GPContext
Returns
a gphoto2 error code

Typically, this information contains name and address of the author, acknowledgements, etc.

References _CameraFunctions::about, GP_ERROR_NOT_SUPPORTED, and GP_OK.

int gp_camera_get_config ( Camera camera,
CameraWidget **  window,
GPContext context 
)

Retrieve a configuration window for the camera.

Parameters
cameraa Camera
windowa CameraWidget
contexta GPContext
Returns
gphoto2 error code

This window can be used for construction of a configuration dialog.

References _CameraFunctions::get_config, GP_ERROR_NOT_SUPPORTED, and GP_OK.

int gp_camera_get_manual ( Camera camera,
CameraText manual,
GPContext context 
)

Retrieves the manual for given camera.

Parameters
cameraa Camera
manuala CameraText
contexta GPContext
Returns
a gphoto2 error code

This manual typically contains information about using the camera.

References GP_ERROR_NOT_SUPPORTED, GP_OK, and _CameraFunctions::manual.

int gp_camera_get_port_speed ( Camera camera)

Retrieve the current speed.

Parameters
cameraa Camera
Returns
The current speed or a gphoto2 error code

References _Camera::pc.

int gp_camera_get_storageinfo ( Camera camera,
CameraStorageInformation **  sifs,
int *  nrofsifs,
GPContext context 
)

Gets information on the camera attached storage.

Parameters
cameraa Camera
sifsPointer to receive a pointer to/array of storage info items
nrofsifsPointer to receive number of array entries
contexta GPContext
Returns
a gphoto2 error code

Retrieves the storage information, like maximum and free space, for the specified filesystem, if supported by the device. The storage information is returned in an newly allocated array of CameraStorageInformation objects, to which the pointer pointed to by #sifs will be set.

The variable pointed to by #nrofsifs will be set to the number of elements in that array.

It is the caller's responsibility to free the memory of the array.

References gp_filesystem_get_storageinfo(), and GP_OK.

int gp_camera_get_summary ( Camera camera,
CameraText summary,
GPContext context 
)

Retrieves a camera summary.

Parameters
cameraa Camera
summarya CameraText
contexta GPContext
Returns
a gphoto2 error code

This summary typically contains information like manufacturer, pictures taken, or generally information that is not configurable.

References GP_ERROR_NOT_SUPPORTED, GP_OK, and _CameraFunctions::summary.

int gp_camera_init ( Camera camera,
GPContext context 
)

Initiate a connection to the camera.

Parameters
cameraa Camera
contexta GPContext
Returns
a gphoto2 error code

Before calling this function, the camera should be set up using gp_camera_set_port_path() or gp_camera_set_port_name() and gp_camera_set_abilities(). If that has been omitted, gphoto2 tries to autodetect any cameras and chooses the first one if any cameras are found. It is generally a good idea to call gp_camera_exit() after transactions have been completed in order to give other applications the chance to access the camera, too.

References gp_abilities_list_detect(), gp_abilities_list_free(), gp_abilities_list_get_abilities(), gp_abilities_list_load(), gp_abilities_list_lookup_model(), gp_abilities_list_new(), gp_camera_set_abilities(), GP_ERROR_FILE_NOT_FOUND, GP_ERROR_LIBRARY, GP_ERROR_MODEL_NOT_FOUND, GP_ERROR_UNKNOWN_PORT, gp_list_count(), gp_list_free(), gp_list_get_name(), gp_list_get_value(), gp_list_new(), GP_OK, gp_port_close(), gp_port_get_info(), gp_port_info_get_path(), gp_port_info_get_type(), gp_port_info_list_free(), gp_port_info_list_get_info(), gp_port_info_list_load(), gp_port_info_list_lookup_path(), gp_port_info_list_new(), GP_PORT_NONE, gp_port_open(), GP_PORT_USB, gp_port_usb_find_device(), gp_port_usb_find_device_by_class(), CameraAbilities::library, CameraAbilities::model, _Camera::pc, _GPPort::type, CameraAbilities::usb_class, CameraAbilities::usb_product, CameraAbilities::usb_protocol, CameraAbilities::usb_subclass, and CameraAbilities::usb_vendor.

int gp_camera_new ( Camera **  camera)

Allocates the memory for a Camera.

Parameters
camerathe Camera object to initialize.
Returns
a gphoto2 error code

References gp_camera_free(), GP_ERROR_NO_MEMORY, gp_filesystem_new(), GP_OK, and gp_port_new().

int gp_camera_ref ( Camera camera)

Increment the reference count of a camera.

Parameters
cameraa Camera
Returns
a gphoto2 error code

References GP_OK, and _Camera::pc.

int gp_camera_set_abilities ( Camera camera,
CameraAbilities  abilities 
)

Sets the camera abilities.

Parameters
cameraa Camera
abilitiesthe CameraAbilities to be set
Returns
a gphoto2 error code

You need to call this function before calling gp_camera_init the first time unless you want gphoto2 to autodetect cameras and choose the first detected one. By setting the abilities, you tell gphoto2 what model the camera is and what camera driver should be used for accessing the camera. You can get abilities by calling gp_abilities_list_get_abilities.

References gp_camera_exit(), GP_OK, CameraAbilities::model, and _Camera::pc.

Referenced by gp_camera_init().

int gp_camera_set_config ( Camera camera,
CameraWidget window,
GPContext context 
)

Sets the configuration.

Parameters
cameraa Camera
windowa CameraWidget
contexta GPContext
Returns
a gphoto2 error code

Typically, a window is retrieved using gp_camera_get_config and passed to this function in order to adjust the settings on the camera.

References GP_ERROR_NOT_SUPPORTED, GP_OK, and _CameraFunctions::set_config.

int gp_camera_set_port_speed ( Camera camera,
int  speed 
)

Set the camera speed.

Parameters
cameraa Camera
speedthe speed
Returns
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.

References gp_camera_exit(), GP_OK, gp_port_get_settings(), GP_PORT_SERIAL, gp_port_set_settings(), _Camera::pc, _GPPortSettings::serial, _GPPortSettingsSerial::speed, and _GPPort::type.

int gp_camera_set_single_config ( Camera camera,
const char *  name,
CameraWidget widget,
GPContext context 
)
void gp_camera_set_timeout_funcs ( Camera camera,
CameraTimeoutStartFunc  start_func,
CameraTimeoutStopFunc  stop_func,
void *  data 
)
Parameters
cameraa Camera
start_func
stop_func
data
Returns
a gphoto2 error code

If your frontend has something like idle loops, it is recommended you use gp_camera_set_timeout_funcs in order to give the camera driver the possibility to keep up the connection to the camera.

References _Camera::pc.

int gp_camera_start_timeout ( Camera camera,
unsigned int  timeout,
CameraTimeoutFunc  func 
)
Parameters
cameraa Camera
timeoutnumber of seconds that should pass between each call to func
functhe function that should be called each timeout seconds
Returns
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.

References GP_ERROR_NOT_SUPPORTED, and _Camera::pc.

void gp_camera_stop_timeout ( Camera camera,
unsigned int  id 
)

Stop periodic calls to keepalive function.

Parameters
cameraa Camera
idthe id of the background process previously returned by gp_camera_start_timeout

Call this function in the camera driver if you want to stop a periodic call to a function that has been started using gp_camera_start_timeout.

References _Camera::pc.

Referenced by gp_camera_exit().

int gp_camera_trigger_capture ( Camera camera,
GPContext context 
)

Triggers capture of one or more images.

Parameters
cameraa Camera
contexta GPContext
Returns
a gphoto2 error code

This functions just remotely causes the shutter release and returns immediately. You will want to run #gp_camera_wait_event until a image is added which can be downloaded using gp_camera_file_get.

References GP_ERROR_NOT_SUPPORTED, GP_OK, and _CameraFunctions::trigger_capture.

int gp_camera_unref ( Camera camera)

Decrements the reference count of a Camera.

Parameters
cameraa Camera
Returns
a gphoto2 error code

If the reference count reaches %0, the camera will be freed automatically.

References gp_camera_free(), GP_ERROR, GP_OK, and _Camera::pc.

int gp_camera_wait_for_event ( Camera camera,
int  timeout,
CameraEventType eventtype,
void **  eventdata,
GPContext context 
)

Wait for an event from the camera.

Parameters
cameraa Camera
timeoutamount of time to wait in 1/1000 seconds
eventtypereceived CameraEventType [out]
eventdatareceived event specific data [out]
contexta GPContext
Returns
gphoto2 error code

This function blocks and waits for an event to come from the camera. If timeout occurs before an event is received then *eventtype==GP_EVENT_TIMEOUT and eventdata is left unchanged. If an event is received then eventtype is set to the type of event, and eventdata is set to event specific data. See the CameraEventType enum to see which eventtype's match to which types of eventdata.

References GP_ERROR_NOT_SUPPORTED, GP_OK, and _CameraFunctions::wait_for_event.