template.c File Reference

Documented source code template for a camera driver (camlib). More...

#include "config.h"
#include <string.h>
#include <gphoto2-library.h>
#include <gphoto2-result.h>

Camera object member functions

The prototypes for these functions are defined in gphoto2-camera.h

int camera_exit (Camera *camera, GPContext *context)
int camera_config_get (Camera *camera, CameraWidget **window, GPContext *context)
int camera_config_set (Camera *camera, CameraWidget *window, GPContext *context)
int camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context)
int camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context)
int camera_summary (Camera *camera, CameraText *summary, GPContext *context)
int camera_manual (Camera *camera, CameraText *manual, GPContext *context)
int camera_about (Camera *camera, CameraText *about, GPContext *context)

CameraFilesystem member functions

int get_file_func (CameraFilesystem *fs, const char *folder, const char *filename, CameraFileType type, CameraFile *file, void *data, GPContext *context)
int put_file_func (CameraFilesystem *fs, const char *folder, CameraFile *file, void *data, GPContext *context)
int delete_file_func (CameraFilesystem *fs, const char *folder, const char *filename, void *data, GPContext *context)
int delete_all_func (CameraFilesystem *fs, const char *folder, void *data, GPContext *context)
int get_info_func (CameraFilesystem *fs, const char *folder, const char *filename, CameraFileInfo *info, void *data, GPContext *context)
int set_info_func (CameraFilesystem *fs, const char *folder, const char *file, CameraFileInfo info, void *data, GPContext *context)
int folder_list_func (CameraFilesystem *fs, const char *folder, CameraList *list, void *data, GPContext *context)
int file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list, void *data, GPContext *context)

camlib API functions

int camera_id (CameraText *id)
int camera_abilities (CameraAbilitiesList *list)
int camera_init (Camera *camera, GPContext *context)

Defines

#define _(String)   (String)
#define N_(String)   (String)


Detailed Description

Documented source code template for a camera driver (camlib).

Author:
Copyright © 2001 Lutz Müller <lutz@users.sourceforge.net>

Copyright © 2005 Hans Ulrich Niedermann <gp@n-dimensional.de>

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.

Introduction to camera drivers (camlibs)

Every camlib must implement the following three function groups:

We implement the camlib API functions last in this file because camera_init() must reference all the object member functions and by making camera_init() the last function in this file, we can avoid the need for forward declarations of the object member functions.

Note about "static" functions and exporting symbols

The build system uses libtool to explicitly specify the list of exported symbols. Only the three functions of the camlib API (camera_init(), camera_id(), and camera_abilities()) are exported.

Therefore it doesn't matter whether you declare your other functions static or not - regardless of whether they are object member functions or internal camlib functions.

We do not define the object member functions as static in this template in order to have autogenerated documentation about them.


Function Documentation

int camera_abilities CameraAbilitiesList list  ) 
 

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.

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

FIXME.

This function is a method of the Camera object.

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

FIXME.

This function is a method of the Camera object.

int camera_capture_preview Camera camera,
CameraFile file,
GPContext *  context
 

FIXME.

This function is a method of the Camera object.

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

FIXME.

This function is a method of the Camera object.

int camera_config_set Camera camera,
CameraWidget window,
GPContext *  context
 

FIXME.

This function is a method of the Camera object.

int camera_exit Camera camera,
GPContext *  context
 

Clean up some stuff (FIXME: When, what, why?).

This function is a method of the Camera object.

int camera_id CameraText *  id  ) 
 

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.

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.

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

FIXME.

This function is a method of the Camera object.

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

FIXME.

This function is a method of the Camera object.

int delete_all_func CameraFilesystem fs,
const char *  folder,
void *  data,
GPContext *  context
 

Delete all files from the camera.

This function is a CameraFilesystem method.

int delete_file_func CameraFilesystem fs,
const char *  folder,
const char *  filename,
void *  data,
GPContext *  context
 

Delete a file from the camera.

This function is a CameraFilesystem method.

int file_list_func CameraFilesystem fs,
const char *  folder,
CameraList *  list,
void *  data,
GPContext *  context
 

FIXME.

This function is a CameraFilesystem method.

int folder_list_func CameraFilesystem fs,
const char *  folder,
CameraList *  list,
void *  data,
GPContext *  context
 

FIXME.

This function is a CameraFilesystem method.

int get_file_func CameraFilesystem fs,
const char *  folder,
const char *  filename,
CameraFileType  type,
CameraFile file,
void *  data,
GPContext *  context
 

Get the file from the camera.

This function is a CameraFilesystem method.

int get_info_func CameraFilesystem fs,
const char *  folder,
const char *  filename,
CameraFileInfo *  info,
void *  data,
GPContext *  context
 

FIXME.

This function is a CameraFilesystem method.

int put_file_func CameraFilesystem fs,
const char *  folder,
CameraFile file,
void *  data,
GPContext *  context
 

Put a file onto the camera.

This function is a CameraFilesystem method.

int set_info_func CameraFilesystem fs,
const char *  folder,
const char *  file,
CameraFileInfo  info,
void *  data,
GPContext *  context
 

FIXME.

This function is a CameraFilesystem method.


Generated on Wed Mar 8 19:05:11 2006 for libgphoto2 (libgphoto2) by  doxygen 1.4.6