int (*CameraCapturePreviewFunc) (Camera *camera,
CameraFile *file,
GPContext *context);
camera :
file :
context :
Returns :
CameraSummaryFunc ()
int (*CameraSummaryFunc) (Camera *camera,
CameraText *text,
GPContext *context);
camera :
text :
context :
Returns :
CameraManualFunc ()
int (*CameraManualFunc) (Camera *camera,
CameraText *text,
GPContext *context);
camera :
text :
context :
Returns :
CameraAboutFunc ()
int (*CameraAboutFunc) (Camera *camera,
CameraText *text,
GPContext *context);
camera :
text :
context :
Returns :
CameraPrePostFunc ()
int (*CameraPrePostFunc) (Camera *camera,
GPContext *context);
Implement this function in the camera driver if the camera needs to
be initialized before or reset the after each access from libgphoto2.
For example, you would probably set the speed to the highest one
right before downloading an image, and reset it to the default speed
afterwards so that other programs will not be affected by this speed
change.
typedef struct {
char text [32 * 1024];
} CameraText;
struct CameraFunctions
struct CameraFunctions {
/* Those will be called before and after each operation */
CameraPrePostFunc pre_func;
CameraPrePostFunc post_func;
CameraExitFunc exit;
/* Configuration */
CameraGetConfigFunc get_config;
CameraSetConfigFunc set_config;
/* Capturing */
CameraCaptureFunc capture;
CameraCapturePreviewFunc capture_preview;
/* Textual information */
CameraSummaryFunc summary;
CameraManualFunc manual;
CameraAboutFunc about;
/* Reserved space to use in the future without changing the struct size */
void *reserved1;
void *reserved2;
void *reserved3;
void *reserved4;
void *reserved5;
void *reserved6;
void *reserved7;
void *reserved8;
};
struct Camera
struct Camera {
/* Those should be accessed only by the camera driver */
GPPort *port;
CameraFilesystem *fs;
CameraFunctions *functions;
CameraPrivateLibrary *pl; /* Private data of camera libraries */
CameraPrivateCore *pc; /* Private data of the core of gphoto2 */
};
Sets the camera abilities. 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.
int gp_camera_set_port_speed (Camera *camera,
int speed);
Sets the speed. 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_init (Camera *camera,
GPContext *context);
Initiates a connection to the camera. 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.
int gp_camera_exit (Camera *camera,
GPContext *context);
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.
Captures an image, movie, or sound clip depending on the given type.
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.
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. For example, you could use gp_capture_preview for
taking some sample pictures before calling gp_capture.
int gp_camera_set_config (Camera *camera,
CameraWidget *window,
GPContext *context);
Sets the configuration. Typically, a window is retrieved using
gp_camera_get_config and passed to this function in order to adjust
the settings on the camera.
int gp_camera_get_summary (Camera *camera,
CameraText *summary,
GPContext *context);
Retrieves a camera summary. This summary typically contains information
like manufacturer, pictures taken, or generally information that is
not configurable.