libgphoto2 photo camera library (libgphoto2) Internals
2.5.23
|
#include "config.h"
#include <gphoto2/gphoto2-camera.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <ltdl.h>
#include <gphoto2/gphoto2-result.h>
#include <gphoto2/gphoto2-library.h>
#include <gphoto2/gphoto2-port-log.h>
Go to the source code of this file.
Data Structures | |
struct | _CameraPrivateCore |
Macros | |
#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 | 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) |
int | gp_camera_new (Camera **camera) |
int | gp_camera_set_abilities (Camera *camera, CameraAbilities abilities) |
Sets the camera abilities. More... | |
int | gp_camera_get_abilities (Camera *camera, CameraAbilities *abilities) |
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) |
int | gp_camera_get_port_speed (Camera *camera) |
int | gp_camera_ref (Camera *camera) |
int | gp_camera_unref (Camera *camera) |
int | gp_camera_free (Camera *camera) |
int | gp_camera_autodetect (CameraList *list, GPContext *context) |
int | gp_camera_init (Camera *camera, GPContext *context) |
int | gp_camera_get_config (Camera *camera, CameraWidget **window, GPContext *context) |
int | gp_camera_get_single_config (Camera *camera, const char *name, CameraWidget **widget, GPContext *context) |
static void | _get_widget_names (CameraWidget *widget, CameraList *list) |
int | gp_camera_list_config (Camera *camera, CameraList *list, GPContext *context) |
int | gp_camera_set_config (Camera *camera, CameraWidget *window, GPContext *context) |
int | gp_camera_set_single_config (Camera *camera, const char *name, CameraWidget *widget, 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_trigger_capture (Camera *camera, 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) |
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, const char *filename, CameraFileType type, 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_read (Camera *camera, const char *folder, const char *file, CameraFileType type, uint64_t offset, char *buf, uint64_t *size, GPContext *context) |
int | gp_camera_file_delete (Camera *camera, const char *folder, const char *file, 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_get_storageinfo (Camera *camera, CameraStorageInformation **sifs, int *nrofsifs, GPContext *context) |
Gets information on the camera attached storage. More... | |
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) |
Implement Camera object representing a camera attached to the system.
Definition in file gphoto2-camera.c.
#define _ | ( | String | ) | (String) |
Definition at line 57 of file gphoto2-camera.c.
#define bindtextdomain | ( | Domain, | |
Directory | |||
) | (Domain) |
Definition at line 56 of file gphoto2-camera.c.
#define CAMERA_UNUSED | ( | c, | |
ctx | |||
) |
Definition at line 61 of file gphoto2-camera.c.
#define CHECK_CLOSE | ( | c, | |
ctx | |||
) |
Definition at line 163 of file gphoto2-camera.c.
#define CHECK_INIT | ( | c, | |
ctx | |||
) |
Definition at line 211 of file gphoto2-camera.c.
#define CHECK_OPEN | ( | c, | |
ctx | |||
) |
Definition at line 137 of file gphoto2-camera.c.
#define CHECK_RESULT_OPEN_CLOSE | ( | c, | |
result, | |||
ctx | |||
) |
Definition at line 196 of file gphoto2-camera.c.
#define CR | ( | c, | |
result, | |||
ctx | |||
) |
Definition at line 72 of file gphoto2-camera.c.
#define CRS | ( | c, | |
res, | |||
ctx | |||
) |
Definition at line 175 of file gphoto2-camera.c.
#define CRSL | ( | c, | |
res, | |||
ctx, | |||
list | |||
) |
Definition at line 185 of file gphoto2-camera.c.
#define dcgettext | ( | Domain, | |
Message, | |||
Type | |||
) | (Message) |
Definition at line 55 of file gphoto2-camera.c.
#define dgettext | ( | Domain, | |
Message | |||
) | (Message) |
Definition at line 54 of file gphoto2-camera.c.
#define gettext | ( | String | ) | (String) |
Definition at line 53 of file gphoto2-camera.c.
#define N_ | ( | String | ) | (String) |
Definition at line 58 of file gphoto2-camera.c.
#define textdomain | ( | String | ) | (String) |
Definition at line 52 of file gphoto2-camera.c.
|
static |
Retrieve a configuration list
for the camera
.
camera | a Camera |
list | a CameraList |
context | a GPContext |
The names in list can be used for the single set and get configuration calls.
Definition at line 1011 of file gphoto2-camera.c.
References gp_list_append(), GP_WIDGET_BUTTON, gp_widget_count_children(), GP_WIDGET_DATE, gp_widget_get_child(), gp_widget_get_name(), gp_widget_get_type(), GP_WIDGET_MENU, GP_WIDGET_RADIO, GP_WIDGET_RANGE, GP_WIDGET_SECTION, GP_WIDGET_TEXT, GP_WIDGET_TOGGLE, and GP_WIDGET_WINDOW.
Referenced by gp_camera_list_config().
int gp_camera_autodetect | ( | CameraList * | list, |
GPContext * | context | ||
) |
Autodetect all detectable camera
list | a CameraList that receives the autodetected cameras |
context | a GPContext |
This camera will autodetected all cameras that can be autodetected. This will for instance detect all USB cameras.
CameraList *list; gp_list_new (&list); gp_camera_autodetect (list, context); ... done! ...
Definition at line 618 of file gphoto2-camera.c.
References gp_abilities_list_detect(), gp_abilities_list_free(), gp_abilities_list_load(), gp_abilities_list_new(), gp_list_append(), gp_list_count(), gp_list_free(), gp_list_get_name(), gp_list_get_value(), gp_list_new(), GP_OK, gp_port_info_list_count(), gp_port_info_list_free(), gp_port_info_list_load(), and gp_port_info_list_new().
int gp_camera_capture | ( | Camera * | camera, |
CameraCaptureType | type, | ||
CameraFilePath * | path, | ||
GPContext * | context | ||
) |
Captures an image, movie, or sound clip depending on the given type
.
camera | a Camera |
type | a CameraCaptureType |
path | a CameraFilePath |
context | a GPContext |
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.
Definition at line 1327 of file gphoto2-camera.c.
References _, CAMERA_UNUSED, _CameraFunctions::capture, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, _Camera::functions, gp_context_error(), GP_ERROR_NOT_SUPPORTED, and GP_OK.
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.
camera | a Camera |
file | a CameraFile |
context | a GPContext |
For example, you could use gp_capture_preview() for taking some sample pictures before calling gp_capture().
Definition at line 1388 of file gphoto2-camera.c.
References _, CAMERA_UNUSED, _CameraFunctions::capture_preview, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, CR, _Camera::functions, gp_context_error(), GP_ERROR_NOT_SUPPORTED, gp_file_clean(), gp_file_get_name_by_type(), gp_file_set_name(), GP_FILE_TYPE_NORMAL, and GP_OK.
Close connection to camera.
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.
Definition at line 264 of file gphoto2-camera.c.
References _CameraPrivateCore::a, _CameraFunctions::exit, _CameraPrivateCore::exit_requested, _Camera::fs, _Camera::functions, gp_camera_stop_timeout(), gp_filesystem_reset(), GP_OK, gp_port_close(), gp_port_open(), _CameraPrivateCore::lh, CameraAbilities::model, _Camera::pc, _Camera::port, _CameraPrivateCore::timeout_ids, _CameraPrivateCore::timeout_ids_len, and _CameraPrivateCore::used.
Referenced by gp_camera_free(), gp_camera_set_abilities(), gp_camera_set_port_info(), and gp_camera_set_port_speed().
int gp_camera_file_delete | ( | Camera * | camera, |
const char * | folder, | ||
const char * | file, | ||
GPContext * | context | ||
) |
Deletes the file from folder
.
Definition at line 1752 of file gphoto2-camera.c.
References CAMERA_UNUSED, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, _Camera::fs, gp_filesystem_delete_file(), and GP_OK.
int gp_camera_file_get | ( | Camera * | camera, |
const char * | folder, | ||
const char * | file, | ||
CameraFileType | type, | ||
CameraFile * | camera_file, | ||
GPContext * | context | ||
) |
Retrieves a file from the Camera.
camera | a Camera |
folder | a folder |
file | the name of a file |
type | the CameraFileType |
camera_file | a CameraFile |
context | a GPContext |
Definition at line 1671 of file gphoto2-camera.c.
References CAMERA_UNUSED, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, CR, _Camera::fs, GP_ERROR_DIRECTORY_NOT_FOUND, GP_ERROR_FILE_NOT_FOUND, gp_file_clean(), gp_filesystem_get_file(), and GP_OK.
Referenced by 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.
Definition at line 1578 of file gphoto2-camera.c.
References CAMERA_UNUSED, CHECK_CLOSE, CHECK_INIT, CHECK_OPEN, CRS, _CameraFileInfoFile::fields, _CameraFileInfoPreview::fields, _CameraFileInfo::file, _Camera::fs, gp_camera_file_get(), GP_ERROR_NOT_SUPPORTED, gp_file_get_data_and_size(), gp_file_get_mime_type(), GP_FILE_INFO_NONE, GP_FILE_INFO_SIZE, GP_FILE_INFO_TYPE, gp_file_new(), GP_FILE_TYPE_PREVIEW, gp_file_unref(), gp_filesystem_get_info(), GP_OK, _CameraFileInfo::preview, result, _CameraFileInfoPreview::size, and _CameraFileInfoPreview::type.
int gp_camera_file_read | ( | Camera * | camera, |
const char * | folder, | ||
const char * | file, | ||
CameraFileType | type, | ||
uint64_t | offset, | ||
char * | buf, | ||
uint64_t * | size, | ||
GPContext * | context | ||
) |
Reads a file partially from the Camera.
camera | a Camera |
folder | a folder |
file | the name of a file |
type | the CameraFileType |
offset | the offset into the camera file |
data | the buffer receiving the data |
size | the size to be read and that was read. (Note: size should not exceed 32 bits) |
context | a GPContext |
Definition at line 1714 of file gphoto2-camera.c.
References CAMERA_UNUSED, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, _Camera::fs, GP_ERROR_DIRECTORY_NOT_FOUND, GP_ERROR_FILE_NOT_FOUND, gp_filesystem_read_file(), and GP_OK.
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.
camera | a Camera |
folder | a folder |
file | the name of a file |
info | the CameraFileInfo |
context | a GPContext |
Definition at line 1644 of file gphoto2-camera.c.
References CAMERA_UNUSED, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, _Camera::fs, gp_filesystem_set_info(), and GP_OK.
Deletes all files in a given folder
.
Definition at line 1522 of file gphoto2-camera.c.
References CAMERA_UNUSED, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, _Camera::fs, gp_filesystem_delete_all(), and GP_OK.
int gp_camera_folder_list_files | ( | Camera * | camera, |
const char * | folder, | ||
CameraList * | list, | ||
GPContext * | context | ||
) |
Lists the files in supplied folder
.
camera | a Camera |
folder | a folder |
list | a CameraList |
context | a GPContext |
Definition at line 1467 of file gphoto2-camera.c.
References CAMERA_UNUSED, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, CR, _Camera::fs, gp_filesystem_list_files(), gp_list_reset(), gp_list_sort(), and GP_OK.
int gp_camera_folder_list_folders | ( | Camera * | camera, |
const char * | folder, | ||
CameraList * | list, | ||
GPContext * | context | ||
) |
Lists the folders in supplied folder
.
camera | a Camera |
folder | a folder |
list | a CameraList |
context | a GPContext |
Definition at line 1495 of file gphoto2-camera.c.
References CAMERA_UNUSED, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, CR, _Camera::fs, gp_filesystem_list_folders(), gp_list_reset(), gp_list_sort(), and GP_OK.
int gp_camera_folder_make_dir | ( | Camera * | camera, |
const char * | folder, | ||
const char * | name, | ||
GPContext * | context | ||
) |
Creates a new directory called name
in the given folder
.
camera | a Camera |
folder | the location where to create the new directory |
name | the name of the directory to be created |
context | a GPContext |
Definition at line 1778 of file gphoto2-camera.c.
References CAMERA_UNUSED, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, _Camera::fs, gp_filesystem_make_dir(), and GP_OK.
int gp_camera_folder_put_file | ( | Camera * | camera, |
const char * | folder, | ||
const char * | filename, | ||
CameraFileType | type, | ||
CameraFile * | file, | ||
GPContext * | context | ||
) |
Uploads a file into given folder
.
camera | a Camera |
folder | a folder |
file | a CameraFile |
context | a GPContext |
Definition at line 1548 of file gphoto2-camera.c.
References CAMERA_UNUSED, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, _Camera::fs, gp_filesystem_put_file(), and GP_OK.
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
.
camera | a Camera |
folder | the folder from which to remove the directory |
name | the name of the directory to be removed |
context | a GPContext |
Definition at line 1802 of file gphoto2-camera.c.
References CAMERA_UNUSED, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, _Camera::fs, gp_filesystem_remove_dir(), and GP_OK.
int gp_camera_free | ( | Camera * | camera | ) |
Free the camera
.
camera | a Camera |
Definition at line 562 of file gphoto2-camera.c.
References _Camera::fs, _Camera::functions, gp_camera_exit(), gp_filesystem_free(), GP_OK, gp_port_free(), _CameraPrivateCore::lh, _Camera::pc, _Camera::port, and _CameraPrivateCore::timeout_ids.
Referenced by gp_camera_new(), and gp_camera_unref().
int gp_camera_get_abilities | ( | Camera * | camera, |
CameraAbilities * | abilities | ||
) |
Retrieve the abilities
of the camera
.
camera | a Camera |
abilities |
Definition at line 396 of file gphoto2-camera.c.
References _CameraPrivateCore::a, GP_OK, and _Camera::pc.
int gp_camera_get_about | ( | Camera * | camera, |
CameraText * | about, | ||
GPContext * | context | ||
) |
Retrieves information about the camera driver.
camera | a Camera |
about | a CameraText |
context | a GPContext |
Typically, this information contains name and address of the author, acknowledgements, etc.
Definition at line 1294 of file gphoto2-camera.c.
References _, _CameraFunctions::about, CAMERA_UNUSED, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, _Camera::functions, gp_context_error(), GP_ERROR_NOT_SUPPORTED, and GP_OK.
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 |
This window
can be used for construction of a configuration dialog.
Definition at line 858 of file gphoto2-camera.c.
References _, CAMERA_UNUSED, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, _Camera::functions, _CameraFunctions::get_config, gp_context_error(), GP_ERROR_NOT_SUPPORTED, and GP_OK.
int gp_camera_get_manual | ( | Camera * | camera, |
CameraText * | manual, | ||
GPContext * | context | ||
) |
Retrieves the manual
for given camera
.
camera | a Camera |
manual | a CameraText |
context | a GPContext |
This manual typically contains information about using the camera.
Definition at line 1262 of file gphoto2-camera.c.
References _, CAMERA_UNUSED, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, _Camera::functions, gp_context_error(), GP_ERROR_NOT_SUPPORTED, GP_OK, and _CameraFunctions::manual.
int gp_camera_get_port_info | ( | Camera * | camera, |
GPPortInfo * | info | ||
) |
Definition at line 407 of file gphoto2-camera.c.
References CR, GP_OK, gp_port_get_info(), and _Camera::port.
int gp_camera_get_port_speed | ( | Camera * | camera | ) |
Retrieve the current speed.
camera | a Camera |
Definition at line 491 of file gphoto2-camera.c.
References _Camera::pc, and _CameraPrivateCore::speed.
int gp_camera_get_single_config | ( | Camera * | camera, |
const char * | name, | ||
CameraWidget ** | widget, | ||
GPContext * | context | ||
) |
Retrieve a single configuration widget
for the camera
.
camera | a Camera |
name | the name of a configuration widget |
widget | a CameraWidget |
context | a GPContext |
This widget
will then contain the current and the possible values and the type.
Definition at line 891 of file gphoto2-camera.c.
References _, CAMERA_UNUSED, CHECK_CLOSE, CHECK_INIT, CHECK_OPEN, CHECK_RESULT_OPEN_CLOSE, _Camera::functions, _CameraFunctions::get_config, _CameraFunctions::get_single_config, gp_context_error(), GP_ERROR_BAD_PARAMETERS, GP_ERROR_NOT_SUPPORTED, GP_OK, gp_widget_add_choice(), GP_WIDGET_BUTTON, gp_widget_count_choices(), GP_WIDGET_DATE, gp_widget_free(), gp_widget_get_child_by_name(), gp_widget_get_choice(), gp_widget_get_label(), gp_widget_get_range(), gp_widget_get_readonly(), gp_widget_get_type(), gp_widget_get_value(), GP_WIDGET_MENU, gp_widget_new(), GP_WIDGET_RADIO, GP_WIDGET_RANGE, GP_WIDGET_SECTION, gp_widget_set_name(), gp_widget_set_range(), gp_widget_set_readonly(), gp_widget_set_value(), GP_WIDGET_TEXT, GP_WIDGET_TOGGLE, and GP_WIDGET_WINDOW.
int gp_camera_get_storageinfo | ( | Camera * | camera, |
CameraStorageInformation ** | sifs, | ||
int * | nrofsifs, | ||
GPContext * | context | ||
) |
Gets information on the camera attached storage.
camera | a Camera |
sifs | Pointer to receive a pointer to/array of storage info items |
nrofsifs | Pointer to receive number of array entries |
context | a GPContext |
Retrieves the storage information, like maximum and free space, for the specified filesystem, if supported by the device. The storage information is returned in an newly allocated array of CameraStorageInformation objects, to which the pointer pointed to by #sifs will be set.
The variable pointed to by #nrofsifs will be set to the number of elements in that array.
It is the caller's responsibility to free the memory of the array.
Definition at line 1837 of file gphoto2-camera.c.
References CAMERA_UNUSED, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, _Camera::fs, gp_filesystem_get_storageinfo(), and GP_OK.
int gp_camera_get_summary | ( | Camera * | camera, |
CameraText * | summary, | ||
GPContext * | context | ||
) |
Retrieves a camera summary.
camera | a Camera |
summary | a CameraText |
context | a GPContext |
This summary typically contains information like manufacturer, pictures taken, or generally information that is not configurable.
Definition at line 1231 of file gphoto2-camera.c.
References _, CAMERA_UNUSED, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, _Camera::functions, gp_context_error(), GP_ERROR_NOT_SUPPORTED, GP_OK, and _CameraFunctions::summary.
Initiate 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.
Definition at line 683 of file gphoto2-camera.c.
References _, _CameraPrivateCore::a, CRS, CRSL, _CameraPrivateCore::exit_requested, _Camera::functions, gp_abilities_list_detect(), gp_abilities_list_free(), gp_abilities_list_get_abilities(), gp_abilities_list_load(), gp_abilities_list_lookup_model(), gp_abilities_list_new(), gp_camera_set_abilities(), gp_camera_set_port_info(), gp_context_error(), GP_ERROR_FILE_NOT_FOUND, GP_ERROR_LIBRARY, GP_ERROR_MODEL_NOT_FOUND, GP_ERROR_UNKNOWN_PORT, gp_list_count(), gp_list_free(), gp_list_get_name(), gp_list_get_value(), gp_list_new(), GP_OK, gp_port_close(), gp_port_get_info(), gp_port_info_get_path(), gp_port_info_get_type(), gp_port_info_list_free(), gp_port_info_list_get_info(), gp_port_info_list_load(), gp_port_info_list_lookup_path(), gp_port_info_list_new(), GP_PORT_NONE, gp_port_open(), GP_PORT_USB, gp_port_usb_find_device(), gp_port_usb_find_device_by_class(), _CameraPrivateCore::lh, CameraAbilities::library, CameraAbilities::model, _Camera::pc, _Camera::port, result, _GPPort::type, CameraAbilities::usb_class, CameraAbilities::usb_product, CameraAbilities::usb_protocol, CameraAbilities::usb_subclass, and CameraAbilities::usb_vendor.
int gp_camera_list_config | ( | Camera * | camera, |
CameraList * | list, | ||
GPContext * | context | ||
) |
Definition at line 1050 of file gphoto2-camera.c.
References _, _get_widget_names(), CAMERA_UNUSED, CHECK_CLOSE, CHECK_INIT, CHECK_OPEN, CHECK_RESULT_OPEN_CLOSE, _Camera::functions, _CameraFunctions::get_config, gp_context_error(), GP_ERROR_NOT_SUPPORTED, GP_OK, gp_widget_free(), and _CameraFunctions::list_config.
int gp_camera_new | ( | Camera ** | camera | ) |
Allocates the memory for a Camera.
camera | the Camera object to initialize. |
Definition at line 317 of file gphoto2-camera.c.
References gp_camera_free(), GP_ERROR_NO_MEMORY, gp_filesystem_new(), GP_OK, gp_port_new(), and result.
int gp_camera_ref | ( | Camera * | camera | ) |
Increment the reference count of a camera
.
camera | a Camera |
Definition at line 507 of file gphoto2-camera.c.
References GP_OK, _Camera::pc, and _CameraPrivateCore::ref_count.
int gp_camera_set_abilities | ( | Camera * | camera, |
CameraAbilities | abilities | ||
) |
Sets the camera abilities.
camera | a Camera |
abilities | the CameraAbilities to be set |
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.
Definition at line 368 of file gphoto2-camera.c.
References _CameraPrivateCore::a, gp_camera_exit(), GP_OK, _CameraPrivateCore::lh, CameraAbilities::model, and _Camera::pc.
Referenced by gp_camera_init().
int gp_camera_set_config | ( | Camera * | camera, |
CameraWidget * | window, | ||
GPContext * | context | ||
) |
Sets the configuration.
camera | a Camera |
window | a CameraWidget |
context | a GPContext |
Typically, a window
is retrieved using gp_camera_get_config and passed to this function in order to adjust the settings on the camera.
Definition at line 1102 of file gphoto2-camera.c.
References _, CAMERA_UNUSED, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, _Camera::functions, gp_context_error(), GP_ERROR_NOT_SUPPORTED, GP_OK, and _CameraFunctions::set_config.
int gp_camera_set_port_info | ( | Camera * | camera, |
GPPortInfo | info | ||
) |
Definition at line 418 of file gphoto2-camera.c.
References CR, gp_camera_exit(), GP_OK, gp_port_info_get_name(), gp_port_info_get_path(), gp_port_set_info(), _CameraPrivateCore::lh, _Camera::pc, and _Camera::port.
Referenced by gp_camera_init().
int gp_camera_set_port_speed | ( | Camera * | camera, |
int | speed | ||
) |
Set the camera speed.
camera | a Camera |
speed | 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.
Definition at line 456 of file gphoto2-camera.c.
References CR, gp_camera_exit(), GP_OK, gp_port_get_settings(), GP_PORT_SERIAL, gp_port_set_settings(), _CameraPrivateCore::lh, _Camera::pc, _Camera::port, _GPPortSettings::serial, _GPPortSettingsSerial::speed, _CameraPrivateCore::speed, and _GPPort::type.
int gp_camera_set_single_config | ( | Camera * | camera, |
const char * | name, | ||
CameraWidget * | widget, | ||
GPContext * | context | ||
) |
Set a single configuration widget
for the camera
.
camera | a Camera |
name | the name of a configuration widget |
widget | a CameraWidget |
context | a GPContext |
This widget
contains the new value of the widget to set.
Definition at line 1134 of file gphoto2-camera.c.
References _, CAMERA_UNUSED, CHECK_CLOSE, CHECK_INIT, CHECK_OPEN, CHECK_RESULT_OPEN_CLOSE, _Camera::functions, _CameraFunctions::get_config, gp_context_error(), GP_ERROR_BAD_PARAMETERS, GP_ERROR_NOT_SUPPORTED, GP_OK, GP_WIDGET_BUTTON, GP_WIDGET_DATE, gp_widget_free(), gp_widget_get_child_by_name(), gp_widget_get_type(), gp_widget_get_value(), GP_WIDGET_MENU, GP_WIDGET_RADIO, GP_WIDGET_RANGE, GP_WIDGET_SECTION, gp_widget_set_changed(), gp_widget_set_value(), GP_WIDGET_TEXT, GP_WIDGET_TOGGLE, GP_WIDGET_WINDOW, _CameraFunctions::set_config, and _CameraFunctions::set_single_config.
void gp_camera_set_timeout_funcs | ( | Camera * | camera, |
CameraTimeoutStartFunc | start_func, | ||
CameraTimeoutStopFunc | stop_func, | ||
void * | data | ||
) |
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.
Definition at line 1867 of file gphoto2-camera.c.
References _Camera::pc, _CameraPrivateCore::timeout_data, _CameraPrivateCore::timeout_start_func, and _CameraPrivateCore::timeout_stop_func.
int gp_camera_start_timeout | ( | Camera * | camera, |
unsigned int | timeout, | ||
CameraTimeoutFunc | func | ||
) |
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 |
This function should be called by the camera driver during camera_init() if the camera needs to be sent messages periodically in order to prevent it from shutting down.
Definition at line 1893 of file gphoto2-camera.c.
References GP_ERROR_NOT_SUPPORTED, _Camera::pc, _CameraPrivateCore::timeout_data, _CameraPrivateCore::timeout_ids, _CameraPrivateCore::timeout_ids_len, and _CameraPrivateCore::timeout_start_func.
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 |
Call this function in the camera driver if you want to stop a periodic call to a function that has been started using gp_camera_start_timeout.
Definition at line 1934 of file gphoto2-camera.c.
References _Camera::pc, _CameraPrivateCore::timeout_data, _CameraPrivateCore::timeout_ids, _CameraPrivateCore::timeout_ids_len, and _CameraPrivateCore::timeout_stop_func.
Referenced by gp_camera_exit().
Triggers capture of one or more images.
This functions just remotely causes the shutter release and returns immediately. You will want to run #gp_camera_wait_event until a image is added which can be downloaded using gp_camera_file_get.
Definition at line 1358 of file gphoto2-camera.c.
References _, CAMERA_UNUSED, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, _Camera::functions, gp_context_error(), GP_ERROR_NOT_SUPPORTED, GP_OK, and _CameraFunctions::trigger_capture.
int gp_camera_unref | ( | Camera * | camera | ) |
Decrements the reference count of a Camera.
camera | a Camera |
If the reference count reaches %0, the camera
will be freed automatically.
Definition at line 528 of file gphoto2-camera.c.
References gp_camera_free(), GP_ERROR, GP_OK, _Camera::pc, _CameraPrivateCore::ref_count, and _CameraPrivateCore::used.
int gp_camera_wait_for_event | ( | Camera * | camera, |
int | timeout, | ||
CameraEventType * | eventtype, | ||
void ** | eventdata, | ||
GPContext * | context | ||
) |
Wait and retrieve 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 |
This function blocks and waits for an event to come from the camera. If a timeout occurs before an event is received then eventtype will be GP_EVENT_TIMEOUT and eventdata is left unchanged.
If an event is received then eventtype is set to the type of event, and eventdata is set to event specific data. See the CameraEventType enum to see which eventtypes match to which types of eventdata.
Note that this function will return one event after each other, you need to be able to call it multiple times, e.g. in a loop, when waiting for specific events.
Definition at line 1438 of file gphoto2-camera.c.
References CAMERA_UNUSED, CHECK_INIT, CHECK_RESULT_OPEN_CLOSE, _Camera::functions, GP_ERROR_NOT_SUPPORTED, GP_OK, and _CameraFunctions::wait_for_event.