From fd692a071e71409e43ae10828c59f48034564e1c Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Sat, 14 Oct 2006 11:54:47 +0000 Subject: Move header files one last time to reduce file path lengths in tarball. git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@9330 67ed7778-7388-44ab-90cf-0a291f65f57c --- gphoto2/gphoto2-abilities-list.h | 192 +++++++++++++++++++++++++ gphoto2/gphoto2-camera.h | 304 +++++++++++++++++++++++++++++++++++++++ gphoto2/gphoto2-context.h | 148 +++++++++++++++++++ gphoto2/gphoto2-file.h | 153 ++++++++++++++++++++ gphoto2/gphoto2-filesys.h | 242 +++++++++++++++++++++++++++++++ gphoto2/gphoto2-library.h | 80 +++++++++++ gphoto2/gphoto2-list.h | 79 ++++++++++ gphoto2/gphoto2-result.h | 128 +++++++++++++++++ gphoto2/gphoto2-setting.h | 30 ++++ gphoto2/gphoto2-version.h | 38 +++++ gphoto2/gphoto2-widget.h | 101 +++++++++++++ gphoto2/gphoto2.h | 61 ++++++++ 12 files changed, 1556 insertions(+) create mode 100644 gphoto2/gphoto2-abilities-list.h create mode 100644 gphoto2/gphoto2-camera.h create mode 100644 gphoto2/gphoto2-context.h create mode 100644 gphoto2/gphoto2-file.h create mode 100644 gphoto2/gphoto2-filesys.h create mode 100644 gphoto2/gphoto2-library.h create mode 100644 gphoto2/gphoto2-list.h create mode 100644 gphoto2/gphoto2-result.h create mode 100644 gphoto2/gphoto2-setting.h create mode 100644 gphoto2/gphoto2-version.h create mode 100644 gphoto2/gphoto2-widget.h create mode 100644 gphoto2/gphoto2.h (limited to 'gphoto2') diff --git a/gphoto2/gphoto2-abilities-list.h b/gphoto2/gphoto2-abilities-list.h new file mode 100644 index 000000000..8e1d29639 --- /dev/null +++ b/gphoto2/gphoto2-abilities-list.h @@ -0,0 +1,192 @@ +/** \file gphoto2-abilities-list.h + * \brief List of supported camera models including their abilities. + * + * \author Copyright 2000 Scott Fritzinger + * + * \par + * 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. + * + * \par + * 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. + * + * \par + * 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. + */ + +#ifndef __GPHOTO2_ABILITIES_LIST_H__ +#define __GPHOTO2_ABILITIES_LIST_H__ + +#include +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef enum { + GP_DRIVER_STATUS_PRODUCTION, + GP_DRIVER_STATUS_TESTING, + GP_DRIVER_STATUS_EXPERIMENTAL, + GP_DRIVER_STATUS_DEPRECATED +} CameraDriverStatus; + +/** + * Type of the device represented. Currently we have Still Cameras + * and MTP Audio Players. + */ +typedef enum { + GP_DEVICE_STILL_CAMERA = 0, + GP_DEVICE_AUDIO_PLAYER = 1 << 0 +} GphotoDeviceType; + +typedef enum { + GP_OPERATION_NONE = 0, + GP_OPERATION_CAPTURE_IMAGE = 1 << 0, + GP_OPERATION_CAPTURE_VIDEO = 1 << 1, + GP_OPERATION_CAPTURE_AUDIO = 1 << 2, + GP_OPERATION_CAPTURE_PREVIEW = 1 << 3, + GP_OPERATION_CONFIG = 1 << 4 +} CameraOperation; + +typedef enum { + GP_FILE_OPERATION_NONE = 0, + GP_FILE_OPERATION_DELETE = 1 << 1, + GP_FILE_OPERATION_PREVIEW = 1 << 3, + GP_FILE_OPERATION_RAW = 1 << 4, + GP_FILE_OPERATION_AUDIO = 1 << 5, + GP_FILE_OPERATION_EXIF = 1 << 6 +} CameraFileOperation; + +typedef enum { + GP_FOLDER_OPERATION_NONE = 0, + GP_FOLDER_OPERATION_DELETE_ALL = 1 << 0, + GP_FOLDER_OPERATION_PUT_FILE = 1 << 1, + GP_FOLDER_OPERATION_MAKE_DIR = 1 << 2, + GP_FOLDER_OPERATION_REMOVE_DIR = 1 << 3 +} CameraFolderOperation; + + +#ifdef _GPHOTO2_INTERNAL_CODE + + /* enum CameraOperation */ + extern const StringFlagItem gpi_camera_operation_map[]; + + /* enum CameraFileOperation */ + extern const StringFlagItem gpi_file_operation_map[]; + + /* enum CameraFolderOperation */ + extern const StringFlagItem gpi_folder_operation_map[]; + + /* enum GphotoDeviceType */ + extern const StringFlagItem gpi_gphoto_device_type_map[]; + + /* enum CameraDriverStatus */ + extern const StringFlagItem gpi_camera_driver_status_map[]; + +#endif /* _GPHOTO2_INTERNAL_CODE */ + + +/** + * \brief Describes the properties of a specific camera. + * + * The internals of this structures are used extensively by the + * camlibs, but the status regarding use by frontends is questionable. + */ +typedef struct { + char model [128]; /**< name of camera model */ + CameraDriverStatus status; /**< driver quality */ + + /** Supported port. */ + GPPortType port; + /** Supported port speeds (terminated with a value of 0). */ + int speed [64]; + + /* Supported operations */ + CameraOperation operations; /**< camera operation funcs */ + CameraFileOperation file_operations; /**< camera file op funcs */ + CameraFolderOperation folder_operations;/**< camera folder op funcs */ + + int usb_vendor; /**< USB Vendor D */ + int usb_product; /**< USB Product ID */ + int usb_class; /**< USB device class */ + int usb_subclass; /**< USB device subclass */ + int usb_protocol; /**< USB device protocol */ + + /* For core use */ + char library [1024]; /**< \internal */ + char id [1024]; /**< \internal */ + + GphotoDeviceType device_type; /**< Device type. */ + /* Reserved space to use in the future w/out changing the + * struct size */ + int reserved2; /**< reserved space \internal */ + int reserved3; /**< reserved space \internal */ + int reserved4; /**< reserved space \internal */ + int reserved5; /**< reserved space \internal */ + int reserved6; /**< reserved space \internal */ + int reserved7; /**< reserved space \internal */ + int reserved8; /**< reserved space \internal */ +} CameraAbilities; + + +/** + * \brief List of supported camera models including their abilities + * + * The internals of this list are hidden - use the access functions. + */ +typedef struct _CameraAbilitiesList CameraAbilitiesList; + + +int gp_abilities_list_new (CameraAbilitiesList **list); +int gp_abilities_list_free (CameraAbilitiesList *list); + +int gp_abilities_list_load (CameraAbilitiesList *list, GPContext *context); +int gp_abilities_list_reset (CameraAbilitiesList *list); + +int gp_abilities_list_detect (CameraAbilitiesList *list, + GPPortInfoList *info_list, CameraList *l, + GPContext *context); + +int gp_abilities_list_append (CameraAbilitiesList *list, + CameraAbilities abilities); + +int gp_abilities_list_count (CameraAbilitiesList *list); + +int gp_abilities_list_lookup_model (CameraAbilitiesList *list, + const char *model); + +int gp_abilities_list_get_abilities (CameraAbilitiesList *list, int index, + CameraAbilities *abilities); + +const char *gp_message_codeset (const char *); + + +/** + * Name of the environment variable which may contain the path where + * to look for the camlibs. If this environment variable is not defined, + * use the compiled-in default constant. + * + * \internal Internal use only. + */ +#ifdef _GPHOTO2_INTERNAL_CODE +#define CAMLIBDIR_ENV "CAMLIBS" +#endif /* _GPHOTO2_INTERNAL_CODE */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GPHOTO2_ABILITIES_LIST_H__ */ diff --git a/gphoto2/gphoto2-camera.h b/gphoto2/gphoto2-camera.h new file mode 100644 index 000000000..733f843d7 --- /dev/null +++ b/gphoto2/gphoto2-camera.h @@ -0,0 +1,304 @@ +/** \file + * + * Implement Camera object representing a camera attached to the system. + * + * \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. + * + * \note + * 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. + * + * \note + * 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. + */ + +#ifndef __GPHOTO2_CAMERA_H__ +#define __GPHOTO2_CAMERA_H__ + +#include + + +/** + * \brief 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 struct _Camera Camera; + + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +typedef struct { + char text [32 * 1024]; +} CameraText; + +typedef struct { + char name [128]; + char folder [1024]; +} CameraFilePath; + +typedef enum { + GP_CAPTURE_IMAGE, + GP_CAPTURE_MOVIE, + GP_CAPTURE_SOUND +} CameraCaptureType; + +typedef enum { + GP_EVENT_UNKNOWN, /* unknown and unhandled event */ + GP_EVENT_TIMEOUT, /* timeout, no arguments */ + GP_EVENT_FILE_ADDED, /* CameraFilePath* = file path on camfs */ + GP_EVENT_FOLDER_ADDED /* CameraFilePath* = folder on camfs */ +} CameraEventType; + +/** + * \name 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); +/**@}*/ + + +/** + * \param camera a \ref Camera object + * \param context a \ref GPContext object + * \return 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. + */ +typedef int (*CameraPrePostFunc) (Camera *camera, GPContext *context); + + +typedef struct _CameraFunctions CameraFunctions; +struct _CameraFunctions { + + /* Those will be called before and after each operation */ + CameraPrePostFunc pre_func; + CameraPrePostFunc post_func; + + CameraExitFunc exit; + + /* Configuration */ + CameraGetConfigFunc get_config; + CameraSetConfigFunc set_config; + + /* Capturing */ + CameraCaptureFunc capture; + CameraCapturePreviewFunc capture_preview; + + /* Textual information */ + CameraSummaryFunc summary; + CameraManualFunc manual; + CameraAboutFunc about; + + /* Event Interface */ + CameraWaitForEvent wait_for_event; + + /* Reserved space to use in the future without changing the struct size */ + void *reserved1; + void *reserved2; + void *reserved3; + void *reserved4; + void *reserved5; + void *reserved6; + void *reserved7; +}; + +/* Those are DEPRECATED */ +typedef GPPort CameraPort; +typedef GPPortInfo CameraPortInfo; + +typedef struct _CameraPrivateLibrary CameraPrivateLibrary; +typedef struct _CameraPrivateCore CameraPrivateCore; + +struct _Camera { + + /** \name Those should be accessed only by the camera driver. + * @{ */ + GPPort *port; + CameraFilesystem *fs; + CameraFunctions *functions; + /**@}*/ + + CameraPrivateLibrary *pl; /**< Private data of camera libraries. */ + CameraPrivateCore *pc; /**< Private data of the core of gphoto2. */ +}; + + +/** Create a new camera device. */ +int gp_camera_new (Camera **camera); + + +/** \name Preparing initialization + * @{ + */ +int gp_camera_set_abilities (Camera *camera, CameraAbilities abilities); +int gp_camera_get_abilities (Camera *camera, CameraAbilities *abilities); +int gp_camera_set_port_info (Camera *camera, GPPortInfo info); +int gp_camera_get_port_info (Camera *camera, GPPortInfo *info); + +/**@}*/ + + +/** + * \name 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); +int gp_camera_get_port_speed (Camera *camera); + +/**@}*/ + + +/** \name Initialization + * @{ + */ +int gp_camera_init (Camera *camera, GPContext *context); +int gp_camera_exit (Camera *camera, GPContext *context); + +/**@}*/ + + +/** \name Operations on cameras + * @{ + */ +int gp_camera_ref (Camera *camera); +int gp_camera_unref (Camera *camera); +int gp_camera_free (Camera *camera); + +int gp_camera_get_config (Camera *camera, CameraWidget **window, + GPContext *context); +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); + +/**@}*/ + + +/** \name 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); +/**@}*/ + + +/** \name 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); +/**@}*/ + + +/** + * \name 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); + +/**@}*/ + +#endif /* __GPHOTO2_CAMERA_H__ */ diff --git a/gphoto2/gphoto2-context.h b/gphoto2/gphoto2-context.h new file mode 100644 index 000000000..07f7c7acd --- /dev/null +++ b/gphoto2/gphoto2-context.h @@ -0,0 +1,148 @@ +/** \file + * + * \author Copyright 2001 Lutz Müller + * + * \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. + * + * \note + * 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. + * + * \note + * 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. + */ + +#ifndef __GPHOTO2_CONTEXT_H__ +#define __GPHOTO2_CONTEXT_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct _GPContext GPContext; + +GPContext *gp_context_new (void); + +void gp_context_ref (GPContext *context); +void gp_context_unref (GPContext *context); + +enum _GPContextFeedback { + GP_CONTEXT_FEEDBACK_OK, + GP_CONTEXT_FEEDBACK_CANCEL +}; +typedef enum _GPContextFeedback GPContextFeedback; + +/* Functions */ +typedef void (* GPContextIdleFunc) (GPContext *context, void *data); +typedef void (* GPContextErrorFunc) (GPContext *context, const char *format, + va_list args, void *data) +#if (__GNUC__ >= 3) + __attribute__((__format__(printf,2,0))) +#endif +; +typedef void (* GPContextStatusFunc) (GPContext *context, const char *format, + va_list args, void *data) +#if (__GNUC__ >= 3) + __attribute__((__format__(printf,2,0))) +#endif +; +typedef void (* GPContextMessageFunc) (GPContext *context, const char *format, + va_list args, void *data) +#if (__GNUC__ >= 3) + __attribute__((__format__(printf,2,0))) +#endif +; +typedef GPContextFeedback (* GPContextQuestionFunc) (GPContext *context, + const char *format, + va_list args, void *data) +#if (__GNUC__ >= 3) + __attribute__((__format__(printf,2,0))) +#endif +; +typedef GPContextFeedback (* GPContextCancelFunc) (GPContext *context, + void *data); +typedef unsigned int (* GPContextProgressStartFunc) (GPContext *context, + float target, + const char *format, + va_list args, void *data) +#if (__GNUC__ >= 3) + __attribute__((__format__(printf,3,0))) +#endif +; +typedef void (* GPContextProgressUpdateFunc) (GPContext *context, + unsigned int id, + float current, + void *data); +typedef void (* GPContextProgressStopFunc) (GPContext *context, + unsigned int id, + void *data); + +/* Setting those functions (frontends) */ +void gp_context_set_idle_func (GPContext *context, + GPContextIdleFunc func, void *data); +void gp_context_set_progress_funcs (GPContext *context, + GPContextProgressStartFunc start_func, + GPContextProgressUpdateFunc update_func, + GPContextProgressStopFunc stop_func, + void *data); +void gp_context_set_error_func (GPContext *context, + GPContextErrorFunc func, void *data); +void gp_context_set_status_func (GPContext *context, + GPContextStatusFunc func, void *data); +void gp_context_set_question_func (GPContext *context, + GPContextQuestionFunc func, void *data); +void gp_context_set_cancel_func (GPContext *context, + GPContextCancelFunc func, void *data); +void gp_context_set_message_func (GPContext *context, + GPContextMessageFunc func, void *data); + +/* Calling those functions (backends) */ +void gp_context_idle (GPContext *context); +void gp_context_error (GPContext *context, const char *format, ...) +#ifdef __GNUC__ + __attribute__((__format__(printf,2,3))) +#endif +; +void gp_context_status (GPContext *context, const char *format, ...) +#ifdef __GNUC__ + __attribute__((__format__(printf,2,3))) +#endif +; +void gp_context_message (GPContext *context, const char *format, ...) +#ifdef __GNUC__ + __attribute__((__format__(printf,2,3))) +#endif +; +GPContextFeedback gp_context_question (GPContext *context, const char *format, + ...) +#ifdef __GNUC__ + __attribute__((__format__(printf,2,3))) +#endif +; +GPContextFeedback gp_context_cancel (GPContext *context); +unsigned int gp_context_progress_start (GPContext *context, float target, + const char *format, ...) +#ifdef __GNUC__ + __attribute__((__format__(printf,3,4))) +#endif +; +void gp_context_progress_update (GPContext *context, unsigned int id, + float current); +void gp_context_progress_stop (GPContext *context, unsigned int id); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GPHOTO2_CONTEXT_H__ */ diff --git a/gphoto2/gphoto2-file.h b/gphoto2/gphoto2-file.h new file mode 100644 index 000000000..0416a9540 --- /dev/null +++ b/gphoto2/gphoto2-file.h @@ -0,0 +1,153 @@ +/** \file + * + * \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. + * + * \note + * 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. + * + * \note + * 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. + */ + +#ifndef __GPHOTO2_FILE_H__ +#define __GPHOTO2_FILE_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define GP_MIME_WAV "audio/wav" +#define GP_MIME_RAW "image/x-raw" +#define GP_MIME_PNG "image/png" +#define GP_MIME_PGM "image/x-portable-graymap" +#define GP_MIME_PPM "image/x-portable-pixmap" +#define GP_MIME_PNM "image/x-portable-anymap" +#define GP_MIME_JPEG "image/jpeg" +#define GP_MIME_TIFF "image/tiff" +#define GP_MIME_BMP "image/bmp" +#define GP_MIME_QUICKTIME "video/quicktime" +#define GP_MIME_AVI "video/x-msvideo" +#define GP_MIME_CRW "image/x-canon-raw" +#define GP_MIME_UNKNOWN "application/octet-stream" +#define GP_MIME_EXIF "application/x-exif" +#define GP_MIME_MP3 "audio/mpeg" +#define GP_MIME_OGG "application/ogg" +#define GP_MIME_WMA "audio/x-wma" +#define GP_MIME_ASF "audio/x-asf" +#define GP_MIME_MPEG "video/mpeg" + +typedef enum { + GP_FILE_TYPE_PREVIEW, + GP_FILE_TYPE_NORMAL, + GP_FILE_TYPE_RAW, + GP_FILE_TYPE_AUDIO, + GP_FILE_TYPE_EXIF, + GP_FILE_TYPE_METADATA +} CameraFileType; + +/*! \class CameraFile + * + * The internals of the #CameraFile struct are private. + */ +typedef struct _CameraFile CameraFile; + +int gp_file_new (CameraFile **file); +int gp_file_ref (CameraFile *file); +int gp_file_unref (CameraFile *file); +int gp_file_free (CameraFile *file); + +/* "Do not use those" + * + * These functions probably were originally intended for internal use only. + * However, due to + * - the lack of good documentation + * - this being the obvious way to save a file + * - the fact that libgphoto2 has been exporting all its internal + * symbols for years (until 2005-06) + * - our in-house frontends gphoto2 and gtkam using them + * a number of external frontends started to use these functions, as + * of 2005-06: + * - digikam + * - f-spot + * - gthumb + * But a few frontends can live without it (and thus are likely to + * use the correct API): + * - flphoto + * - kamera + * + * So we're going to phase these functions out over the next year or + * so, going the GTK way of keeping the ABI but breaking the API. So + * we'll continue to export functionally equivalent functions, but the + * header files will not contain definitions for you to use any more. + */ +int gp_file_open (CameraFile *file, const char *filename); +int gp_file_save (CameraFile *file, const char *filename); +int gp_file_clean (CameraFile *file); +int gp_file_copy (CameraFile *destination, CameraFile *source); + +int gp_file_set_name (CameraFile *file, const char *name); +int gp_file_get_name (CameraFile *file, const char **name); + +int gp_file_set_mime_type (CameraFile *file, const char *mime_type); +int gp_file_get_mime_type (CameraFile *file, const char **mime_type); + +int gp_file_set_type (CameraFile *file, CameraFileType type); +int gp_file_get_type (CameraFile *file, CameraFileType *type); + +int gp_file_set_mtime (CameraFile *file, time_t mtime); +int gp_file_get_mtime (CameraFile *file, time_t *mtime); + +int gp_file_detect_mime_type (CameraFile *file); +int gp_file_adjust_name_for_mime_type (CameraFile *file); + +int gp_file_append (CameraFile*, const char *data, + unsigned long int size); +int gp_file_set_data_and_size (CameraFile*, char *data, + unsigned long int size); +int gp_file_get_data_and_size (CameraFile*, const char **data, + unsigned long int *size); + +/* Conversion */ + +/* + * Please don't use the following in front-ends and camera drivers that are + * not in gphoto CVS. We need to do some more work here, and this part of + * the API is subject to change. + * + * If you like to do some work on conversion raw -> image/ *, please + * step forward and write to gphoto-devel@lists.sourceforge.net. + */ +typedef enum { + GP_FILE_CONVERSION_METHOD_CHUCK +} CameraFileConversionMethod; + +int gp_file_set_color_table (CameraFile *file, + const unsigned char *red_table, int red_size, + const unsigned char *green_table, int green_size, + const unsigned char *blue_table, int blue_size); +int gp_file_set_width_and_height (CameraFile *file, int width, int height); +int gp_file_set_header (CameraFile *file, const char *header); +int gp_file_set_conversion_method (CameraFile *file, + CameraFileConversionMethod method); + +int gp_file_convert (CameraFile *file, const char *mime_type); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GPHOTO2_FILE_H__ */ diff --git a/gphoto2/gphoto2-filesys.h b/gphoto2/gphoto2-filesys.h new file mode 100644 index 000000000..e9ba68fbd --- /dev/null +++ b/gphoto2/gphoto2-filesys.h @@ -0,0 +1,242 @@ +/** \file + * + * \author Copyright 2000 Scott Fritzinger + * + * \note + * Contributions: + * Lutz Müller (2001) + * + * \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. + * + * \note + * 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. + * + * \note + * 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. + */ + +#ifndef __GPHOTO2_FILESYS_H__ +#define __GPHOTO2_FILESYS_H__ + +#include + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef enum { + GP_FILE_INFO_NONE = 0, + GP_FILE_INFO_TYPE = 1 << 0, + GP_FILE_INFO_NAME = 1 << 1, + GP_FILE_INFO_SIZE = 1 << 2, + GP_FILE_INFO_WIDTH = 1 << 3, + GP_FILE_INFO_HEIGHT = 1 << 4, + GP_FILE_INFO_PERMISSIONS = 1 << 5, + GP_FILE_INFO_STATUS = 1 << 6, + GP_FILE_INFO_MTIME = 1 << 7, + GP_FILE_INFO_ALL = 0xFF +} CameraFileInfoFields; + +typedef enum { + GP_FILE_PERM_NONE = 0, + GP_FILE_PERM_READ = 1 << 0, + GP_FILE_PERM_DELETE = 1 << 1, + GP_FILE_PERM_ALL = 0xFF +} CameraFilePermissions; + +typedef enum { + GP_FILE_STATUS_NOT_DOWNLOADED, + GP_FILE_STATUS_DOWNLOADED +} CameraFileStatus; + +typedef struct _CameraFileInfoFile CameraFileInfoFile; +struct _CameraFileInfoFile { + CameraFileInfoFields fields; + CameraFileStatus status; + unsigned long size; + char type[64]; + + unsigned int width, height; + char name[64]; + CameraFilePermissions permissions; + time_t mtime; +}; + +typedef struct _CameraFileInfoPreview CameraFileInfoPreview; +struct _CameraFileInfoPreview { + CameraFileInfoFields fields; + CameraFileStatus status; + unsigned long size; + char type[64]; + + unsigned int width, height; +}; + +typedef struct _CameraFileInfoAudio CameraFileInfoAudio; +struct _CameraFileInfoAudio { + CameraFileInfoFields fields; + CameraFileStatus status; + unsigned long size; + char type[64]; +}; + +typedef struct _CameraFileInfo CameraFileInfo; +struct _CameraFileInfo { + CameraFileInfoPreview preview; + CameraFileInfoFile file; + CameraFileInfoAudio audio; +}; + +/* You don't really want to know what's inside, do you? */ +typedef struct _CameraFilesystem CameraFilesystem; + +int gp_filesystem_new (CameraFilesystem **fs); +int gp_filesystem_free (CameraFilesystem *fs); + +/* Manual editing */ +int gp_filesystem_append (CameraFilesystem *fs, const char *folder, + const char *filename, GPContext *context); +int gp_filesystem_set_info_noop (CameraFilesystem *fs, const char *folder, + CameraFileInfo info, GPContext *context); +int gp_filesystem_set_file_noop (CameraFilesystem *fs, const char *folder, + CameraFile *file, GPContext *context); +int gp_filesystem_delete_file_noop (CameraFilesystem *fs, const char *folder, + const char *filename, GPContext *context); +int gp_filesystem_reset (CameraFilesystem *fs); + +/* Information retrieval */ +int gp_filesystem_count (CameraFilesystem *fs, const char *folder, + GPContext *context); +int gp_filesystem_name (CameraFilesystem *fs, const char *folder, + int filenumber, const char **filename, + GPContext *context); +int gp_filesystem_get_folder (CameraFilesystem *fs, const char *filename, + const char **folder, GPContext *context); +int gp_filesystem_number (CameraFilesystem *fs, const char *folder, + const char *filename, GPContext *context); + +/* Listings */ +typedef int (*CameraFilesystemListFunc) (CameraFilesystem *fs, + const char *folder, CameraList *list, + void *data, GPContext *context); +int gp_filesystem_set_list_funcs (CameraFilesystem *fs, + CameraFilesystemListFunc file_list_func, + CameraFilesystemListFunc folder_list_func, + void *data); +int gp_filesystem_list_files (CameraFilesystem *fs, const char *folder, + CameraList *list, GPContext *context); +int gp_filesystem_list_folders (CameraFilesystem *fs, const char *folder, + CameraList *list, GPContext *context); + +/* File information */ +typedef int (*CameraFilesystemSetInfoFunc) (CameraFilesystem *fs, + const char *folder, + const char *filename, + CameraFileInfo info, void *data, + GPContext *context); +typedef int (*CameraFilesystemGetInfoFunc) (CameraFilesystem *fs, + const char *folder, + const char *filename, + CameraFileInfo *info, void *data, + GPContext *context); +int gp_filesystem_set_info_funcs (CameraFilesystem *fs, + CameraFilesystemGetInfoFunc get_info_func, + CameraFilesystemSetInfoFunc set_info_func, + void *data); +int gp_filesystem_get_info (CameraFilesystem *fs, const char *folder, + const char *filename, CameraFileInfo *info, + GPContext *context); +int gp_filesystem_set_info (CameraFilesystem *fs, const char *folder, + const char *filename, CameraFileInfo info, + GPContext *context); + +/* Files */ +typedef int (*CameraFilesystemGetFileFunc) (CameraFilesystem *fs, + const char *folder, + const char *filename, + CameraFileType type, + CameraFile *file, void *data, + GPContext *context); +typedef int (*CameraFilesystemDeleteFileFunc) (CameraFilesystem *fs, + const char *folder, + const char *filename, + void *data, GPContext *context); +int gp_filesystem_set_file_funcs (CameraFilesystem *fs, + CameraFilesystemGetFileFunc get_file_func, + CameraFilesystemDeleteFileFunc del_file_func, + void *data); +int gp_filesystem_get_file (CameraFilesystem *fs, const char *folder, + const char *filename, CameraFileType type, + CameraFile *file, GPContext *context); +int gp_filesystem_delete_file (CameraFilesystem *fs, const char *folder, + const char *filename, GPContext *context); + +/* Folders */ +typedef int (*CameraFilesystemPutFileFunc) (CameraFilesystem *fs, + const char *folder, + CameraFile *file, void *data, + GPContext *context); +typedef int (*CameraFilesystemDeleteAllFunc) (CameraFilesystem *fs, + const char *folder, void *data, + GPContext *context); +typedef int (*CameraFilesystemDirFunc) (CameraFilesystem *fs, + const char *folder, + const char *name, void *data, + GPContext *context); +int gp_filesystem_set_folder_funcs (CameraFilesystem *fs, + CameraFilesystemPutFileFunc put_file_func, + CameraFilesystemDeleteAllFunc delete_all_func, + CameraFilesystemDirFunc make_dir_func, + CameraFilesystemDirFunc remove_dir_func, + void *data); + +typedef struct _CameraFilesystemFuncs CameraFilesystemFuncs; +struct _CameraFilesystemFuncs { + CameraFilesystemListFunc file_list_func; + CameraFilesystemListFunc folder_list_func; + CameraFilesystemPutFileFunc put_file_func; + CameraFilesystemDeleteAllFunc delete_all_func; + CameraFilesystemGetInfoFunc get_info_func; + CameraFilesystemSetInfoFunc set_info_func; + CameraFilesystemDirFunc make_dir_func; + CameraFilesystemDirFunc remove_dir_func; + CameraFilesystemGetFileFunc get_file_func; + CameraFilesystemDeleteFileFunc del_file_func; + + /* for later use. Remove one if you add a new function */ + void *unused[32]; +}; +int gp_filesystem_set_funcs (CameraFilesystem *fs, + CameraFilesystemFuncs *funcs, + void *data); +int gp_filesystem_put_file (CameraFilesystem *fs, const char *folder, + CameraFile *file, GPContext *context); +int gp_filesystem_delete_all (CameraFilesystem *fs, const char *folder, + GPContext *context); +int gp_filesystem_make_dir (CameraFilesystem *fs, const char *folder, + const char *name, GPContext *context); +int gp_filesystem_remove_dir (CameraFilesystem *fs, const char *folder, + const char *name, GPContext *context); + +/* For debugging */ +int gp_filesystem_dump (CameraFilesystem *fs); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GPHOTO2_FILESYS_H__ */ diff --git a/gphoto2/gphoto2-library.h b/gphoto2/gphoto2-library.h new file mode 100644 index 000000000..e172cbb93 --- /dev/null +++ b/gphoto2/gphoto2-library.h @@ -0,0 +1,80 @@ +/** \file + * + * \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. + * + * \note + * 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. + * + * \note + * 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. + */ + +#ifndef __GPHOTO2_LIBRARY_H__ +#define __GPHOTO2_LIBRARY_H__ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * Returns a unique @id for the camera driver. + * + * @param id a #CameraText + * @return a gphoto2 error code + * + **/ +typedef int (* CameraLibraryIdFunc) (CameraText *id); + +/** + * Adds the abilities of the supported models to the supplied @list. + * + * @param list a #CameraAbilitiesList + * @return a gphoto2 error code + * + **/ +typedef int (* CameraLibraryAbilitiesFunc) (CameraAbilitiesList *list); + +/** + * Initializes the camera. + * + * @param camera a #Camera + * @param context a #GPContext + * @return 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). + * + **/ +typedef int (* CameraLibraryInitFunc) (Camera *camera, GPContext *context); + +/* + * If you want to write a camera library, you need to implement + * the following three functions. Everything else should be declared + * as static. + */ +int camera_id (CameraText *id); +int camera_abilities (CameraAbilitiesList *list); +int camera_init (Camera *camera, GPContext *context); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GPHOTO2_LIBRARY_H__ */ diff --git a/gphoto2/gphoto2-list.h b/gphoto2/gphoto2-list.h new file mode 100644 index 000000000..ca30532de --- /dev/null +++ b/gphoto2/gphoto2-list.h @@ -0,0 +1,79 @@ +/** \file gphoto2-list.h + * + * Lists of files, folders, cameras, etc. + * + * \author Copyright 2001 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. + * + * \note + * 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. + * + * \note + * 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. + */ + +#ifndef __GPHOTO2_LIST_H__ +#define __GPHOTO2_LIST_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Usage pattern for CameraList for users external of + * libgphoto2, such as libgphoto2 frontends: + * + * CameraList *list; + * gp_list_new (&list); + * init_list_somehow (list); + * for (i=0; i < gp_list_count(list); i++) { + * char *name, *value; + * gp_list_get_name (list, i, &name); + * gp_list_get_name (list, i, &value); + * do_something_with (name, value); + * } + * gp_list_free (list); + * + * Please do NOT directly instantiate a CameraList object like this: + * CameraList foo; // DO NOT DO THIS + * Please do NOT directly access the structure members like this: + * list->entry[i].name // DO NOT DO THIS + */ +typedef struct _CameraList CameraList; + +int gp_list_new (CameraList **list); +int gp_list_ref (CameraList *list); +int gp_list_unref (CameraList *list); +int gp_list_free (CameraList *list); + +int gp_list_count (CameraList *list); +int gp_list_append (CameraList *list, + const char *name, const char *value); +int gp_list_reset (CameraList *list); +int gp_list_sort (CameraList *list); + +int gp_list_find_by_name (CameraList *list, int *index, const char *name); + +int gp_list_get_name (CameraList *list, int index, const char **name); +int gp_list_get_value (CameraList *list, int index, const char **value); + +int gp_list_set_name (CameraList *list, int index, const char *name); +int gp_list_set_value (CameraList *list, int index, const char *value); + +int gp_list_populate (CameraList *list, const char *format, int count); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GPHOTO2_LIST_H__ */ diff --git a/gphoto2/gphoto2-result.h b/gphoto2/gphoto2-result.h new file mode 100644 index 000000000..a80c81fc5 --- /dev/null +++ b/gphoto2/gphoto2-result.h @@ -0,0 +1,128 @@ +/** \file + * + * \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. + * + * \note + * 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. + * + * \note + * 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. + */ + +#ifndef __GPHOTO2_RESULT_H__ +#define __GPHOTO2_RESULT_H__ + +/* Additional error codes are defined here */ +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * GP_ERROR_CORRUPTED_DATA: + * + * Data is corrupt. This error is reported by camera drivers if corrupted + * data has been received that can not be automatically handled. Normally, + * drivers will do everything possible to automatically recover from this + * error. + **/ +#define GP_ERROR_CORRUPTED_DATA -102 /* Corrupted data */ + +/** + * GP_ERROR_FILE_EXISTS: + * + * An operation failed because a file existed. This error is reported for + * example when the user tries to create a file that already exists. + **/ +#define GP_ERROR_FILE_EXISTS -103 + +/** + * GP_ERROR_MODEL_NOT_FOUND: + * + * The specified model could not be found. This error is reported when + * the user specified a model that does not seem to be supported by + * any driver. + **/ +#define GP_ERROR_MODEL_NOT_FOUND -105 + +/** + * GP_ERROR_DIRECTORY_NOT_FOUND: + * + * The specified directory could not be found. This error is reported when + * the user specified a directory that is non-existent. + **/ +#define GP_ERROR_DIRECTORY_NOT_FOUND -107 + +/** + * GP_ERROR_FILE_NOT_FOUND: + * + * The specified file could not be found. This error is reported when + * the user wants to access a file that is non-existent. + **/ +#define GP_ERROR_FILE_NOT_FOUND -108 + +/** + * GP_ERROR_DIRECTORY_EXISTS: + * + * The specified directory already exists. This error is reported for example + * when the user wants to create a directory that already exists. + **/ +#define GP_ERROR_DIRECTORY_EXISTS -109 + +/** + * GP_ERROR_CAMERA_BUSY: + * + * Camera I/O or a command is in progress. + **/ +#define GP_ERROR_CAMERA_BUSY -110 + +/** + * GP_ERROR_PATH_NOT_ABSOLUTE: + * + * The specified path is not absolute. This error is reported when the user + * specifies paths that are not absolute, i.e. paths like "path/to/directory". + * As a rule of thumb, in gphoto2, there is nothing like relative paths. + **/ +#define GP_ERROR_PATH_NOT_ABSOLUTE -111 + +#define GP_ERROR_CANCEL -112 + +/** + * GP_ERROR_CAMERA_ERROR: + * + * The camera reported some kind of error. This can be either a + * photographic error, such as failure to autofocus, underexposure, or + * violating storage permission, anything else that stops the camera + * from performing the operation. + */ +#define GP_ERROR_CAMERA_ERROR -113 + +/** + * GP_ERROR_OS_FAILURE: + * + * There was some sort of OS error in communicating with the camera, + * e.g. lack of permission for an operation. + */ +#define GP_ERROR_OS_FAILURE -114 + + +const char *gp_result_as_string (int result); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GPHOTO2_RESULT_H__ */ diff --git a/gphoto2/gphoto2-setting.h b/gphoto2/gphoto2-setting.h new file mode 100644 index 000000000..cbf27f8c0 --- /dev/null +++ b/gphoto2/gphoto2-setting.h @@ -0,0 +1,30 @@ +/** \file + * + * \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. + * + * \note + * 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. + * + * \note + * 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. + */ + +#ifndef __GPHOTO2_SETTING_H__ +#define __GPHOTO2_SETTING_H__ + +int gp_setting_set (char *id, char *key, char *value); +int gp_setting_get (char *id, char *key, char *value); + +#endif /* __GPHOTO2_SETTING_H__ */ diff --git a/gphoto2/gphoto2-version.h b/gphoto2/gphoto2-version.h new file mode 100644 index 000000000..16abf52e3 --- /dev/null +++ b/gphoto2/gphoto2-version.h @@ -0,0 +1,38 @@ +/** \file + * + * \author Copyright 2002 Hans Ulrich Niedermann + * + * \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. + * + * \note + * 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. + * + * \note + * 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. + */ +#ifndef __GPHOTO2_VERSION_H__ +#define __GPHOTO2_VERSION_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +const char **gp_library_version(GPVersionVerbosity verbose); + +#ifdef __cplusplus +} +#endif + +#endif /* __GPHOTO2_VERSION_H__ */ diff --git a/gphoto2/gphoto2-widget.h b/gphoto2/gphoto2-widget.h new file mode 100644 index 000000000..1b670168e --- /dev/null +++ b/gphoto2/gphoto2-widget.h @@ -0,0 +1,101 @@ +/** \file + * + * \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. + * + * \note + * 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. + * + * \note + * 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. + */ + +#ifndef __GPHOTO2_WIDGET_H__ +#define __GPHOTO2_WIDGET_H__ + +#include + +/* You don't really want to know what's inside, do you? */ +typedef struct _CameraWidget CameraWidget; + +#include + +typedef enum { /* Value (get/set): */ + GP_WIDGET_WINDOW, + GP_WIDGET_SECTION, + GP_WIDGET_TEXT, /* char * */ + GP_WIDGET_RANGE, /* float */ + GP_WIDGET_TOGGLE, /* int */ + GP_WIDGET_RADIO, /* char * */ + GP_WIDGET_MENU, /* char * */ + GP_WIDGET_BUTTON, /* CameraWidgetCallback */ + GP_WIDGET_DATE /* int */ +} CameraWidgetType; + +typedef int (* CameraWidgetCallback) (Camera *, CameraWidget *, GPContext *); + +int gp_widget_new (CameraWidgetType type, const char *label, + CameraWidget **widget); +int gp_widget_free (CameraWidget *widget); +int gp_widget_ref (CameraWidget *widget); +int gp_widget_unref (CameraWidget *widget); + +int gp_widget_append (CameraWidget *widget, CameraWidget *child); +int gp_widget_prepend (CameraWidget *widget, CameraWidget *child); + +int gp_widget_count_children (CameraWidget *widget); +int gp_widget_get_child (CameraWidget *widget, int child_number, + CameraWidget **child); + +/* Retrieve Widgets */ +int gp_widget_get_child_by_label (CameraWidget *widget, + const char *label, + CameraWidget **child); +int gp_widget_get_child_by_id (CameraWidget *widget, int id, + CameraWidget **child); +int gp_widget_get_child_by_name (CameraWidget *widget, + const char *name, + CameraWidget **child); +int gp_widget_get_root (CameraWidget *widget, + CameraWidget **root); +int gp_widget_get_parent (CameraWidget *widget, + CameraWidget **parent); + +int gp_widget_set_value (CameraWidget *widget, const void *value); +int gp_widget_get_value (CameraWidget *widget, void *value); + +int gp_widget_set_name (CameraWidget *widget, const char *name); +int gp_widget_get_name (CameraWidget *widget, const char **name); + +int gp_widget_set_info (CameraWidget *widget, const char *info); +int gp_widget_get_info (CameraWidget *widget, const char **info); + +int gp_widget_get_id (CameraWidget *widget, int *id); +int gp_widget_get_type (CameraWidget *widget, CameraWidgetType *type); +int gp_widget_get_label (CameraWidget *widget, const char **label); + +int gp_widget_set_range (CameraWidget *range, + float low, float high, float increment); +int gp_widget_get_range (CameraWidget *range, + float *min, float *max, float *increment); + +int gp_widget_add_choice (CameraWidget *widget, const char *choice); +int gp_widget_count_choices (CameraWidget *widget); +int gp_widget_get_choice (CameraWidget *widget, int choice_number, + const char **choice); + +int gp_widget_changed (CameraWidget *widget); +int gp_widget_set_changed (CameraWidget *widget, int changed); + +#endif /* __GPHOTO2_WIDGET_H__ */ diff --git a/gphoto2/gphoto2.h b/gphoto2/gphoto2.h new file mode 100644 index 000000000..825266427 --- /dev/null +++ b/gphoto2/gphoto2.h @@ -0,0 +1,61 @@ +/** \file + * Convenience header for gphoto2 + * + * \author Copyright 2001 Lutz Müller + * + * \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. + * + * \note + * 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. + * + * \note + * 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. + */ +#ifndef __GPHOTO2_H__ +#define __GPHOTO2_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OS2 +# include +# include +# define CAMLIBS getenv("CAMLIBS") +# define RTLD_LAZY 0x001 +# define VERSION "2" +# define usleep(t) _sleep2(((t)+500)/ 1000) +#endif + +#ifdef WIN32 +#define CAMLIBS "." +#endif + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif + +#endif /* __GPHOTO2_H__ */ -- cgit v1.2.1