libgphoto2 photo camera library (libgphoto2) API 2.5.31

gphoto2-camera.h
Go to the documentation of this file.
1
25
26#ifndef LIBGPHOTO2_GPHOTO2_CAMERA_H
27#define LIBGPHOTO2_GPHOTO2_CAMERA_H
28
29#ifdef __cplusplus
30 extern "C" {
31#endif /* __cplusplus */
32
44 typedef struct _Camera Camera;
45#ifdef __cplusplus
46}
47#endif /* __cplusplus */
48
49
50#include <gphoto2/gphoto2-abilities-list.h>
51#include <gphoto2/gphoto2-port.h>
52
53#include <gphoto2/gphoto2-widget.h>
54#include <gphoto2/gphoto2-filesys.h>
55#include <gphoto2/gphoto2-result.h>
56
57#ifdef __cplusplus
58 extern "C" {
59#endif /* __cplusplus */
60
68 typedef struct {
69 char text [32 * 1024];
70} CameraText;
71
79 typedef struct {
80 char name [128];
81 char folder [1024];
82} CameraFilePath;
83
90 typedef enum {
91 GP_CAPTURE_IMAGE,
92 GP_CAPTURE_MOVIE,
93 GP_CAPTURE_SOUND
94} CameraCaptureType;
95
103 typedef enum {
104 GP_EVENT_UNKNOWN,
105 GP_EVENT_TIMEOUT,
106 GP_EVENT_FILE_ADDED,
107 GP_EVENT_FOLDER_ADDED,
108 GP_EVENT_CAPTURE_COMPLETE,
109 GP_EVENT_FILE_CHANGED
110} CameraEventType;
111
138 typedef int (*CameraExitFunc) (Camera *camera, GPContext *context);
139
159 typedef int (*CameraGetConfigFunc) (Camera *camera, CameraWidget **widget,
160 GPContext *context);
184 typedef int (*CameraGetSingleConfigFunc) (Camera *camera, const char *name, CameraWidget **widget,
185 GPContext *context);
209 typedef int (*CameraListConfigFunc) (Camera *camera, CameraList *list, GPContext *context);
223 typedef int (*CameraSetConfigFunc) (Camera *camera, CameraWidget *widget,
224 GPContext *context);
237 typedef int (*CameraSetSingleConfigFunc) (Camera *camera, const char *name, CameraWidget *widget,
238 GPContext *context);
239
240 typedef int (*CameraCaptureFunc) (Camera *camera, CameraCaptureType type,
241 CameraFilePath *path, GPContext *context);
242 typedef int (*CameraTriggerCaptureFunc) (Camera *camera, GPContext *context);
243 typedef int (*CameraCapturePreviewFunc) (Camera *camera, CameraFile *file,
244 GPContext *context);
245 typedef int (*CameraSummaryFunc) (Camera *camera, CameraText *text,
246 GPContext *context);
247 typedef int (*CameraManualFunc) (Camera *camera, CameraText *text,
248 GPContext *context);
249 typedef int (*CameraAboutFunc) (Camera *camera, CameraText *text,
250 GPContext *context);
251 typedef int (*CameraWaitForEvent) (Camera *camera, int timeout,
252 CameraEventType *eventtype, void **eventdata,
253 GPContext *context);
255
256
271 typedef int (*CameraPrePostFunc) (Camera *camera, GPContext *context);
272
285 typedef struct _CameraFunctions {
286 CameraPrePostFunc pre_func;
287 CameraPrePostFunc post_func;
288
289 CameraExitFunc exit;
290
291 /* Configuration */
292 CameraGetConfigFunc get_config;
293 CameraSetConfigFunc set_config;
294
295 CameraListConfigFunc list_config;
296 CameraGetSingleConfigFunc get_single_config;
297 CameraSetSingleConfigFunc set_single_config;
298
299 /* Capturing */
300 CameraCaptureFunc capture;
301 CameraTriggerCaptureFunc trigger_capture;
302 CameraCapturePreviewFunc capture_preview;
303
304 /* Textual information */
305 CameraSummaryFunc summary;
306 CameraManualFunc manual;
307 CameraAboutFunc about;
308
309 /* Event Interface */
310 CameraWaitForEvent wait_for_event;
311 /* Reserved space to use in the future without changing the struct size */
312 void *reserved1;
313 void *reserved2;
314 void *reserved3;
315 void *reserved4;
316 void *reserved5;
317 void *reserved6;
318 void *reserved7;
319 void *reserved8;
320} CameraFunctions;
321
322 typedef struct _CameraPrivateLibrary CameraPrivateLibrary;
323 typedef struct _CameraPrivateCore CameraPrivateCore;
324
325 struct _Camera {
326
329 GPPort *port;
330 CameraFilesystem *fs;
331 CameraFunctions *functions;
333
334 CameraPrivateLibrary *pl;
335 CameraPrivateCore *pc;
336};
337
338
340 int gp_camera_new (Camera **camera);
341
342
346 int gp_camera_set_abilities (Camera *camera, CameraAbilities abilities);
347 int gp_camera_get_abilities (Camera *camera, CameraAbilities *abilities);
348 int gp_camera_set_port_info (Camera *camera, GPPortInfo info);
349 int gp_camera_get_port_info (Camera *camera, GPPortInfo *info);
350
352
353
362 int gp_camera_set_port_speed (Camera *camera, int speed);
363 int gp_camera_get_port_speed (Camera *camera);
364
366
367
371 int gp_camera_autodetect (CameraList *list, GPContext *context);
372 int gp_camera_init (Camera *camera, GPContext *context);
373 int gp_camera_exit (Camera *camera, GPContext *context);
374
376
377
378
382 int gp_camera_ref (Camera *camera);
383 int gp_camera_unref (Camera *camera);
384 int gp_camera_free (Camera *camera);
385
386 int gp_camera_get_config (Camera *camera, CameraWidget **window,
387 GPContext *context);
388 int gp_camera_list_config (Camera *camera, CameraList *list,
389 GPContext *context);
390 int gp_camera_get_single_config (Camera *camera, const char *name, CameraWidget **widget,
391 GPContext *context);
392 int gp_camera_set_config (Camera *camera, CameraWidget *window,
393 GPContext *context);
394 int gp_camera_set_single_config (Camera *camera, const char *name, CameraWidget *widget,
395 GPContext *context);
396 int gp_camera_get_summary (Camera *camera, CameraText *summary,
397 GPContext *context);
398 int gp_camera_get_manual (Camera *camera, CameraText *manual,
399 GPContext *context);
400 int gp_camera_get_about (Camera *camera, CameraText *about,
401 GPContext *context);
402 int gp_camera_capture (Camera *camera, CameraCaptureType type,
403 CameraFilePath *path, GPContext *context);
404 int gp_camera_trigger_capture (Camera *camera, GPContext *context);
405 int gp_camera_capture_preview (Camera *camera, CameraFile *file,
406 GPContext *context);
407 int gp_camera_wait_for_event (Camera *camera, int timeout,
408 CameraEventType *eventtype, void **eventdata,
409 GPContext *context);
410
411 int gp_camera_get_storageinfo (Camera *camera, CameraStorageInformation**,
412 int *, GPContext *context);
413
415
416
420 int gp_camera_folder_list_files (Camera *camera, const char *folder,
421 CameraList *list, GPContext *context);
422 int gp_camera_folder_list_folders (Camera *camera, const char *folder,
423 CameraList *list, GPContext *context);
424 int gp_camera_folder_delete_all (Camera *camera, const char *folder,
425 GPContext *context);
426 int gp_camera_folder_put_file (Camera *camera,
427 const char *folder, const char *filename,
428 CameraFileType type,
429 CameraFile *file, GPContext *context);
430 int gp_camera_folder_make_dir (Camera *camera, const char *folder,
431 const char *name, GPContext *context);
432 int gp_camera_folder_remove_dir (Camera *camera, const char *folder,
433 const char *name, GPContext *context);
435
436
440 int gp_camera_file_get_info (Camera *camera, const char *folder,
441 const char *file, CameraFileInfo *info,
442 GPContext *context);
443 int gp_camera_file_set_info (Camera *camera, const char *folder,
444 const char *file, CameraFileInfo info,
445 GPContext *context);
446 int gp_camera_file_get (Camera *camera, const char *folder,
447 const char *file, CameraFileType type,
448 CameraFile *camera_file, GPContext *context);
449 int gp_camera_file_read (Camera *camera, const char *folder, const char *file,
450 CameraFileType type,
451 uint64_t offset, char *buf, uint64_t *size,
452 GPContext *context);
453 int gp_camera_file_delete (Camera *camera, const char *folder,
454 const char *file, GPContext *context);
456
457
462 typedef int (* CameraTimeoutFunc) (Camera *camera,
463 GPContext *context);
464 typedef unsigned int (* CameraTimeoutStartFunc) (Camera *camera,
465 unsigned int timeout,
466 CameraTimeoutFunc func,
467 void *data);
468 typedef void (* CameraTimeoutStopFunc) (Camera *camera,
469 unsigned int id, void *data);
470 void gp_camera_set_timeout_funcs (Camera *camera,
471 CameraTimeoutStartFunc start_func,
472 CameraTimeoutStopFunc stop_func,
473 void *data);
474 int gp_camera_start_timeout (Camera *camera, unsigned int timeout,
475 CameraTimeoutFunc func);
476 void gp_camera_stop_timeout (Camera *camera, unsigned int id);
477
479#ifdef __cplusplus
480}
481#endif /* __cplusplus */
482
483
484#endif /* !defined(LIBGPHOTO2_GPHOTO2_CAMERA_H) */
gphoto2-abilities-list.h
List of supported camera models including their abilities.
gp_camera_get_port_speed
int gp_camera_get_port_speed(Camera *camera)
Definition gphoto2-camera.c:479
CameraFunctions
struct _CameraFunctions CameraFunctions
Various camera specific functions.
gp_camera_get_about
int gp_camera_get_about(Camera *camera, CameraText *about, GPContext *context)
Definition gphoto2-camera.c:1294
gp_camera_set_config
int gp_camera_set_config(Camera *camera, CameraWidget *window, GPContext *context)
Definition gphoto2-camera.c:1102
gp_camera_folder_delete_all
int gp_camera_folder_delete_all(Camera *camera, const char *folder, GPContext *context)
Definition gphoto2-camera.c:1522
gp_camera_folder_list_files
int gp_camera_folder_list_files(Camera *camera, const char *folder, CameraList *list, GPContext *context)
Definition gphoto2-camera.c:1467
gp_camera_set_port_speed
int gp_camera_set_port_speed(Camera *camera, int speed)
Definition gphoto2-camera.c:444
gp_camera_folder_remove_dir
int gp_camera_folder_remove_dir(Camera *camera, const char *folder, const char *name, GPContext *context)
Definition gphoto2-camera.c:1802
gp_camera_file_set_info
int gp_camera_file_set_info(Camera *camera, const char *folder, const char *file, CameraFileInfo info, GPContext *context)
Definition gphoto2-camera.c:1644
gp_camera_file_read
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)
Definition gphoto2-camera.c:1714
gp_camera_get_abilities
int gp_camera_get_abilities(Camera *camera, CameraAbilities *abilities)
Definition gphoto2-camera.c:384
gp_camera_file_get
int gp_camera_file_get(Camera *camera, const char *folder, const char *file, CameraFileType type, CameraFile *camera_file, GPContext *context)
Definition gphoto2-camera.c:1671
CameraSetConfigFunc
int(* CameraSetConfigFunc)(Camera *camera, CameraWidget *widget, GPContext *context)
Set the configuration in the camera.
Definition gphoto2-camera.h:223
CameraSetSingleConfigFunc
int(* CameraSetSingleConfigFunc)(Camera *camera, const char *name, CameraWidget *widget, GPContext *context)
Set a single configuration variable in the camera.
Definition gphoto2-camera.h:237
gp_camera_get_manual
int gp_camera_get_manual(Camera *camera, CameraText *manual, GPContext *context)
Definition gphoto2-camera.c:1262
CameraPrePostFunc
int(* CameraPrePostFunc)(Camera *camera, GPContext *context)
Definition gphoto2-camera.h:271
CameraEventType
CameraEventType
Specify what event we received from the camera.
Definition gphoto2-camera.h:103
GP_EVENT_FILE_ADDED
@ GP_EVENT_FILE_ADDED
Definition gphoto2-camera.h:106
GP_EVENT_FOLDER_ADDED
@ GP_EVENT_FOLDER_ADDED
Definition gphoto2-camera.h:107
GP_EVENT_TIMEOUT
@ GP_EVENT_TIMEOUT
Definition gphoto2-camera.h:105
GP_EVENT_UNKNOWN
@ GP_EVENT_UNKNOWN
Definition gphoto2-camera.h:104
GP_EVENT_FILE_CHANGED
@ GP_EVENT_FILE_CHANGED
Definition gphoto2-camera.h:109
GP_EVENT_CAPTURE_COMPLETE
@ GP_EVENT_CAPTURE_COMPLETE
Definition gphoto2-camera.h:108
gp_camera_ref
int gp_camera_ref(Camera *camera)
Definition gphoto2-camera.c:495
gp_camera_file_delete
int gp_camera_file_delete(Camera *camera, const char *folder, const char *file, GPContext *context)
Definition gphoto2-camera.c:1752
gp_camera_trigger_capture
int gp_camera_trigger_capture(Camera *camera, GPContext *context)
Definition gphoto2-camera.c:1358
Camera
struct _Camera Camera
Object representing a camera attached to the system.
Definition gphoto2-camera.h:44
gp_camera_unref
int gp_camera_unref(Camera *camera)
Definition gphoto2-camera.c:516
gp_camera_start_timeout
int gp_camera_start_timeout(Camera *camera, unsigned int timeout, CameraTimeoutFunc func)
Definition gphoto2-camera.c:1893
gp_camera_wait_for_event
int gp_camera_wait_for_event(Camera *camera, int timeout, CameraEventType *eventtype, void **eventdata, GPContext *context)
Definition gphoto2-camera.c:1438
CameraCaptureType
CameraCaptureType
Type of the capture to do.
Definition gphoto2-camera.h:90
GP_CAPTURE_IMAGE
@ GP_CAPTURE_IMAGE
Capture an image.
Definition gphoto2-camera.h:91
GP_CAPTURE_SOUND
@ GP_CAPTURE_SOUND
Capture audio.
Definition gphoto2-camera.h:93
GP_CAPTURE_MOVIE
@ GP_CAPTURE_MOVIE
Capture a movie.
Definition gphoto2-camera.h:92
gp_camera_folder_make_dir
int gp_camera_folder_make_dir(Camera *camera, const char *folder, const char *name, GPContext *context)
Definition gphoto2-camera.c:1778
gp_camera_stop_timeout
void gp_camera_stop_timeout(Camera *camera, unsigned int id)
Definition gphoto2-camera.c:1934
gp_camera_exit
int gp_camera_exit(Camera *camera, GPContext *context)
Definition gphoto2-camera.c:249
gp_camera_free
int gp_camera_free(Camera *camera)
Definition gphoto2-camera.c:550
gp_camera_get_summary
int gp_camera_get_summary(Camera *camera, CameraText *summary, GPContext *context)
Definition gphoto2-camera.c:1231
gp_camera_folder_list_folders
int gp_camera_folder_list_folders(Camera *camera, const char *folder, CameraList *list, GPContext *context)
Definition gphoto2-camera.c:1495
gp_camera_capture
int gp_camera_capture(Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context)
Definition gphoto2-camera.c:1327
gp_camera_set_abilities
int gp_camera_set_abilities(Camera *camera, CameraAbilities abilities)
Sets the camera abilities.
Definition gphoto2-camera.c:356
gp_camera_get_storageinfo
int gp_camera_get_storageinfo(Camera *camera, CameraStorageInformation **, int *, GPContext *context)
Gets information on the camera attached storage.
Definition gphoto2-camera.c:1837
gp_camera_folder_put_file
int gp_camera_folder_put_file(Camera *camera, const char *folder, const char *filename, CameraFileType type, CameraFile *file, GPContext *context)
Definition gphoto2-camera.c:1548
CameraGetConfigFunc
int(* CameraGetConfigFunc)(Camera *camera, CameraWidget **widget, GPContext *context)
Get a configuration tree for the camera and its driver.
Definition gphoto2-camera.h:159
gp_camera_init
int gp_camera_init(Camera *camera, GPContext *context)
Definition gphoto2-camera.c:671
gp_camera_get_single_config
int gp_camera_get_single_config(Camera *camera, const char *name, CameraWidget **widget, GPContext *context)
Definition gphoto2-camera.c:891
CameraExitFunc
int(* CameraExitFunc)(Camera *camera, GPContext *context)
The camera exit function.
Definition gphoto2-camera.h:138
gp_camera_capture_preview
int gp_camera_capture_preview(Camera *camera, CameraFile *file, GPContext *context)
Definition gphoto2-camera.c:1388
CameraGetSingleConfigFunc
int(* CameraGetSingleConfigFunc)(Camera *camera, const char *name, CameraWidget **widget, GPContext *context)
Get a configuration widget for a specific configuration.
Definition gphoto2-camera.h:184
gp_camera_new
int gp_camera_new(Camera **camera)
Definition gphoto2-camera.c:305
gp_camera_file_get_info
int gp_camera_file_get_info(Camera *camera, const char *folder, const char *file, CameraFileInfo *info, GPContext *context)
Definition gphoto2-camera.c:1578
gp_camera_set_single_config
int gp_camera_set_single_config(Camera *camera, const char *name, CameraWidget *widget, GPContext *context)
Definition gphoto2-camera.c:1134
CameraListConfigFunc
int(* CameraListConfigFunc)(Camera *camera, CameraList *list, GPContext *context)
List all configuration widgets for a specific configuration.
Definition gphoto2-camera.h:209
gp_camera_autodetect
int gp_camera_autodetect(CameraList *list, GPContext *context)
Definition gphoto2-camera.c:606
gp_camera_get_config
int gp_camera_get_config(Camera *camera, CameraWidget **window, GPContext *context)
Definition gphoto2-camera.c:858
gp_camera_set_timeout_funcs
void gp_camera_set_timeout_funcs(Camera *camera, CameraTimeoutStartFunc start_func, CameraTimeoutStopFunc stop_func, void *data)
Definition gphoto2-camera.c:1867
GPContext
struct _GPContext GPContext
The gphoto context structure.
Definition gphoto2-context.h:41
CameraFileType
CameraFileType
The type of view on the specified file.
Definition gphoto2-file.h:73
gphoto2-filesys.h
Filesystem related operations and declarations.
CameraFilesystem
struct _CameraFilesystem CameraFilesystem
Filesystem structure, only exposed to camera drivers.
Definition gphoto2-filesys.h:234
CameraFileInfo
struct _CameraFileInfo CameraFileInfo
File information structure.
CameraStorageInformation
struct _CameraStorageInformation CameraStorageInformation
Storage information structue.
CameraList
struct _CameraList CameraList
A generic list.
Definition gphoto2-list.h:66
gphoto2-port.h
GPPort
struct _GPPort GPPort
The GPhoto port structure.
gphoto2-result.h
gphoto2-widget.h
CameraWidget
struct _CameraWidget CameraWidget
internal structure please use the accessors.
Definition gphoto2-widget.h:34
CameraAbilities
Describes the properties of a specific camera.
Definition gphoto2-abilities-list.h:120
CameraFilePath
A structure created by the capture operation.
Definition gphoto2-camera.h:79
CameraFilePath::name
char name[128]
Name of the captured file.
Definition gphoto2-camera.h:80
CameraFilePath::folder
char folder[1024]
Name of the folder of the captured file.
Definition gphoto2-camera.h:81
CameraFile
File structure.
CameraText
CameraText structure used in various functions.
Definition gphoto2-camera.h:68
CameraText::text
char text[32 *1024]
Character string containing the translated text.
Definition gphoto2-camera.h:69
_CameraFunctions
Various camera specific functions.
Definition gphoto2-camera.h:285
_CameraFunctions::reserved5
void * reserved5
reserved for future use
Definition gphoto2-camera.h:316
_CameraFunctions::reserved4
void * reserved4
reserved for future use
Definition gphoto2-camera.h:315
_CameraFunctions::set_single_config
CameraSetSingleConfigFunc set_single_config
Called for setting a single configuration widget.
Definition gphoto2-camera.h:297
_CameraFunctions::reserved2
void * reserved2
reserved for future use
Definition gphoto2-camera.h:313
_CameraFunctions::get_single_config
CameraGetSingleConfigFunc get_single_config
Called for requesteing a single widget.
Definition gphoto2-camera.h:296
_CameraFunctions::capture_preview
CameraCapturePreviewFunc capture_preview
Preview viewfinder content.
Definition gphoto2-camera.h:302
_CameraFunctions::post_func
CameraPrePostFunc post_func
Function called after each camera operation.
Definition gphoto2-camera.h:287
_CameraFunctions::manual
CameraManualFunc manual
Give a brief manual about any specific items a user has to know, translated.
Definition gphoto2-camera.h:306
_CameraFunctions::wait_for_event
CameraWaitForEvent wait_for_event
Wait for a specific event from the camera.
Definition gphoto2-camera.h:310
_CameraFunctions::reserved8
void * reserved8
reserved for future use
Definition gphoto2-camera.h:319
_CameraFunctions::reserved6
void * reserved6
reserved for future use
Definition gphoto2-camera.h:317
_CameraFunctions::pre_func
CameraPrePostFunc pre_func
Function called before each camera operation.
Definition gphoto2-camera.h:286
_CameraFunctions::get_config
CameraGetConfigFunc get_config
Called for requesting the configuration widgets.
Definition gphoto2-camera.h:292
_CameraFunctions::about
CameraAboutFunc about
A little About text, including authors and credits.
Definition gphoto2-camera.h:307
_CameraFunctions::set_config
CameraSetConfigFunc set_config
Called after a configuration was changed.
Definition gphoto2-camera.h:293
_CameraFunctions::summary
CameraSummaryFunc summary
Give a summary about the current camera status, translated.
Definition gphoto2-camera.h:305
_CameraFunctions::exit
CameraExitFunc exit
Function called on closing the camera.
Definition gphoto2-camera.h:289
_CameraFunctions::trigger_capture
CameraTriggerCaptureFunc trigger_capture
Remote control the camera to trigger capture.
Definition gphoto2-camera.h:301
_CameraFunctions::capture
CameraCaptureFunc capture
Remote control the camera to capture.
Definition gphoto2-camera.h:300
_CameraFunctions::list_config
CameraListConfigFunc list_config
Called for listing the available configuration widgets.
Definition gphoto2-camera.h:295
_CameraFunctions::reserved7
void * reserved7
reserved for future use
Definition gphoto2-camera.h:318
_CameraFunctions::reserved1
void * reserved1
reserved for future use
Definition gphoto2-camera.h:312
_CameraFunctions::reserved3
void * reserved3
reserved for future use
Definition gphoto2-camera.h:314
_CameraPrivateCore
Definition gphoto2-camera.c:204
_Camera
Definition gphoto2-camera.h:325
_Camera::pl
CameraPrivateLibrary * pl
Definition gphoto2-camera.h:334
_Camera::pc
CameraPrivateCore * pc
Definition gphoto2-camera.h:335