1 /** \file gphoto2-abilities-list.h
2  * \brief List of supported camera models including their abilities.
3  *
4  * \author Copyright 2000 Scott Fritzinger
5  *
6  * \par
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * \par
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * \par
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the
21  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  * Boston, MA  02110-1301  USA
23  */
24 
25 #ifndef __GPHOTO2_ABILITIES_LIST_H__
26 #define __GPHOTO2_ABILITIES_LIST_H__
27 
28 #include <gphoto2/gphoto2-context.h>
29 #include <gphoto2/gphoto2-list.h>
30 #include <gphoto2/gphoto2-port-info-list.h>
31 
32 #include <gphoto2/gphoto2-port-log.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif /* __cplusplus */
37 
38 /**
39  * Current implementation status of the camera driver.
40  */
41 typedef enum {
42 	GP_DRIVER_STATUS_PRODUCTION,	/**< Driver is production ready. */
43 	GP_DRIVER_STATUS_TESTING,	/**< Driver is beta quality. */
44 	GP_DRIVER_STATUS_EXPERIMENTAL,	/**< Driver is alpha quality and might even not work. */
45 	GP_DRIVER_STATUS_DEPRECATED	/**< Driver is no longer recommended to use and will be removed. */
46 } CameraDriverStatus;
47 
48 /**
49  * Type of the device represented. Currently we have Still Cameras
50  * and MTP Audio Players.
51  */
52 typedef enum {
53         GP_DEVICE_STILL_CAMERA          = 0,	 /**< Traditional still camera */
54         GP_DEVICE_AUDIO_PLAYER          = 1 << 0 /**< Audio player */
55 } GphotoDeviceType;
56 
57 /**
58  * A bitmask of remote control related operations of the device.
59  * Some drivers might support additional dynamic capabilities (like the PTP driver).
60  */
61 typedef enum {
62         GP_OPERATION_NONE       	= 0,	  /**< No remote control operation supported. */
63         GP_OPERATION_CAPTURE_IMAGE      = 1 << 0, /**< Capturing images supported. */
64         GP_OPERATION_CAPTURE_VIDEO      = 1 << 1, /**< Capturing videos supported. */
65         GP_OPERATION_CAPTURE_AUDIO      = 1 << 2, /**< Capturing audio supported. */
66         GP_OPERATION_CAPTURE_PREVIEW    = 1 << 3, /**< Capturing image previews supported. */
67         GP_OPERATION_CONFIG             = 1 << 4, /**< Camera and Driver configuration supported. */
68         GP_OPERATION_TRIGGER_CAPTURE    = 1 << 5  /**< Camera can trigger capture and wait for events. */
69 } CameraOperation;
70 
71 /**
72  * A bitmask of image related operations of the device.
73  */
74 typedef enum {
75         GP_FILE_OPERATION_NONE          = 0,      /**< No special file operations, just download. */
76         GP_FILE_OPERATION_DELETE        = 1 << 1, /**< Deletion of files is possible. */
77         GP_FILE_OPERATION_PREVIEW       = 1 << 3, /**< Previewing viewfinder content is possible. */
78         GP_FILE_OPERATION_RAW           = 1 << 4, /**< Raw retrieval is possible (used by non-JPEG cameras) */
79         GP_FILE_OPERATION_AUDIO         = 1 << 5, /**< Audio retrieval is possible. */
80         GP_FILE_OPERATION_EXIF          = 1 << 6  /**< EXIF retrieval is possible. */
81 } CameraFileOperation;
82 
83 /**
84  * A bitmask of filesystem related operations of the device.
85  */
86 typedef enum {
87         GP_FOLDER_OPERATION_NONE        = 0,	  /**< No special filesystem operation. */
88         GP_FOLDER_OPERATION_DELETE_ALL  = 1 << 0, /**< Deletion of all files on the device. */
89         GP_FOLDER_OPERATION_PUT_FILE    = 1 << 1, /**< Upload of files to the device possible. */
90         GP_FOLDER_OPERATION_MAKE_DIR    = 1 << 2, /**< Making directories on the device possible. */
91         GP_FOLDER_OPERATION_REMOVE_DIR  = 1 << 3  /**< Removing directories from the device possible. */
92 } CameraFolderOperation;
93 
94 #ifdef _GPHOTO2_INTERNAL_CODE
95 
96   /* enum CameraOperation */
97   extern const StringFlagItem gpi_camera_operation_map[];
98 
99   /* enum CameraFileOperation */
100   extern const StringFlagItem gpi_file_operation_map[];
101 
102   /* enum CameraFolderOperation */
103   extern const StringFlagItem gpi_folder_operation_map[];
104 
105   /* enum GphotoDeviceType */
106   extern const StringFlagItem gpi_gphoto_device_type_map[];
107 
108   /* enum CameraDriverStatus */
109   extern const StringFlagItem gpi_camera_driver_status_map[];
110 
111 #endif /* _GPHOTO2_INTERNAL_CODE */
112 
113 
114 /**
115  * \brief Describes the properties of a specific camera.
116  *
117  * The internals of this structures are used extensively by the
118  * camlibs, but the status regarding use by frontends is questionable.
119  */
120 typedef struct {
121         char model [128];			/**< \brief name of camera model */
122         CameraDriverStatus status;		/**< \brief driver quality */
123 
124 	/** \brief Supported port types. */
125 	GPPortType port;
126 	/** \brief Supported serial port speeds (terminated with a value of 0). */
127         int speed [64];
128 
129         /* Supported operations */
130         CameraOperation       operations;	/**< \brief Camera operation funcs */
131         CameraFileOperation   file_operations;  /**< \brief Camera file op funcs */
132         CameraFolderOperation folder_operations;/**< \brief Camera folder op funcs */
133 
134 	int usb_vendor;		/**< \brief USB Vendor D */
135 	int usb_product;	/**< \brief USB Product ID */
136 	int usb_class;          /**< \brief USB device class */
137 	int usb_subclass;	/**< \brief USB device subclass */
138 	int usb_protocol;	/**< \brief USB device protocol */
139 
140         /* For core use */
141         char library [1024];	/**< \brief (Internal) library filename */
142         char id [1024];		/**< \brief (Internal) camera ID name */
143 
144 	GphotoDeviceType 	device_type;	/**< \brief Device type. */
145 	/** Reserved space to use in the future w/out changing the
146 	 * struct size */
147         int reserved2;		/**< reserved space \internal */
148         int reserved3;		/**< reserved space \internal */
149         int reserved4;		/**< reserved space \internal */
150         int reserved5;		/**< reserved space \internal */
151         int reserved6;		/**< reserved space \internal */
152         int reserved7;		/**< reserved space \internal */
153         int reserved8;		/**< reserved space \internal */
154 } CameraAbilities;
155 
156 
157 /**
158  * \brief List of supported camera models including their abilities
159  *
160  * The internals of this list are hidden - use the access functions.
161  */
162 typedef struct _CameraAbilitiesList CameraAbilitiesList;
163 
164 
165 int gp_abilities_list_new    (CameraAbilitiesList **list);
166 int gp_abilities_list_free   (CameraAbilitiesList *list);
167 
168 int gp_abilities_list_load   (CameraAbilitiesList *list, GPContext *context);
169 int gp_abilities_list_load_dir   (CameraAbilitiesList *list, const char *dir, GPContext *context);
170 int gp_abilities_list_reset  (CameraAbilitiesList *list);
171 
172 int gp_abilities_list_detect (CameraAbilitiesList *list,
173 			      GPPortInfoList *info_list, CameraList *l,
174 			      GPContext *context);
175 
176 int gp_abilities_list_append (CameraAbilitiesList *list,
177 			      CameraAbilities abilities);
178 
179 int gp_abilities_list_count  (CameraAbilitiesList *list);
180 
181 int gp_abilities_list_lookup_model (CameraAbilitiesList *list,
182 				    const char *model);
183 
184 int gp_abilities_list_get_abilities (CameraAbilitiesList *list, int index,
185 				     CameraAbilities *abilities);
186 
187 const char *gp_message_codeset (const char *);
188 
189 
190 /**
191  * Name of the environment variable which may contain the path where
192  * to look for the camlibs. If this environment variable is not defined,
193  * use the compiled-in default constant.
194  *
195  * \internal Internal use only.
196  */
197 #ifdef _GPHOTO2_INTERNAL_CODE
198 #define CAMLIBDIR_ENV "CAMLIBS"
199 #endif /* _GPHOTO2_INTERNAL_CODE */
200 
201 
202 #ifdef __cplusplus
203 }
204 #endif /* __cplusplus */
205 
206 #endif /* __GPHOTO2_ABILITIES_LIST_H__ */
207