libgphoto2 photo camera library (libgphoto2) API 2.5.2

- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

gphoto2-camera.h
Go to the documentation of this file.
1
26 #ifndef __GPHOTO2_CAMERA_H__
27 #define __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
104 typedef enum {
105 GP_EVENT_UNKNOWN,
106 GP_EVENT_TIMEOUT,
107 GP_EVENT_FILE_ADDED,
108 GP_EVENT_FOLDER_ADDED,
109 GP_EVENT_CAPTURE_COMPLETE
110 } CameraEventType;
111
138 typedef int (*CameraExitFunc) (Camera *camera, GPContext *context);
158 typedef int (*CameraGetConfigFunc) (Camera *camera, CameraWidget **widget,
159 GPContext *context);
173 typedef int (*CameraSetConfigFunc) (Camera *camera, CameraWidget *widget,
174 GPContext *context);
175 typedef int (*CameraCaptureFunc) (Camera *camera, CameraCaptureType type,
176 CameraFilePath *path, GPContext *context);
177 typedef int (*CameraTriggerCaptureFunc) (Camera *camera, GPContext *context);
178 typedef int (*CameraCapturePreviewFunc) (Camera *camera, CameraFile *file,
179 GPContext *context);
180 typedef int (*CameraSummaryFunc) (Camera *camera, CameraText *text,
181 GPContext *context);
182 typedef int (*CameraManualFunc) (Camera *camera, CameraText *text,
183 GPContext *context);
184 typedef int (*CameraAboutFunc) (Camera *camera, CameraText *text,
185 GPContext *context);
186 typedef int (*CameraWaitForEvent) (Camera *camera, int timeout,
187 CameraEventType *eventtype, void **eventdata,
188 GPContext *context);
206 typedef int (*CameraPrePostFunc) (Camera *camera, GPContext *context);
207
220 typedef struct _CameraFunctions {
221 CameraPrePostFunc pre_func;
222 CameraPrePostFunc post_func;
224 CameraExitFunc exit;
226 /* Configuration */
227 CameraGetConfigFunc get_config;
228 CameraSetConfigFunc set_config;
230 /* Capturing */
231 CameraCaptureFunc capture;
232 CameraTriggerCaptureFunc trigger_capture;
233 CameraCapturePreviewFunc capture_preview;
235 /* Textual information */
236 CameraSummaryFunc summary;
237 CameraManualFunc manual;
238 CameraAboutFunc about;
240 /* Event Interface */
241 CameraWaitForEvent wait_for_event;
242 /* Reserved space to use in the future without changing the struct size */
243 void *reserved1;
244 void *reserved2;
245 void *reserved3;
246 void *reserved4;
247 void *reserved5;
248 void *reserved6;
249 void *reserved7;
250 void *reserved8;
251 } CameraFunctions;
252
253 typedef struct _CameraPrivateLibrary CameraPrivateLibrary;
254 typedef struct _CameraPrivateCore CameraPrivateCore;
255
256 struct _Camera {
257
260 GPPort *port;
261 CameraFilesystem *fs;
262 CameraFunctions *functions;
265 CameraPrivateLibrary *pl;
266 CameraPrivateCore *pc;
267 };
268
269
271 int gp_camera_new (Camera **camera);
272
273
277 int gp_camera_set_abilities (Camera *camera, CameraAbilities abilities);
278 int gp_camera_get_abilities (Camera *camera, CameraAbilities *abilities);
279 int gp_camera_set_port_info (Camera *camera, GPPortInfo info);
280 int gp_camera_get_port_info (Camera *camera, GPPortInfo *info);
281
293 int gp_camera_set_port_speed (Camera *camera, int speed);
294 int gp_camera_get_port_speed (Camera *camera);
295
302 int gp_camera_autodetect (CameraList *list, GPContext *context);
303 int gp_camera_init (Camera *camera, GPContext *context);
304 int gp_camera_exit (Camera *camera, GPContext *context);
305
313 int gp_camera_ref (Camera *camera);
314 int gp_camera_unref (Camera *camera);
315 int gp_camera_free (Camera *camera);
316
317 int gp_camera_get_config (Camera *camera, CameraWidget **window,
318 GPContext *context);
319 int gp_camera_set_config (Camera *camera, CameraWidget *window,
320 GPContext *context);
321 int gp_camera_get_summary (Camera *camera, CameraText *summary,
322 GPContext *context);
323 int gp_camera_get_manual (Camera *camera, CameraText *manual,
324 GPContext *context);
325 int gp_camera_get_about (Camera *camera, CameraText *about,
326 GPContext *context);
327 int gp_camera_capture (Camera *camera, CameraCaptureType type,
328 CameraFilePath *path, GPContext *context);
329 int gp_camera_trigger_capture (Camera *camera, GPContext *context);
330 int gp_camera_capture_preview (Camera *camera, CameraFile *file,
331 GPContext *context);
332 int gp_camera_wait_for_event (Camera *camera, int timeout,
333 CameraEventType *eventtype, void **eventdata,
334 GPContext *context);
335
336 int gp_camera_get_storageinfo (Camera *camera, CameraStorageInformation**,
337 int *, GPContext *context);
338
345 int gp_camera_folder_list_files (Camera *camera, const char *folder,
346 CameraList *list, GPContext *context);
347 int gp_camera_folder_list_folders (Camera *camera, const char *folder,
348 CameraList *list, GPContext *context);
349 int gp_camera_folder_delete_all (Camera *camera, const char *folder,
350 GPContext *context);
351 int gp_camera_folder_put_file (Camera *camera,
352 const char *folder, const char *filename,
353 CameraFileType type,
354 CameraFile *file, GPContext *context);
355 int gp_camera_folder_make_dir (Camera *camera, const char *folder,
356 const char *name, GPContext *context);
357 int gp_camera_folder_remove_dir (Camera *camera, const char *folder,
358 const char *name, GPContext *context);
365 int gp_camera_file_get_info (Camera *camera, const char *folder,
366 const char *file, CameraFileInfo *info,
367 GPContext *context);
368 int gp_camera_file_set_info (Camera *camera, const char *folder,
369 const char *file, CameraFileInfo info,
370 GPContext *context);
371 int gp_camera_file_get (Camera *camera, const char *folder,
372 const char *file, CameraFileType type,
373 CameraFile *camera_file, GPContext *context);
374 int gp_camera_file_read (Camera *camera, const char *folder, const char *file,
375 CameraFileType type,
376 uint64_t offset, char *buf, uint64_t *size,
377 GPContext *context);
378 int gp_camera_file_delete (Camera *camera, const char *folder,
379 const char *file, GPContext *context);
387 typedef int (* CameraTimeoutFunc) (Camera *camera,
388 GPContext *context);
389 typedef unsigned int (* CameraTimeoutStartFunc) (Camera *camera,
390 unsigned int timeout,
391 CameraTimeoutFunc func,
392 void *data);
393 typedef void (* CameraTimeoutStopFunc) (Camera *camera,
394 unsigned int id, void *data);
395 void gp_camera_set_timeout_funcs (Camera *camera,
396 CameraTimeoutStartFunc start_func,
397 CameraTimeoutStopFunc stop_func,
398 void *data);
399 int gp_camera_start_timeout (Camera *camera, unsigned int timeout,
400 CameraTimeoutFunc func);
401 void gp_camera_stop_timeout (Camera *camera, unsigned int id);
402
404 #ifdef __cplusplus
405 }
406 #endif /* __cplusplus */
407
408
409 #endif /* __GPHOTO2_CAMERA_H__ */