![]() | ![]() | ![]() | GPhoto2 API Reference Manual | ![]() |
---|
int (*CameraExitFunc) (Camera *camera, GPContext *context); int (*CameraGetConfigFunc) (Camera *camera, CameraWidget **widget, GPContext *context); int (*CameraSetConfigFunc) (Camera *camera, CameraWidget *widget, GPContext *context); int (*CameraCaptureFunc) (Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context); int (*CameraCapturePreviewFunc) (Camera *camera, CameraFile *file, GPContext *context); int (*CameraSummaryFunc) (Camera *camera, CameraText *text, GPContext *context); int (*CameraManualFunc) (Camera *camera, CameraText *text, GPContext *context); int (*CameraAboutFunc) (Camera *camera, CameraText *text, GPContext *context); int (*CameraPrePostFunc) (Camera *camera, GPContext *context); CameraPrivateLibrary; CameraPrivateCore; CameraText; CameraFunctions; Camera; int gp_camera_new (Camera **camera); int gp_camera_ref (Camera *camera); int gp_camera_unref (Camera *camera); int gp_camera_free (Camera *camera); int gp_camera_set_abilities (Camera *camera, CameraAbilities abilities); int gp_camera_get_abilities (Camera *camera, CameraAbilities *abilities); int gp_camera_set_port_info (Camera *camera, GPPortInfo info); int gp_camera_get_port_info (Camera *camera, GPPortInfo *info); int gp_camera_get_port_speed (Camera *camera); int gp_camera_set_port_speed (Camera *camera, int speed); int gp_camera_init (Camera *camera, GPContext *context); int gp_camera_exit (Camera *camera, GPContext *context); CameraFilePath; enum CameraCaptureType; int gp_camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context); int gp_camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context); int gp_camera_get_config (Camera *camera, CameraWidget **window, GPContext *context); int gp_camera_set_config (Camera *camera, CameraWidget *window, 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_put_file (Camera *camera, const char *folder, CameraFile *file, GPContext *context); int gp_camera_folder_delete_all (Camera *camera, const char *folder, 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_file_get (Camera *camera, const char *folder, const char *file, CameraFileType type, CameraFile *camera_file, GPContext *context); int gp_camera_file_delete (Camera *camera, const char *folder, const char *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_get_manual (Camera *camera, CameraText *manual, GPContext *context); int gp_camera_get_summary (Camera *camera, CameraText *summary, GPContext *context); int gp_camera_get_about (Camera *camera, CameraText *about, GPContext *context);
int (*CameraExitFunc) (Camera *camera, GPContext *context);
camera : | |
context : | |
Returns : |
|
int (*CameraGetConfigFunc) (Camera *camera, CameraWidget **widget, GPContext *context);
camera : | |
widget : | |
context : | |
Returns : |
|
int (*CameraSetConfigFunc) (Camera *camera, CameraWidget *widget, GPContext *context);
camera : | |
widget : | |
context : | |
Returns : |
|
int (*CameraCaptureFunc) (Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context);
camera : | |
type : | |
path : | |
context : | |
Returns : |
|
int (*CameraCapturePreviewFunc) (Camera *camera, CameraFile *file, GPContext *context);
camera : | |
file : | |
context : | |
Returns : |
|
int (*CameraSummaryFunc) (Camera *camera, CameraText *text, GPContext *context);
camera : | |
text : | |
context : | |
Returns : |
|
int (*CameraManualFunc) (Camera *camera, CameraText *text, GPContext *context);
camera : | |
text : | |
context : | |
Returns : |
|
int (*CameraAboutFunc) (Camera *camera, CameraText *text, GPContext *context);
camera : | |
text : | |
context : | |
Returns : |
|
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.
camera : | a Camera |
context : | |
Returns : | a gphoto2 error code |
typedef struct { /* 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; } CameraFunctions;
typedef struct { /* 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 */ } Camera;
int gp_camera_new (Camera **camera);
Allocates the memory for a Camera.
camera : | |
Returns : | a gphoto2 error code |
int gp_camera_ref (Camera *camera);
Increments the reference count of a camera
.
camera : | a Camera |
Returns : | a gphoto2 error code |
int gp_camera_unref (Camera *camera);
Decrements the reference count of a camera
. If the reference count
reaches 0, the camera
will be freed automatically.
camera : | a Camera |
Returns : | a gphoto2 error code |
int gp_camera_free (Camera *camera);
Frees the camera. This function should never be used. Please use gp_camera_unref instead.
camera : | a Camera |
Returns : | a gphoto2 error code |
int gp_camera_set_abilities (Camera *camera, CameraAbilities abilities);
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.
camera : | a Camera |
abilities : | the CameraAbilities to be set |
Returns : | a gphoto2 error code |
int gp_camera_get_abilities (Camera *camera, CameraAbilities *abilities);
Retrieves the abilities
of the camera
.
camera : | a Camera |
abilities : | |
Returns : | a gphoto2 error code |
int gp_camera_set_port_info (Camera *camera, GPPortInfo info);
camera : | |
info : | |
Returns : |
|
int gp_camera_get_port_info (Camera *camera, GPPortInfo *info);
camera : | |
info : | |
Returns : |
|
int gp_camera_get_port_speed (Camera *camera);
Retrieves the current speed.
camera : | a Camera |
Returns : | The current speed or a gphoto2 error code |
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.
camera : | a Camera |
speed : | the speed |
Returns : | a gphoto2 error code |
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.
camera : | a camera |
context : | a GPContext |
Returns : | a gphoto2 error code |
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.
camera : | a Camera |
context : | a GPContext |
Returns : | a gphoto2 error code. |
typedef enum { GP_CAPTURE_IMAGE, GP_CAPTURE_MOVIE, GP_CAPTURE_SOUND } CameraCaptureType;
int gp_camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context);
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.
camera : | a Camera |
type : | |
path : | |
context : | a GPContext |
Returns : | a gphoto2 error code |
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.
camera : | a Camera |
file : | |
context : | a GPContext |
Returns : | a gphoto2 error code |
int gp_camera_get_config (Camera *camera, CameraWidget **window, GPContext *context);
Retrieves a configuration window
for the camera
. This window can be
used for construction of a configuration dialog.
camera : | a Camera |
window : | |
context : | a GPContext |
Returns : | a gphoto2 error code |
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.
camera : | a Camera |
window : | |
context : | a GPContext |
Returns : | a gphoto2 error code |
int gp_camera_folder_list_files (Camera *camera, const char *folder, CameraList *list, GPContext *context);
Lists the files in supplied folder
.
camera : | a Camera |
folder : | a folder |
list : | |
context : | a GPContext |
Returns : | a gphoto2 error code |
int gp_camera_folder_list_folders (Camera *camera, const char *folder, CameraList *list, GPContext *context);
Lists the folders in supplied folder
.
camera : | a Camera |
folder : | a folder |
list : | |
context : | a GPContext |
Returns : | a gphoto2 error code |
int gp_camera_folder_put_file (Camera *camera, const char *folder, CameraFile *file, GPContext *context);
Uploads a file into given folder
.
camera : | a Camera |
folder : | a folder |
file : | |
context : | a GPContext |
Returns : | a gphoto2 error code |
int gp_camera_folder_delete_all (Camera *camera, const char *folder, GPContext *context);
Deletes all files in a given folder
.
camera : | a Camera |
folder : | a folder |
context : | a GPContext |
Returns : | a gphoto2 error code |
int gp_camera_folder_make_dir (Camera *camera, const char *folder, const char *name, GPContext *context);
Creates a new directory called name
in given folder
.
camera : | a Camera |
folder : | the location where to create the new directory |
name : | the name of the directory to be created |
context : | a GPContext |
Returns : | a gphoto2 error code |
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
.
camera : | a Camera |
folder : | the folder from which to remove the directory |
name : | the name of the directory to be removed |
context : | a GPContext |
Returns : | a gphoto2 error code |
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
.
camera : | a Camera |
folder : | a folder |
file : | the name of a file |
type : | the CameraFileType |
camera_file : | |
context : | a GPContext |
Returns : | a gphoto2 error code |
int gp_camera_file_delete (Camera *camera, const char *folder, const char *file, GPContext *context);
Deletes the file
from a folder
.
camera : | a Camera |
folder : | a folder |
file : | the name of a file |
context : | a GPContext |
Returns : | a gphoto2 error code |
int gp_camera_file_get_info (Camera *camera, const char *folder, const char *file, CameraFileInfo *info, GPContext *context);
Retrieves information about a file
.
camera : | a Camera |
folder : | a folder |
file : | the name of the file |
info : | |
context : | a GPContext |
Returns : | a gphoto2 error code |
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.
camera : | a Camera |
folder : | a folder |
file : | the name of a file |
info : | the CameraFileInfo |
context : | a GPContext |
Returns : | a gphoto2 error code |
int gp_camera_get_manual (Camera *camera, CameraText *manual, GPContext *context);
Retrieves the manual
for given camera
. This manual typically contains
information about using the camera.
camera : | a Camera |
manual : | |
context : | a GPContext |
Returns : | a gphoto2 error code |
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.
camera : | a Camera |
summary : | |
context : | a GPContext |
Returns : | a gphoto2 error code |
int gp_camera_get_about (Camera *camera, CameraText *about, GPContext *context);
Retrieves information about the camera driver. Typically, this information contains name and address of the author, acknowledgements, etc.
camera : | a Camera |
about : | |
context : | a GPContext |
Returns : | a gphoto2 error code |
<<< GPhoto2 Objects | CameraFilesystem >>> |