Details
CameraLibraryIdFunc ()
Returns a unique id for the camera driver.
CameraLibraryAbilitiesFunc ()
Adds the abilities of the supported models to the supplied list.
CameraLibraryInitFunc ()
int (*CameraLibraryInitFunc) (Camera *camera,
GPContext *context); |
Initializes the camera. The camera driver will establish a first connection
to the camera and configure the camera variable (i.e. using
gp_filesystem_set_list_funcs or gp_port_get_settings).
camera_id ()
This function should write a unique id into id and return GP_OK. That is,
choose a unique id, use strncpy in order to copy it into the id, and
return GP_OK.
camera_init ()
int camera_init (Camera *camera,
GPContext *context); |
This is the most interesting function in your library. Here, you tell
gphoto2 what operations your camera supports and you try to connect
to the camera. That is, access camera->functions directly and set them
to your implementation (if you have any). Then, tell the CameraFilesystem
(available in camera->fs) how to retrieve lists
(gp_filesystem_set_list_funcs), how to retrieve or set file information
(gp_filesystem_set_info_funcs), how to get or delete files
(gp_filesystem_set_file_funcs), or how to put files or delete all files
in a folder (gp_filesystem_set_folder_funcs). After that, configure
the port (camera->port) which is already opened by gphoto2. You just have
to call gp_port_settings_get, adjust the settings, call
gp_port_settings_set, and try to write to and read from the port.
If the camera responds, return GP_OK. If not, return some
meaningful error code.