libgphoto2 photo camera library (libgphoto2) API 2.5.30
gphoto2-abilities-list.c File Reference

List of supported camera models including their abilities. More...

#include "config.h"
#include <gphoto2/gphoto2-abilities-list.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ltdl.h>
#include <gphoto2/gphoto2-result.h>
#include <gphoto2/gphoto2-port-log.h>
#include <gphoto2/gphoto2-library.h>
#include "libgphoto2/i18n.h"
Include dependency graph for gphoto2-abilities-list.c:

Data Structures

struct  _CameraAbilitiesList
 
struct  foreach_data_t
 

Macros

#define _DARWIN_C_SOURCE
 
#define CHECK_RESULT(result)   {int r = (result); if (r < 0) return (r);}
 

Functions

const char * gp_message_codeset (const char *codeset)
 Set the current character codeset libgphoto2 is operating in. More...
 
int gp_init_localedir (const char *localedir)
 Initialize the localedir directory for the libgphoto2 gettext domain. More...
 
int gp_abilities_list_new (CameraAbilitiesList **list)
 Allocate the memory for a new abilities list. More...
 
int gp_abilities_list_free (CameraAbilitiesList *list)
 Free the given CameraAbilitiesList object. More...
 
int gp_abilities_list_load_dir (CameraAbilitiesList *list, const char *dir, GPContext *context)
 
int gp_abilities_list_load (CameraAbilitiesList *list, GPContext *context)
 Scans the system for camera drivers. More...
 
int gp_abilities_list_detect (CameraAbilitiesList *list, GPPortInfoList *info_list, CameraList *l, GPContext *context)
 
int gp_abilities_list_append (CameraAbilitiesList *list, CameraAbilities abilities)
 Append the abilities to the list. More...
 
int gp_abilities_list_reset (CameraAbilitiesList *list)
 Reset the list. More...
 
int gp_abilities_list_count (CameraAbilitiesList *list)
 Count the entries in the supplied list. More...
 
int gp_abilities_list_lookup_model (CameraAbilitiesList *list, const char *model)
 Search the list for an entry of given model name. More...
 
int gp_abilities_list_get_abilities (CameraAbilitiesList *list, int index, CameraAbilities *abilities)
 Retrieve the camera abilities of entry with supplied index number. More...
 

Detailed Description

List of supported camera models including their abilities.

Author
Copyright 2000 Scott Fritzinger
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

Function Documentation

◆ gp_abilities_list_append()

int gp_abilities_list_append ( CameraAbilitiesList list,
CameraAbilities  abilities 
)

Append the abilities to the list.

Parameters
listCameraAbilitiesList
abilitiesCameraAbilities
Returns
a gphoto2 error code

This function is called by a camera library on camera_abilities() in order to inform libgphoto2 about a supported camera model.

Referenced by camera_abilities().

◆ gp_abilities_list_count()

int gp_abilities_list_count ( CameraAbilitiesList list)

Count the entries in the supplied list.

Parameters
lista CameraAbilitiesList
Returns
The number of entries or a gphoto2 error code

◆ gp_abilities_list_detect()

int gp_abilities_list_detect ( CameraAbilitiesList list,
GPPortInfoList info_list,
CameraList l,
GPContext context 
)
Parameters
lista CameraAbilitiesList
info_listthe GPPortInfoList of ports to use for detection
la CameraList that contains the autodetected cameras after the call
contexta GPContext

Tries to detect any camera connected to the computer using the supplied list of supported cameras and the supplied info_list of ports.

Returns
a gphoto2 error code

References gp_list_reset().

Referenced by gp_camera_autodetect().

◆ gp_abilities_list_free()

int gp_abilities_list_free ( CameraAbilitiesList list)

Free the given CameraAbilitiesList object.

Parameters
lista CameraAbilitiesList
Returns
a gphoto2 error code

Referenced by gp_camera_autodetect().

◆ gp_abilities_list_get_abilities()

int gp_abilities_list_get_abilities ( CameraAbilitiesList list,
int  index,
CameraAbilities abilities 
)

Retrieve the camera abilities of entry with supplied index number.

Parameters
lista CameraAbilitiesList
indexindex
abilitiespointer to CameraAbilities for returned data.
Returns
a gphoto2 error code

Retrieves the camera abilities of entry with supplied index number. Typically, you would call gp_camera_set_abilities() afterwards in order to prepare the initialization of a camera.

References GP_OK.

◆ gp_abilities_list_load()

int gp_abilities_list_load ( CameraAbilitiesList list,
GPContext context 
)

Scans the system for camera drivers.

Parameters
lista CameraAbilitiesList
contexta GPContext
Returns
a gphoto2 error code

All supported camera models will then be added to the list.

Referenced by gp_camera_autodetect().

◆ gp_abilities_list_lookup_model()

int gp_abilities_list_lookup_model ( CameraAbilitiesList list,
const char *  model 
)

Search the list for an entry of given model name.

Parameters
lista CameraAbilitiesList
modela camera model name
Returns
Index of entry or gphoto2 error code

References GP_ERROR_MODEL_NOT_FOUND, and CameraAbilities::model.

◆ gp_abilities_list_new()

int gp_abilities_list_new ( CameraAbilitiesList **  list)

Allocate the memory for a new abilities list.

Function to allocate the memory for a new abilities list.

Parameters
listCameraAbilitiesList object to initialize
Returns
gphoto2 error code

You would then call gp_abilities_list_load() in order to populate it.

References gp_init_localedir(), and GP_OK.

Referenced by gp_camera_autodetect().

◆ gp_abilities_list_reset()

int gp_abilities_list_reset ( CameraAbilitiesList list)

Reset the list.

Parameters
lista CameraAbilitiesList
Returns
a gphoto2 error code

References GP_OK.

◆ gp_init_localedir()

int gp_init_localedir ( const char *  localedir)

Initialize the localedir directory for the libgphoto2 gettext domain.

Override the localedir directory libgphoto2 uses for its message translations.

You only need to call this if you have a non-standard installation where the locale files are at a location which differs from the compiled in default location.

If you do need to call this function, call it before calling any non-initialization function.

Internally, this will make sure bindtextdomain() is called for the relevant gettext text domain(s).

Parameters
localedirRoot directory of libgphoto2's localization files. If NULL, use the compiled in default value, which will be something like "/usr/share/locale".
Returns
gphoto2 error code.

References gp_log(), GP_LOG_DEBUG, GP_OK, and gp_port_init_localedir().

Referenced by gp_abilities_list_new().

◆ gp_message_codeset()

const char * gp_message_codeset ( const char *  codeset)

Set the current character codeset libgphoto2 is operating in.

Set the codeset for all messages returned by libgphoto2.

Parameters
codesetNew codeset for the messages. For instance "utf-8".
Returns
old codeset as returned from bind_textdomain_codeset().

References gp_port_message_codeset().