00001
00026 #ifndef __GPHOTO2_CAMERA_H__
00027 #define __GPHOTO2_CAMERA_H__
00028
00040 typedef struct _Camera Camera;
00041
00042
00043 #include <gphoto2/gphoto2-abilities-list.h>
00044 #include <gphoto2/gphoto2-port.h>
00045
00046 #include <gphoto2/gphoto2-widget.h>
00047 #include <gphoto2/gphoto2-filesys.h>
00048 #include <gphoto2/gphoto2-result.h>
00049
00057 typedef struct {
00058 char text [32 * 1024];
00059 } CameraText;
00060
00068 typedef struct {
00069 char name [128];
00070 char folder [1024];
00071 } CameraFilePath;
00072
00079 typedef enum {
00080 GP_CAPTURE_IMAGE,
00081 GP_CAPTURE_MOVIE,
00082 GP_CAPTURE_SOUND
00083 } CameraCaptureType;
00084
00093 typedef enum {
00094 GP_EVENT_UNKNOWN,
00095 GP_EVENT_TIMEOUT,
00096 GP_EVENT_FILE_ADDED,
00097 GP_EVENT_FOLDER_ADDED
00098 } CameraEventType;
00099
00126 typedef int (*CameraExitFunc) (Camera *camera, GPContext *context);
00146 typedef int (*CameraGetConfigFunc) (Camera *camera, CameraWidget **widget,
00147 GPContext *context);
00161 typedef int (*CameraSetConfigFunc) (Camera *camera, CameraWidget *widget,
00162 GPContext *context);
00163 typedef int (*CameraCaptureFunc) (Camera *camera, CameraCaptureType type,
00164 CameraFilePath *path, GPContext *context);
00165 typedef int (*CameraCapturePreviewFunc) (Camera *camera, CameraFile *file,
00166 GPContext *context);
00167 typedef int (*CameraSummaryFunc) (Camera *camera, CameraText *text,
00168 GPContext *context);
00169 typedef int (*CameraManualFunc) (Camera *camera, CameraText *text,
00170 GPContext *context);
00171 typedef int (*CameraAboutFunc) (Camera *camera, CameraText *text,
00172 GPContext *context);
00173 typedef int (*CameraWaitForEvent) (Camera *camera, int timeout,
00174 CameraEventType *eventtype, void **eventdata,
00175 GPContext *context);
00193 typedef int (*CameraPrePostFunc) (Camera *camera, GPContext *context);
00194
00207 typedef struct _CameraFunctions {
00208 CameraPrePostFunc pre_func;
00209 CameraPrePostFunc post_func;
00211 CameraExitFunc exit;
00213
00214 CameraGetConfigFunc get_config;
00215 CameraSetConfigFunc set_config;
00217
00218 CameraCaptureFunc capture;
00219 CameraCapturePreviewFunc capture_preview;
00221
00222 CameraSummaryFunc summary;
00223 CameraManualFunc manual;
00224 CameraAboutFunc about;
00226
00227 CameraWaitForEvent wait_for_event;
00229
00230 void *reserved1;
00231 void *reserved2;
00232 void *reserved3;
00233 void *reserved4;
00234 void *reserved5;
00235 void *reserved6;
00236 void *reserved7;
00237 } CameraFunctions;
00238
00239
00240 typedef GPPort CameraPort;
00241 typedef GPPortInfo CameraPortInfo;
00242
00243 typedef struct _CameraPrivateLibrary CameraPrivateLibrary;
00244 typedef struct _CameraPrivateCore CameraPrivateCore;
00245
00246 struct _Camera {
00247
00250 GPPort *port;
00251 CameraFilesystem *fs;
00252 CameraFunctions *functions;
00255 CameraPrivateLibrary *pl;
00256 CameraPrivateCore *pc;
00257 };
00258
00259
00261 int gp_camera_new (Camera **camera);
00262
00263
00267 int gp_camera_set_abilities (Camera *camera, CameraAbilities abilities);
00268 int gp_camera_get_abilities (Camera *camera, CameraAbilities *abilities);
00269 int gp_camera_set_port_info (Camera *camera, GPPortInfo info);
00270 int gp_camera_get_port_info (Camera *camera, GPPortInfo *info);
00271
00283 int gp_camera_set_port_speed (Camera *camera, int speed);
00284 int gp_camera_get_port_speed (Camera *camera);
00285
00292 int gp_camera_init (Camera *camera, GPContext *context);
00293 int gp_camera_exit (Camera *camera, GPContext *context);
00294
00301 int gp_camera_ref (Camera *camera);
00302 int gp_camera_unref (Camera *camera);
00303 int gp_camera_free (Camera *camera);
00304
00305 int gp_camera_get_config (Camera *camera, CameraWidget **window,
00306 GPContext *context);
00307 int gp_camera_set_config (Camera *camera, CameraWidget *window,
00308 GPContext *context);
00309 int gp_camera_get_summary (Camera *camera, CameraText *summary,
00310 GPContext *context);
00311 int gp_camera_get_manual (Camera *camera, CameraText *manual,
00312 GPContext *context);
00313 int gp_camera_get_about (Camera *camera, CameraText *about,
00314 GPContext *context);
00315 int gp_camera_capture (Camera *camera, CameraCaptureType type,
00316 CameraFilePath *path, GPContext *context);
00317 int gp_camera_capture_preview (Camera *camera, CameraFile *file,
00318 GPContext *context);
00319 int gp_camera_wait_for_event (Camera *camera, int timeout,
00320 CameraEventType *eventtype, void **eventdata,
00321 GPContext *context);
00322
00323 int gp_camera_get_storageinfo (Camera *camera, CameraStorageInformation**,
00324 int *, GPContext *context);
00325
00332 int gp_camera_folder_list_files (Camera *camera, const char *folder,
00333 CameraList *list, GPContext *context);
00334 int gp_camera_folder_list_folders (Camera *camera, const char *folder,
00335 CameraList *list, GPContext *context);
00336 int gp_camera_folder_delete_all (Camera *camera, const char *folder,
00337 GPContext *context);
00338 int gp_camera_folder_put_file (Camera *camera, const char *folder,
00339 CameraFile *file, GPContext *context);
00340 int gp_camera_folder_make_dir (Camera *camera, const char *folder,
00341 const char *name, GPContext *context);
00342 int gp_camera_folder_remove_dir (Camera *camera, const char *folder,
00343 const char *name, GPContext *context);
00350 int gp_camera_file_get_info (Camera *camera, const char *folder,
00351 const char *file, CameraFileInfo *info,
00352 GPContext *context);
00353 int gp_camera_file_set_info (Camera *camera, const char *folder,
00354 const char *file, CameraFileInfo info,
00355 GPContext *context);
00356 int gp_camera_file_get (Camera *camera, const char *folder,
00357 const char *file, CameraFileType type,
00358 CameraFile *camera_file, GPContext *context);
00359 int gp_camera_file_delete (Camera *camera, const char *folder,
00360 const char *file, GPContext *context);
00368 typedef int (* CameraTimeoutFunc) (Camera *camera,
00369 GPContext *context);
00370 typedef unsigned int (* CameraTimeoutStartFunc) (Camera *camera,
00371 unsigned int timeout,
00372 CameraTimeoutFunc func,
00373 void *data);
00374 typedef void (* CameraTimeoutStopFunc) (Camera *camera,
00375 unsigned int id, void *data);
00376 void gp_camera_set_timeout_funcs (Camera *camera,
00377 CameraTimeoutStartFunc start_func,
00378 CameraTimeoutStopFunc stop_func,
00379 void *data);
00380 int gp_camera_start_timeout (Camera *camera, unsigned int timeout,
00381 CameraTimeoutFunc func);
00382 void gp_camera_stop_timeout (Camera *camera, unsigned int id);
00383
00386 #endif