libgphoto2 photo camera library (libgphoto2) API  2.5.2
gphoto2-filesys.h
Go to the documentation of this file.
1 
30 #ifndef __GPHOTO2_FILESYS_H__
31 #define __GPHOTO2_FILESYS_H__
32 
33 #include <time.h>
34 #include <stdint.h>
35 
37 #include <gphoto2/gphoto2-list.h>
38 #include <gphoto2/gphoto2-file.h>
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif /* __cplusplus */
43 
55 typedef enum {
57  GP_FILE_INFO_TYPE = 1 << 0,
58  GP_FILE_INFO_SIZE = 1 << 2,
59  GP_FILE_INFO_WIDTH = 1 << 3,
63  GP_FILE_INFO_MTIME = 1 << 7,
66 
72 typedef enum {
74  GP_FILE_PERM_READ = 1 << 0,
78 
84 typedef enum {
88 
95 typedef struct _CameraFileInfoFile {
98  uint64_t size;
99  char type[64];
100  uint32_t width;
101  uint32_t height;
103  time_t mtime;
105 
112 typedef struct _CameraFileInfoPreview {
115  uint64_t size;
116  char type[64];
118  uint32_t width;
119  uint32_t height;
121 
128 typedef struct _CameraFileInfoAudio {
131  uint64_t size;
132  char type[64];
134 
141 typedef struct _CameraFileInfo {
142  CameraFileInfoPreview preview;
143  CameraFileInfoFile file;
144  CameraFileInfoAudio audio;
146 
153 typedef enum {
168 
175 typedef enum {
182 
189 typedef enum {
194 
201 typedef enum {
207 
216  char basedir[256];
217  char label[256];
218  char description[256];
222  uint64_t capacitykbytes;
223  uint64_t freekbytes;
224  uint64_t freeimages;
226 
235 
238 
239 /* Manual editing */
240 int gp_filesystem_append (CameraFilesystem *fs, const char *folder,
241  const char *filename, GPContext *context);
243  const char *folder, const char *filename,
244  CameraFileInfo info, GPContext *context);
246  const char *folder, const char *filename,
247  CameraFileType type,
248  CameraFile *file, GPContext *context);
249 int gp_filesystem_delete_file_noop (CameraFilesystem *fs, const char *folder,
250  const char *filename, GPContext *context);
252 
253 /* Information retrieval */
254 int gp_filesystem_count (CameraFilesystem *fs, const char *folder,
255  GPContext *context);
256 int gp_filesystem_name (CameraFilesystem *fs, const char *folder,
257  int filenumber, const char **filename,
258  GPContext *context);
259 int gp_filesystem_get_folder (CameraFilesystem *fs, const char *filename,
260  char **folder, GPContext *context);
261 int gp_filesystem_number (CameraFilesystem *fs, const char *folder,
262  const char *filename, GPContext *context);
263 
264 /* Listings */
265 typedef int (*CameraFilesystemListFunc) (CameraFilesystem *fs,
266  const char *folder, CameraList *list,
267  void *data, GPContext *context);
268 int gp_filesystem_list_files (CameraFilesystem *fs, const char *folder,
269  CameraList *list, GPContext *context);
270 int gp_filesystem_list_folders (CameraFilesystem *fs, const char *folder,
271  CameraList *list, GPContext *context);
272 
273 /* File information */
274 typedef int (*CameraFilesystemSetInfoFunc) (CameraFilesystem *fs,
275  const char *folder,
276  const char *filename,
277  CameraFileInfo info, void *data,
278  GPContext *context);
279 typedef int (*CameraFilesystemGetInfoFunc) (CameraFilesystem *fs,
280  const char *folder,
281  const char *filename,
282  CameraFileInfo *info, void *data,
283  GPContext *context);
284 int gp_filesystem_get_info (CameraFilesystem *fs, const char *folder,
285  const char *filename, CameraFileInfo *info,
286  GPContext *context);
287 int gp_filesystem_set_info (CameraFilesystem *fs, const char *folder,
288  const char *filename, CameraFileInfo info,
289  GPContext *context);
290 
291 /* Files */
292 typedef int (*CameraFilesystemGetFileFunc) (CameraFilesystem *fs,
293  const char *folder,
294  const char *filename,
295  CameraFileType type,
296  CameraFile *file, void *data,
297  GPContext *context);
298 typedef int (*CameraFilesystemReadFileFunc) (CameraFilesystem *fs,
299  const char *folder,
300  const char *filename,
301  CameraFileType type,
302  uint64_t offset,
303  char *buf,
304  uint64_t *size,
305  void *data,
306  GPContext *context);
307 typedef int (*CameraFilesystemDeleteFileFunc) (CameraFilesystem *fs,
308  const char *folder,
309  const char *filename,
310  void *data, GPContext *context);
311 int gp_filesystem_get_file (CameraFilesystem *fs, const char *folder,
312  const char *filename, CameraFileType type,
313  CameraFile *file, GPContext *context);
314 int gp_filesystem_read_file (CameraFilesystem *fs, const char *folder,
315  const char *filename, CameraFileType type,
316  uint64_t offset, char *buf, uint64_t *size,
317  GPContext *context);
318 int gp_filesystem_delete_file (CameraFilesystem *fs, const char *folder,
319  const char *filename, GPContext *context);
320 
321 /* Folders */
322 typedef int (*CameraFilesystemPutFileFunc) (CameraFilesystem *fs,
323  const char *folder,
324  const char *filename,
325  CameraFileType type,
326  CameraFile *file,
327  void *data,
328  GPContext *context);
329 typedef int (*CameraFilesystemDeleteAllFunc) (CameraFilesystem *fs,
330  const char *folder, void *data,
331  GPContext *context);
332 typedef int (*CameraFilesystemDirFunc) (CameraFilesystem *fs,
333  const char *folder,
334  const char *name, void *data,
335  GPContext *context);
336 
337 typedef int (*CameraFilesystemStorageInfoFunc) (CameraFilesystem *fs,
339  int *nrofstorageinformations,
340  void *data, GPContext *context);
341 
343  CameraStorageInformation **,
344  int *nrofstorageinformations,
345  GPContext *context);
346 
349  CameraFilesystemListFunc file_list_func;
350  CameraFilesystemListFunc folder_list_func;
351  CameraFilesystemPutFileFunc put_file_func;
352  CameraFilesystemDeleteAllFunc delete_all_func;
353  CameraFilesystemGetInfoFunc get_info_func;
354  CameraFilesystemSetInfoFunc set_info_func;
355  CameraFilesystemDirFunc make_dir_func;
356  CameraFilesystemDirFunc remove_dir_func;
357  CameraFilesystemGetFileFunc get_file_func;
358  CameraFilesystemReadFileFunc read_file_func;
359  CameraFilesystemDeleteFileFunc del_file_func;
360  CameraFilesystemStorageInfoFunc storage_info_func;
361 
362  /* for later use. Remove one if you add a new function */
363  void *unused[31];
364 };
366  CameraFilesystemFuncs *funcs,
367  void *data);
368 int gp_filesystem_put_file (CameraFilesystem *fs, const char *folder, const char *filename,
369  CameraFileType type, CameraFile *file, GPContext *context);
370 int gp_filesystem_delete_all (CameraFilesystem *fs, const char *folder,
371  GPContext *context);
372 int gp_filesystem_make_dir (CameraFilesystem *fs, const char *folder,
373  const char *name, GPContext *context);
374 int gp_filesystem_remove_dir (CameraFilesystem *fs, const char *folder,
375  const char *name, GPContext *context);
376 
377 /* For debugging */
379 
380 #ifdef __cplusplus
381 }
382 #endif /* __cplusplus */
383 
384 #endif /* __GPHOTO2_FILESYS_H__ */