Whole document tree
    

Whole document tree

Camera

Camera

Name

Camera -- 

Synopsis



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);
struct      CameraPrivateLibrary;
struct      CameraPrivateCore;
typedef     CameraText;
struct      CameraFunctions;
struct      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);
typedef     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);

Description

Details

CameraExitFunc ()

int         (*CameraExitFunc)               (Camera *camera,
                                             GPContext *context);


CameraGetConfigFunc ()

int         (*CameraGetConfigFunc)          (Camera *camera,
                                             CameraWidget **widget,
                                             GPContext *context);


CameraSetConfigFunc ()

int         (*CameraSetConfigFunc)          (Camera *camera,
                                             CameraWidget *widget,
                                             GPContext *context);


CameraCaptureFunc ()

int         (*CameraCaptureFunc)            (Camera *camera,
                                             CameraCaptureType type,
                                             CameraFilePath *path,
                                             GPContext *context);


CameraCapturePreviewFunc ()

int         (*CameraCapturePreviewFunc)     (Camera *camera,
                                             CameraFile *file,
                                             GPContext *context);


CameraSummaryFunc ()

int         (*CameraSummaryFunc)            (Camera *camera,
                                             CameraText *text,
                                             GPContext *context);


CameraManualFunc ()

int         (*CameraManualFunc)             (Camera *camera,
                                             CameraText *text,
                                             GPContext *context);


CameraAboutFunc ()

int         (*CameraAboutFunc)              (Camera *camera,
                                             CameraText *text,
                                             GPContext *context);


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.


struct CameraPrivateLibrary

struct CameraPrivateLibrary;


struct CameraPrivateCore

struct CameraPrivateCore;


CameraText

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 */
};


gp_camera_new ()

int         gp_camera_new                   (Camera **camera);

Allocates the memory for a Camera.


gp_camera_ref ()

int         gp_camera_ref                   (Camera *camera);

Increments the reference count of a camera.


gp_camera_unref ()

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.


gp_camera_free ()

int         gp_camera_free                  (Camera *camera);

Frees the camera. This function should never be used. Please use gp_camera_unref instead.


gp_camera_set_abilities ()

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.


gp_camera_get_abilities ()

int         gp_camera_get_abilities         (Camera *camera,
                                             CameraAbilities *abilities);

Retrieves the abilities of the camera.


gp_camera_set_port_info ()

int         gp_camera_set_port_info         (Camera *camera,
                                             GPPortInfo info);


gp_camera_get_port_info ()

int         gp_camera_get_port_info         (Camera *camera,
                                             GPPortInfo *info);


gp_camera_get_port_speed ()

int         gp_camera_get_port_speed        (Camera *camera);

Retrieves the current speed.


gp_camera_set_port_speed ()

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.


gp_camera_init ()

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.


gp_camera_exit ()

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.


CameraFilePath

typedef struct {
	char name [128];
	char folder [1024];
} CameraFilePath;


enum CameraCaptureType

typedef enum {
	GP_CAPTURE_IMAGE,
	GP_CAPTURE_MOVIE,
	GP_CAPTURE_SOUND
} CameraCaptureType;


gp_camera_capture ()

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.


gp_camera_capture_preview ()

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.


gp_camera_get_config ()

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.


gp_camera_set_config ()

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.


gp_camera_folder_list_files ()

int         gp_camera_folder_list_files     (Camera *camera,
                                             const char *folder,
                                             CameraList *list,
                                             GPContext *context);

Lists the files in supplied folder.


gp_camera_folder_list_folders ()

int         gp_camera_folder_list_folders   (Camera *camera,
                                             const char *folder,
                                             CameraList *list,
                                             GPContext *context);

Lists the folders in supplied folder.


gp_camera_folder_put_file ()

int         gp_camera_folder_put_file       (Camera *camera,
                                             const char *folder,
                                             CameraFile *file,
                                             GPContext *context);

Uploads a file into given folder.


gp_camera_folder_delete_all ()

int         gp_camera_folder_delete_all     (Camera *camera,
                                             const char *folder,
                                             GPContext *context);

Deletes all files in a given folder.


gp_camera_folder_make_dir ()

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.


gp_camera_folder_remove_dir ()

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.



gp_camera_file_delete ()

int         gp_camera_file_delete           (Camera *camera,
                                             const char *folder,
                                             const char *file,
                                             GPContext *context);

Deletes the file from a folder.


gp_camera_file_get_info ()

int         gp_camera_file_get_info         (Camera *camera,
                                             const char *folder,
                                             const char *file,
                                             CameraFileInfo *info,
                                             GPContext *context);

Retrieves information about a file.


gp_camera_file_set_info ()

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.


gp_camera_get_manual ()

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.


gp_camera_get_summary ()

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.


gp_camera_get_about ()

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.