#include "config.h"
#include "gphoto2-camera.h"
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <ltdl.h>
#include "gphoto2-context.h"
#include "gphoto2-result.h"
#include "gphoto2-library.h"
#include "gphoto2-port-log.h"
Include dependency graph for gphoto2-camera.c:
Data Structures | |||||||||||||
struct | _CameraPrivateCore | ||||||||||||
in given @folder. | |||||||||||||
gp_camera_folder_make_dir:
| |||||||||||||
int | gp_camera_folder_make_dir (Camera *camera, const char *folder, const char *name, GPContext *context) | ||||||||||||
from the given @folder. | |||||||||||||
gp_camera_folder_remove_dir:
| |||||||||||||
int | gp_camera_folder_remove_dir (Camera *camera, const char *folder, const char *name, GPContext *context) | ||||||||||||
void | gp_camera_set_timeout_funcs (Camera *camera, CameraTimeoutStartFunc start_func, CameraTimeoutStopFunc stop_func, void *data) | ||||||||||||
int | gp_camera_start_timeout (Camera *camera, unsigned int timeout, CameraTimeoutFunc func) | ||||||||||||
void | gp_camera_stop_timeout (Camera *camera, unsigned int id) | ||||||||||||
Stop periodic calls to keepalive function. | |||||||||||||
Defines | |||||||||||||
#define | textdomain(String) (String) | ||||||||||||
#define | gettext(String) (String) | ||||||||||||
#define | dgettext(Domain, Message) (Message) | ||||||||||||
#define | dcgettext(Domain, Message, Type) (Message) | ||||||||||||
#define | bindtextdomain(Domain, Directory) (Domain) | ||||||||||||
#define | _(String) (String) | ||||||||||||
#define | N_(String) (String) | ||||||||||||
#define | CHECK_NULL(r) {if (!(r)) return (GP_ERROR_BAD_PARAMETERS);} | ||||||||||||
#define | CAMERA_UNUSED(c, ctx) | ||||||||||||
#define | CR(c, result, ctx) | ||||||||||||
#define | CHECK_OPEN(c, ctx) | ||||||||||||
#define | CHECK_CLOSE(c, ctx) | ||||||||||||
#define | CRS(c, res, ctx) | ||||||||||||
#define | CRSL(c, res, ctx, list) | ||||||||||||
#define | CHECK_RESULT_OPEN_CLOSE(c, result, ctx) | ||||||||||||
#define | CHECK_INIT(c, ctx) | ||||||||||||
Functions | |||||||||||||
int | gp_camera_exit (Camera *camera, GPContext *context) | ||||||||||||
Close connection to camera. | |||||||||||||
int | gp_camera_new (Camera **camera) | ||||||||||||
Allocates the memory for a Camera. | |||||||||||||
int | gp_camera_set_abilities (Camera *camera, CameraAbilities abilities) | ||||||||||||
Sets the camera abilities. | |||||||||||||
int | gp_camera_get_abilities (Camera *camera, CameraAbilities *abilities) | ||||||||||||
Retrieve the abilities of the camera . | |||||||||||||
int | gp_camera_get_port_info (Camera *camera, GPPortInfo *info) | ||||||||||||
int | gp_camera_set_port_info (Camera *camera, GPPortInfo info) | ||||||||||||
int | gp_camera_set_port_speed (Camera *camera, int speed) | ||||||||||||
Set the camera speed. | |||||||||||||
int | gp_camera_get_port_speed (Camera *camera) | ||||||||||||
Retrieve the current speed. | |||||||||||||
int | gp_camera_ref (Camera *camera) | ||||||||||||
Increment the reference count of a . | |||||||||||||
int | gp_camera_unref (Camera *camera) | ||||||||||||
Decrements the reference count of a Camera. | |||||||||||||
int | gp_camera_free (Camera *camera) | ||||||||||||
Free the camera . | |||||||||||||
int | gp_camera_init (Camera *camera, GPContext *context) | ||||||||||||
Initiate a connection to the camera . | |||||||||||||
int | gp_camera_get_config (Camera *camera, CameraWidget **window, GPContext *context) | ||||||||||||
Retrieve a configuration window for the camera . | |||||||||||||
int | gp_camera_set_config (Camera *camera, CameraWidget *window, GPContext *context) | ||||||||||||
int | gp_camera_get_summary (Camera *camera, CameraText *summary, GPContext *context) | ||||||||||||
int | gp_camera_get_manual (Camera *camera, CameraText *manual, GPContext *context) | ||||||||||||
int | gp_camera_get_about (Camera *camera, CameraText *about, GPContext *context) | ||||||||||||
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_wait_for_event (Camera *camera, int timeout, CameraEventType *eventtype, void **eventdata, GPContext *context) | ||||||||||||
Wait for an event from the camera . | |||||||||||||
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_delete_all (Camera *camera, const char *folder, GPContext *context) | ||||||||||||
int | gp_camera_folder_put_file (Camera *camera, const char *folder, CameraFile *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_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) |
2001-2002: Lutz Müller <lutz@users.sf.net>
#define CAMERA_UNUSED | ( | c, | |||
ctx | ) |
Value:
{ \ (c)->pc->used--; \ if (!(c)->pc->used) { \ if ((c)->pc->exit_requested) \ gp_camera_exit ((c), (ctx)); \ if (!(c)->pc->ref_count) \ gp_camera_free (c); \ } \ }
#define CHECK_CLOSE | ( | c, | |||
ctx | ) |
Value:
{ \ int r; \ \ if ((c)->functions->post_func) { \ r = (c)->functions->post_func (c,ctx); \ if (r < 0) { \ CAMERA_UNUSED (c,ctx); \ return (r); \ } \ } \ }
#define CHECK_INIT | ( | c, | |||
ctx | ) |
Value:
{ \ if ((c)->pc->used) \ return (GP_ERROR_CAMERA_BUSY); \ (c)->pc->used++; \ if (!(c)->pc->lh) \ CR((c), gp_camera_init (c, ctx), ctx); \ }
#define CHECK_OPEN | ( | c, | |||
ctx | ) |
Value:
{ \ int r; \ \ if ((c)->functions->pre_func) { \ r = (c)->functions->pre_func (c,ctx); \ if (r < 0) { \ CAMERA_UNUSED (c,ctx); \ return (r); \ } \ } \ }
#define CHECK_RESULT_OPEN_CLOSE | ( | c, | |||
result, | |||||
ctx | ) |
Value:
{ \ int r; \ \ CHECK_OPEN (c,ctx); \ r = (result); \ if (r < 0) { \ CHECK_CLOSE (c,ctx); \ gp_log (GP_LOG_DEBUG, "gphoto2-camera", "Operation failed!");\ CAMERA_UNUSED (c,ctx); \ return (r); \ } \ CHECK_CLOSE (c,ctx); \ }
#define CR | ( | c, | |||
result, | |||||
ctx | ) |
Value:
{ \ int r = (result); \ \ if (r < 0) { \ \ /* libgphoto2_port doesn't have a GPContext */ \ if (r > -100) \ gp_context_error ((ctx), _("An error occurred " \ "in the io-library ('%s'): %s"), \ gp_port_result_as_string (r), \ (c) ? gp_port_get_error ((c)->port) : \ _("No additional information " \ "available.")); \ if (c) \ CAMERA_UNUSED((c),(ctx)); \ return (r); \ } \ }
#define CRS | ( | c, | |||
res, | |||||
ctx | ) |
Value:
{ \ int r = (res); \ \ if (r < 0) { \ CAMERA_UNUSED (c,ctx); \ return (r); \ } \ }
#define CRSL | ( | c, | |||
res, | |||||
ctx, | |||||
list | ) |
Value:
{ \ int r = (res); \ \ if (r < 0) { \ CAMERA_UNUSED (c,ctx); \ gp_list_free (list); \ return (r); \ } \ }
int gp_camera_capture | ( | Camera * | camera, | |
CameraCaptureType | type, | |||
CameraFilePath * | path, | |||
GPContext * | context | |||
) |
gp_camera_capture: : a Camera : a CameraCaptureType : a CameraFilePath : a GPContext
Captures an image, movie, or sound clip depending on the given . The resulting file will be stored on the camera. The location gets stored in . The file can then be downloaded using gp_camera_file_get.
int gp_camera_exit | ( | Camera * | camera, | |
GPContext * | context | |||
) |
Close connection to camera.
camera | a Camera object | |
context | a GPContext object |
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.
int gp_camera_file_set_info | ( | Camera * | camera, | |
const char * | folder, | |||
const char * | file, | |||
CameraFileInfo | info, | |||
GPContext * | context | |||
) |
gp_camera_file_set_info:
camera,: | a Camera | |
folder,: | a folder | |
file,: | the name of a file | |
info,: | the CameraFileInfo | |
context,: | a GPContext |
int gp_camera_folder_delete_all | ( | Camera * | camera, | |
const char * | folder, | |||
GPContext * | context | |||
) |
gp_camera_folder_delete_all:
camera,: | a Camera | |
folder,: | a folder | |
context,: | a GPContext |
int gp_camera_folder_list_files | ( | Camera * | camera, | |
const char * | folder, | |||
CameraList * | list, | |||
GPContext * | context | |||
) |
gp_camera_folder_list_files:
camera,: | a Camera | |
folder,: | a folder | |
list,: | a CameraList | |
context,: | a GPContext |
int gp_camera_folder_list_folders | ( | Camera * | camera, | |
const char * | folder, | |||
CameraList * | list, | |||
GPContext * | context | |||
) |
gp_camera_folder_list_folders:
camera,: | a Camera | |
folder,: | a folder | |
list,: | a CameraList | |
context,: | a GPContext |
int gp_camera_folder_put_file | ( | Camera * | camera, | |
const char * | folder, | |||
CameraFile * | file, | |||
GPContext * | context | |||
) |
gp_camera_folder_put_file:
camera,: | a Camera | |
folder,: | a folder | |
file,: | a CameraFile | |
context,: | a GPContext |
int gp_camera_free | ( | Camera * | camera | ) |
Free the camera
.
camera | a Camera |
int gp_camera_get_abilities | ( | Camera * | camera, | |
CameraAbilities * | abilities | |||
) |
Retrieve the abilities
of the camera
.
camera | a Camera | |
abilities |
int gp_camera_get_about | ( | Camera * | camera, | |
CameraText * | about, | |||
GPContext * | context | |||
) |
gp_camera_get_about: : a Camera : a CameraText : a GPContext
Retrieves information about the camera driver. Typically, this information contains name and address of the author, acknowledgements, etc.
int gp_camera_get_config | ( | Camera * | camera, | |
CameraWidget ** | window, | |||
GPContext * | context | |||
) |
Retrieve a configuration window
for the camera
.
camera | a Camera | |
window | a CameraWidget | |
context | a GPContext |
window
can be used for construction of a configuration dialog.
int gp_camera_get_manual | ( | Camera * | camera, | |
CameraText * | manual, | |||
GPContext * | context | |||
) |
gp_camera_get_manual: : a Camera : a CameraText : a GPContext
Retrieves the for given . This manual typically contains information about using the camera.
int gp_camera_get_port_speed | ( | Camera * | camera | ) |
Retrieve the current speed.
camera | a Camera |
int gp_camera_get_summary | ( | Camera * | camera, | |
CameraText * | summary, | |||
GPContext * | context | |||
) |
gp_camera_get_summary: : a Camera : a CameraText : a GPContext
Retrieves a camera . This summary typically contains information like manufacturer, pictures taken, or generally information that is not configurable.
int gp_camera_init | ( | Camera * | camera, | |
GPContext * | context | |||
) |
Initiate a connection to the camera
.
camera | a camera | |
context | a GPContext |
int gp_camera_new | ( | Camera ** | camera | ) |
Allocates the memory for a Camera.
camera | The Camera:: object to initialize. |
int gp_camera_ref | ( | Camera * | camera | ) |
Increment the reference count of a .
camera | a Camera |
int gp_camera_set_abilities | ( | Camera * | camera, | |
CameraAbilities | abilities | |||
) |
Sets the camera abilities.
camera,: | a Camera | |
abilities | the CameraAbilities to be set |
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_config | ( | Camera * | camera, | |
CameraWidget * | window, | |||
GPContext * | context | |||
) |
gp_camera_set_config: : a Camera : a CameraWidget : a GPContext
Sets the configuration. Typically, a is retrieved using gp_camera_get_config and passed to this function in order to adjust the settings on the camera.
int gp_camera_set_port_speed | ( | Camera * | camera, | |
int | speed | |||
) |
Set the camera speed.
camera | a Camera | |
speed | the speed |
void gp_camera_set_timeout_funcs | ( | Camera * | camera, | |
CameraTimeoutStartFunc | start_func, | |||
CameraTimeoutStopFunc | stop_func, | |||
void * | data | |||
) |
gp_camera_set_timeout_funcs:
camera | a Camera | |
start_func | ||
stop_func | ||
data | If your frontend has something like idle loops, it is recommended you use gp_camera_set_timeout_funcs in order to give the camera driver the possibility to keep up the connection to the camera. |
int gp_camera_start_timeout | ( | Camera * | camera, | |
unsigned int | timeout, | |||
CameraTimeoutFunc | func | |||
) |
gp_camera_start_timeout:
camera | a Camera | |
timeout | number of seconds that should pass between each call to func | |
func | the function that should be called each timeout seconds |
void gp_camera_stop_timeout | ( | Camera * | camera, | |
unsigned int | id | |||
) |
Stop periodic calls to keepalive function.
camera | a Camera | |
id | the id of the background process previously returned by gp_camera_start_timeout() |
int gp_camera_unref | ( | Camera * | camera | ) |
Decrements the reference count of a Camera.
camera | a Camera |
camera
will be freed automatically.
int gp_camera_wait_for_event | ( | Camera * | camera, | |
int | timeout, | |||
CameraEventType * | eventtype, | |||
void ** | eventdata, | |||
GPContext * | context | |||
) |
Wait for an event from the camera
.
camera | a Camera | |
timeout | amount of time to wait in 1/1000 seconds | |
eventtype | received CameraEventType [out] | |
eventdata | received event specific data [out] | |
context | a GPContext |