Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

gphoto2-camera.h File Reference

Implement Camera object representing a camera attached to the system. More...

#include <gphoto2-context.h>
#include <gphoto2-port.h>
#include <gphoto2-port-info-list.h>
#include <gphoto2-widget.h>
#include <gphoto2-list.h>
#include <gphoto2-file.h>
#include <gphoto2-filesys.h>
#include <gphoto2-abilities-list.h>
#include <gphoto2-result.h>

Go to the source code of this file.

Camera object member functions

These functions must be implemented by a camlib and the camlib's camera_init() function will add them to a Camera object.

typedef int(* CameraExitFunc )(Camera *camera, GPContext *context)
typedef int(* CameraGetConfigFunc )(Camera *camera, CameraWidget **widget, GPContext *context)
typedef int(* CameraSetConfigFunc )(Camera *camera, CameraWidget *widget, GPContext *context)
typedef int(* CameraCaptureFunc )(Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context)
typedef int(* CameraCapturePreviewFunc )(Camera *camera, CameraFile *file, GPContext *context)
typedef int(* CameraSummaryFunc )(Camera *camera, CameraText *text, GPContext *context)
typedef int(* CameraManualFunc )(Camera *camera, CameraText *text, GPContext *context)
typedef int(* CameraAboutFunc )(Camera *camera, CameraText *text, GPContext *context)
typedef int(* CameraWaitForEvent )(Camera *camera, int timeout, CameraEventType *eventtype, void **eventdata, GPContext *context)

Some cameras need 'keep-alive-messages'.

typedef int(* CameraTimeoutFunc )(Camera *camera, GPContext *context)
typedef unsigned int(* CameraTimeoutStartFunc )(Camera *camera, unsigned int timeout, CameraTimeoutFunc func, void *data)
typedef void(* CameraTimeoutStopFunc )(Camera *camera, unsigned int id, void *data)
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)
 Stop periodic calls to keepalive function.

Preparing initialization

int gp_camera_set_abilities (Camera *camera, CameraAbilities abilities)
 Sets the camera abilities.
int gp_camera_get_abilities (Camera *camera, CameraAbilities *abilities)
 Retrieve the abilities of the camera.
int gp_camera_set_port_info (Camera *camera, GPPortInfo info)
int gp_camera_get_port_info (Camera *camera, GPPortInfo *info)

camera speed

You normally don't use that. If you do, you prevent the camera driver from selecting the optimal speed.

int gp_camera_set_port_speed (Camera *camera, int speed)
 Set the camera speed.
int gp_camera_get_port_speed (Camera *camera)
 Retrieve the current speed.

Initialization

int gp_camera_init (Camera *camera, GPContext *context)
 Initiate a connection to the camera.
int gp_camera_exit (Camera *camera, GPContext *context)
 Close connection to camera.

Operations on cameras

int gp_camera_ref (Camera *camera)
 Increment the reference count of a .
int gp_camera_unref (Camera *camera)
 Decrements the reference count of a Camera.
int gp_camera_free (Camera *camera)
 Free the camera.
int gp_camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
 Retrieve a configuration window for the camera.
int gp_camera_set_config (Camera *camera, CameraWidget *window, 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_capture_preview (Camera *camera, CameraFile *file, GPContext *context)
int gp_camera_wait_for_event (Camera *camera, int timeout, CameraEventType *eventtype, void **eventdata, GPContext *context)
 Wait for an event from the camera.

Operations on folders

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, CameraFile *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)

Operations on files

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_delete (Camera *camera, const char *folder, const char *file, GPContext *context)

Typedefs

typedef _Camera Camera
 Object representing a camera attached to the system.
typedef int(* CameraPrePostFunc )(Camera *camera, GPContext *context)
typedef _CameraFunctions CameraFunctions
typedef GPPort CameraPort
typedef GPPortInfo CameraPortInfo
typedef _CameraPrivateLibrary CameraPrivateLibrary
typedef _CameraPrivateCore CameraPrivateCore

Enumerations

enum  CameraCaptureType { GP_CAPTURE_IMAGE, GP_CAPTURE_MOVIE, GP_CAPTURE_SOUND }
enum  CameraEventType { GP_EVENT_UNKNOWN, GP_EVENT_TIMEOUT, GP_EVENT_FILE_ADDED, GP_EVENT_FOLDER_ADDED }

Functions

int gp_camera_new (Camera **camera)
 Allocates the memory for a Camera.


Detailed Description

Implement Camera object representing a camera attached to the system.

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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


Typedef Documentation

typedef struct _Camera Camera
 

Object representing a camera attached to the system.

A Camera object represents a specific instance of a (physical of virtual) camera attached to the system.

The abilities of this type of camera are stored in a CameraAbility object.

The details of the Camera object are internal.

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

Parameters:
camera a Camera object
context a GPContext object
Returns:
a gphoto2 error code
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.


Function Documentation

int gp_camera_capture Camera camera,
CameraCaptureType  type,
CameraFilePath *  path,
GPContext *  context
 

gp_camera_capture: : a Camera : a #CameraCaptureType : a #CameraFilePath : a #GPContext

Captures an image, movie, or sound clip depending on the given . The resulting file will be stored on the camera. The location gets stored in . The file can then be downloaded using #gp_camera_file_get.

Returns:
a gphoto2 error code

int gp_camera_exit Camera camera,
GPContext *  context
 

Close connection to camera.

Parameters:
camera a Camera object
context a GPContext object
Returns:
a gphoto2 error code.
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.

int gp_camera_file_set_info Camera camera,
const char *  folder,
const char *  file,
CameraFileInfo  info,
GPContext *  context
 

