libgphoto2 photo camera library (libgphoto2) API 2.5.31

gphoto2-library.h File Reference

Camery driver header. More...

`#include <gphoto2/gphoto2-abilities-list.h>`
`#include <gphoto2/gphoto2-camera.h>`
Include dependency graph for gphoto2-library.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Typedefs
typedef int(* | CameraLibraryIdFunc) (CameraText *id)
| Returns a unique id for the camera driver.
typedef int(* | CameraLibraryAbilitiesFunc) (CameraAbilitiesList *list)
| Adds the abilities of the supported models to the supplied list.
typedef int(* | CameraLibraryInitFunc) (Camera *camera, GPContext *context)
| Initializes the camera.

## Functions
int | camera_id (CameraText *id)
| Get a unique camera id.
int | camera_abilities (CameraAbilitiesList *list)
| Get a list of abilities of all supported cameras.
int | camera_init (Camera *camera, GPContext *context)

## Detailed Description

Camery driver header.

Author
  Copyright 2000 Scott Fritzinger

Note
  This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
  You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

## Typedef Documentation

## ◆ CameraLibraryAbilitiesFunc

typedef int(* CameraLibraryAbilitiesFunc) (CameraAbilitiesList *list)

Adds the abilities of the supported models to the supplied list.

Parameters

  list | a CameraAbilitiesList

Returns
  a gphoto2 error code

## ◆ CameraLibraryIdFunc

typedef int(* CameraLibraryIdFunc) (CameraText *id)

Returns a unique id for the camera driver.

Parameters

  id | a CameraText

Returns
  a gphoto2 error code

## ◆ CameraLibraryInitFunc

typedef int(* CameraLibraryInitFunc) (Camera *camera, GPContext *context)

Initializes the camera.

Parameters

  camera | a Camera
  context | a GPContext

Returns
  a gphoto2 error code

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).

## Function Documentation

## ◆ camera_abilities()

int camera_abilities | ( | CameraAbilitiesList * | list | ) |

Get a list of abilities of all supported cameras.

Parameters

  list | a CameraAbilitiesList

This function should use gp_abilities_list_append as many times as the number of models the camera driver supports. That is, fill out (in a loop) the CameraAbilities for each model and append each of those to the supplied list using gp_abilities_list_append(). Then, return GP_OK.

Returns
  a gphoto2 error code

Fill list with abilities of the cameras supported by this camlib.

For each camera, fill a CameraAbilities structure with data about that camera and append it to the list.

The job of this function is basically to extract data from a camlib specific database and insert it into the libgphoto2 camera database. Due to redundant data and other issues, we may decide to revise that database mechanism and replace it by something more flexible and efficient.

This is a camlib API function.

References CameraAbilities::file_operations, CameraAbilities::folder_operations, gp_abilities_list_append(), GP_CAPTURE_IMAGE, GP_DRIVER_STATUS_PRODUCTION, GP_FILE_OPERATION_DELETE, GP_FILE_OPERATION_PREVIEW, GP_FOLDER_OPERATION_NONE, GP_OK, GP_OPERATION_CAPTURE_PREVIEW, GP_PORT_SERIAL, GP_PORT_USB, CameraAbilities::model, CameraAbilities::operations, CameraAbilities::port, CameraAbilities::speed, and CameraAbilities::status.

## ◆ camera_id()

int camera_id | ( | CameraText * | id | ) |

Get a unique camera id.

Parameters

  id | a CameraText that receives the id string

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. The driver name should suffice.

Returns
  a gphoto2 error code

Set library ID string.

Probably redundant and to be removed shortly, being replaced by the libtool module name defined in the build system.

This is a camlib API function.

References GP_OK, and CameraText::text.

## ◆ camera_init()

int camera_init | ( | Camera * | camera,
|  | GPContext * | context )

Initialize a Camera object.

Sets up all the proper object function pointers, initialize camlib internal data structures, and probably establish a connection to the camera.

This is a camlib API function.

References _CameraFunctions::about, camera_about(), camera_capture(), camera_capture_preview(), camera_config_get(), camera_config_set(), camera_exit(), camera_manual(), camera_summary(), _CameraFunctions::capture, _CameraFunctions::capture_preview, _CameraFunctions::exit, fsfuncs, _CameraFunctions::get_config, gp_filesystem_set_funcs(), GP_OK, _CameraFunctions::manual, _CameraFunctions::set_config, and _CameraFunctions::summary.