gp_camera_file_set_info:

Parameters:
camera,: a Camera
folder,: a folder
file,: the name of a file
info,: the #CameraFileInfo
context,: a #GPContext
Sets some file properties like name or permissions.

Returns:
a gphoto2 error code

int gp_camera_folder_delete_all Camera camera,
const char *  folder,
GPContext *  context
 

gp_camera_folder_delete_all:

Parameters:
camera,: a Camera
folder,: a folder
context,: a #GPContext
Deletes all files in a given .

Returns:
a gphoto2 error code

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

gp_camera_folder_list_files:

Parameters:
camera,: a Camera
folder,: a folder
list,: a #CameraList
context,: a #GPContext
Lists the files in supplied .

Returns:
a gphoto2 error code

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

gp_camera_folder_list_folders:

Parameters:
camera,: a Camera
folder,: a folder
list,: a #CameraList
context,: a #GPContext
Lists the folders in supplied .

Returns:
a gphoto2 error code

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

gp_camera_folder_put_file:

Parameters:
camera,: a Camera
folder,: a folder
file,: a CameraFile
context,: a #GPContext
Uploads a file into given .

Returns:
a gphoto2 error code

int gp_camera_free Camera camera  ) 
 

Free the camera.

Parameters:
camera a Camera
Returns:
a gphoto2 error code
Deprecated:
This function should never be used. Please use gp_camera_unref() instead.

int gp_camera_get_abilities Camera camera,
CameraAbilities abilities
 

Retrieve the abilities of the camera.

Parameters:
camera a Camera
abilities 
Returns:
a gphoto2 error code

int gp_camera_get_about Camera camera,
CameraText *  about,
GPContext *  context
 

gp_camera_get_about: : a Camera : a #CameraText : a #GPContext

Retrieves information about the camera driver. Typically, this information contains name and address of the author, acknowledgements, etc.

Returns:
a gphoto2 error code

int gp_camera_get_config Camera camera,
CameraWidget **  window,
GPContext *  context
 

Retrieve a configuration window for the camera.

Parameters:
camera a Camera
window a CameraWidget
context a GPContext
Returns:
gphoto2 error code
This window can be used for construction of a configuration dialog.

int gp_camera_get_manual Camera camera,
CameraText *  manual,
GPContext *  context
 

gp_camera_get_manual: : a Camera : a #CameraText : a #GPContext

Retrieves the for given . This manual typically contains information about using the camera.

Returns:
a gphoto2 error code

int gp_camera_get_port_speed Camera camera  ) 
 

Retrieve the current speed.

Parameters:
camera a Camera
Returns:
The current speed or a gphoto2 error code

int gp_camera_get_summary Camera camera,
CameraText *  summary,
GPContext *  context
 

gp_camera_get_summary: : a Camera : a #CameraText : a #GPContext

Retrieves a camera . This summary typically contains information like manufacturer, pictures taken, or generally information that is not configurable.

Returns:
a gphoto2 error code

int gp_camera_init Camera camera,
GPContext *  context
 

Initiate a connection to the camera.

Parameters:
camera a camera
context a GPContext
Returns:
a gphoto2 error code
Before calling this function, the 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.

int gp_camera_new Camera **  camera  ) 
 

Allocates the memory for a Camera.

Parameters:
camera The Camera:: object to initialize.
Returns:
a gphoto2 error code

int gp_camera_ref Camera camera  ) 
 

Increment the reference count of a .

Parameters:
camera a Camera
Returns:
a gphoto2 error code

int gp_camera_set_abilities Camera camera,
CameraAbilities  abilities
 

Sets the camera abilities.

Parameters:
camera,: a Camera
abilities the CameraAbilities to be set
Returns:
a gphoto2 error code
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().

int gp_camera_set_config Camera camera,
CameraWidget window,
GPContext *  context
 

gp_camera_set_config: : a Camera : a #CameraWidget : a #GPContext

Sets the configuration. Typically, a is retrieved using gp_camera_get_config and passed to this function in order to adjust the settings on the camera.

Returns:
a gphoto2 error code

int gp_camera_set_port_speed Camera camera,
int  speed
 

Set the camera speed.

Parameters:
camera a Camera
speed the speed
Returns:
a gphoto2 error code
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.

void gp_camera_set_timeout_funcs Camera camera,
CameraTimeoutStartFunc  start_func,
CameraTimeoutStopFunc  stop_func,
void *  data
 

gp_camera_set_timeout_funcs:

Parameters:
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.
Returns:
a gphoto2 error code

int gp_camera_start_timeout Camera camera,
unsigned int  timeout,
CameraTimeoutFunc  func
 

gp_camera_start_timeout:

Parameters:
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
Returns:
The id of the background process or a gphoto2 error code
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.

void gp_camera_stop_timeout Camera camera,
unsigned int  id
 

Stop periodic calls to keepalive function.

Parameters:
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().

int gp_camera_unref Camera camera  ) 
 

Decrements the reference count of a Camera.

Parameters:
camera a Camera
Returns:
a gphoto2 error code
If the reference count reaches 0, the camera will be freed automatically.

int gp_camera_wait_for_event Camera camera,
int  timeout,
CameraEventType *  eventtype,
void **  eventdata,
GPContext *  context
 

Wait for an event from the camera.

Parameters:
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
Returns:
gphoto2 error code
This function blocks and waits for an event to come from the camera. If timeout occurs before an event is received then *eventtype==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 eventtype's match to which types of eventdata.


Generated on Thu Jun 14 21:43:51 2007 for libgphoto2 (libgphoto2) by  doxygen 1.4.2