libgphoto2 photo camera library (libgphoto2) API 2.4.14

- Main Page
- Related Pages
- Data Structures
- Files
- Directories

- File List
- Globals

# gphoto2-filesys.h

Go to the documentation of this file.

    00001
    00029 #ifndef __GPHOTO2_FILESYS_H__
    00030 #define __GPHOTO2_FILESYS_H__
    00031
    00032 #include <time.h>
    00033
    00034 #include <gphoto2/gphoto2-context.h>
    00035 #include <gphoto2/gphoto2-list.h>
    00036 #include <gphoto2/gphoto2-file.h>
    00037
    00038 #ifdef __cplusplus
    00039 extern "C" {
    00040 #endif /* __cplusplus */
    00041
    00053 typedef enum {
    00054         GP_FILE_INFO_NONE            = 0,
    00055         GP_FILE_INFO_TYPE            = 1 << 0,
    00056         GP_FILE_INFO_NAME            = 1 << 1,
    00057         GP_FILE_INFO_SIZE            = 1 << 2,
    00058         GP_FILE_INFO_WIDTH           = 1 << 3,
    00059         GP_FILE_INFO_HEIGHT          = 1 << 4,
    00060         GP_FILE_INFO_PERMISSIONS     = 1 << 5,
    00061         GP_FILE_INFO_STATUS          = 1 << 6,
    00062         GP_FILE_INFO_MTIME           = 1 << 7,
    00063         GP_FILE_INFO_ALL             = 0xFF
    00064 } CameraFileInfoFields;
    00065
    00071 typedef enum {
    00072         GP_FILE_PERM_NONE       = 0,
    00073         GP_FILE_PERM_READ       = 1 << 0,
    00074         GP_FILE_PERM_DELETE     = 1 << 1,
    00075         GP_FILE_PERM_ALL        = 0xFF
    00076 } CameraFilePermissions;
    00077
    00083 typedef enum {
    00084         GP_FILE_STATUS_NOT_DOWNLOADED,
    00085         GP_FILE_STATUS_DOWNLOADED
    00086 } CameraFileStatus;
    00087
    00094 typedef struct _CameraFileInfoFile {
    00095         CameraFileInfoFields fields;
    00096         CameraFileStatus status;
    00097         unsigned long size;
    00098         char type[64];
    00100         unsigned int width;
    00101         unsigned int height;
    00102         char name[64];
    00103         CameraFilePermissions permissions;
    00104         time_t mtime;
    00105 } CameraFileInfoFile;
    00106
    00113 typedef struct _CameraFileInfoPreview {
    00114         CameraFileInfoFields fields;
    00115         CameraFileStatus status;
    00116         unsigned long size;
    00117         char type[64];
    00119         unsigned int width;
    00120         unsigned int height;
    00121 } CameraFileInfoPreview;
    00122
    00129 typedef struct _CameraFileInfoAudio {
    00130         CameraFileInfoFields fields;
    00131         CameraFileStatus status;
    00132         unsigned long size;
    00133         char type[64];
    00134 } CameraFileInfoAudio;
    00135
    00142 typedef struct _CameraFileInfo {
    00143         CameraFileInfoPreview preview;
    00144         CameraFileInfoFile    file;
    00145         CameraFileInfoAudio   audio;
    00146 } CameraFileInfo;
    00147
    00154 typedef enum {
    00155         GP_STORAGEINFO_BASE             = (1<<0),
    00158         GP_STORAGEINFO_LABEL            = (1<<1),
    00161         GP_STORAGEINFO_DESCRIPTION      = (1<<2),
    00162         GP_STORAGEINFO_ACCESS           = (1<<3),
    00163         GP_STORAGEINFO_STORAGETYPE      = (1<<4),
    00164         GP_STORAGEINFO_FILESYSTEMTYPE   = (1<<5),
    00165         GP_STORAGEINFO_MAXCAPACITY      = (1<<6),
    00166         GP_STORAGEINFO_FREESPACEKBYTES  = (1<<7),
    00167         GP_STORAGEINFO_FREESPACEIMAGES  = (1<<8)
    00168 } CameraStorageInfoFields;
    00169
    00176 typedef enum {
    00177         GP_STORAGEINFO_ST_UNKNOWN       = 0,
    00178         GP_STORAGEINFO_ST_FIXED_ROM     = 1,
    00179         GP_STORAGEINFO_ST_REMOVABLE_ROM = 2,
    00180         GP_STORAGEINFO_ST_FIXED_RAM     = 3,
    00181         GP_STORAGEINFO_ST_REMOVABLE_RAM = 4
    00182 } CameraStorageType;
    00183
    00190 typedef enum {
    00191         GP_STORAGEINFO_AC_READWRITE             = 0,
    00192         GP_STORAGEINFO_AC_READONLY              = 1,
    00193         GP_STORAGEINFO_AC_READONLY_WITH_DELETE  = 2
    00194 } CameraStorageAccessType;
    00195
    00202 typedef enum {
    00203         GP_STORAGEINFO_FST_UNDEFINED            = 0,
    00204         GP_STORAGEINFO_FST_GENERICFLAT          = 1,
    00205         GP_STORAGEINFO_FST_GENERICHIERARCHICAL  = 2,
    00206         GP_STORAGEINFO_FST_DCF                  = 3
    00207 } CameraStorageFilesystemType;
    00208
    00215 typedef struct _CameraStorageInformation {
    00216         CameraStorageInfoFields         fields;
    00217         char                            basedir[256];
    00218         char                            label[256];
    00219         char                            description[256];
    00220         CameraStorageType               type;
    00221         CameraStorageFilesystemType     fstype;
    00222         CameraStorageAccessType         access;
    00223         unsigned long                   capacitykbytes;
    00224         unsigned long                   freekbytes;
    00225         unsigned long                   freeimages;
    00226 } CameraStorageInformation;
    00227
    00235 typedef struct _CameraFilesystem CameraFilesystem;
    00236
    00237 int gp_filesystem_new    (CameraFilesystem **fs);
    00238 int gp_filesystem_free   (CameraFilesystem *fs);
    00239
    00240 /* Manual editing */
    00241 int gp_filesystem_append           (CameraFilesystem *fs, const char *folder,
    00242                                     const char *filename, GPContext *context);
    00243 int gp_filesystem_set_info_noop    (CameraFilesystem *fs, const char *folder,
    00244                                     CameraFileInfo info, GPContext *context);
    00245 int gp_filesystem_set_file_noop    (CameraFilesystem *fs, const char *folder,
    00246                                     CameraFile *file, GPContext *context);
    00247 int gp_filesystem_delete_file_noop (CameraFilesystem *fs, const char *folder,
    00248                                     const char *filename, GPContext *context);
    00249 int gp_filesystem_reset            (CameraFilesystem *fs);
    00250
    00251 /* Information retrieval */
    00252 int gp_filesystem_count        (CameraFilesystem *fs, const char *folder,
    00253                                 GPContext *context);
    00254 int gp_filesystem_name         (CameraFilesystem *fs, const char *folder,
    00255                                 int filenumber, const char **filename,
    00256                                 GPContext *context);
    00257 int gp_filesystem_get_folder   (CameraFilesystem *fs, const char *filename,
    00258                                 char **folder, GPContext *context);
    00259 int gp_filesystem_number       (CameraFilesystem *fs, const char *folder,
    00260                                 const char *filename, GPContext *context);
    00261
    00262 /* Listings */
    00263 typedef int (*CameraFilesystemListFunc) (CameraFilesystem *fs,
    00264                                          const char *folder, CameraList *list,
    00265                                          void *data, GPContext *context);
    00266 int gp_filesystem_set_list_funcs (CameraFilesystem *fs,
    00267                                   CameraFilesystemListFunc file_list_func,
    00268                                   CameraFilesystemListFunc folder_list_func,
    00269                                   void *data);
    00270 int gp_filesystem_list_files     (CameraFilesystem *fs, const char *folder,
    00271                                   CameraList *list, GPContext *context);
    00272 int gp_filesystem_list_folders   (CameraFilesystem *fs, const char *folder,
    00273                                   CameraList *list, GPContext *context);
    00274
    00275 /* File information */
    00276 typedef int (*CameraFilesystemSetInfoFunc) (CameraFilesystem *fs,
    00277                                             const char *folder,
    00278                                             const char *filename,
    00279                                             CameraFileInfo info, void *data,
    00280                                             GPContext *context);
    00281 typedef int (*CameraFilesystemGetInfoFunc) (CameraFilesystem *fs,
    00282                                             const char *folder,
    00283                                             const char *filename,
    00284                                             CameraFileInfo *info, void *data,
    00285                                             GPContext *context);
    00286 int gp_filesystem_set_info_funcs (CameraFilesystem *fs,
    00287                                   CameraFilesystemGetInfoFunc get_info_func,
    00288                                   CameraFilesystemSetInfoFunc set_info_func,
    00289                                   void *data);
    00290 int gp_filesystem_get_info       (CameraFilesystem *fs, const char *folder,
    00291                                   const char *filename, CameraFileInfo *info,
    00292                                   GPContext *context);
    00293 int gp_filesystem_set_info       (CameraFilesystem *fs, const char *folder,
    00294                                   const char *filename, CameraFileInfo info,
    00295                                   GPContext *context);
    00296
    00297 /* Files */
    00298 typedef int (*CameraFilesystemGetFileFunc)    (CameraFilesystem *fs,
    00299                                                const char *folder,
    00300                                                const char *filename,
    00301                                                CameraFileType type,
    00302                                                CameraFile *file, void *data,
    00303                                                GPContext *context);
    00304 typedef int (*CameraFilesystemDeleteFileFunc) (CameraFilesystem *fs,
    00305                                                const char *folder,
    00306                                                const char *filename,
    00307                                                void *data, GPContext *context);
    00308 int gp_filesystem_set_file_funcs (CameraFilesystem *fs,
    00309                                   CameraFilesystemGetFileFunc get_file_func,
    00310                                   CameraFilesystemDeleteFileFunc del_file_func,
    00311                                   void *data);
    00312 int gp_filesystem_get_file       (CameraFilesystem *fs, const char *folder,
    00313                                   const char *filename, CameraFileType type,
    00314                                   CameraFile *file, GPContext *context);
    00315 int gp_filesystem_delete_file    (CameraFilesystem *fs, const char *folder,
    00316                                   const char *filename, GPContext *context);
    00317
    00318 /* Folders */
    00319 typedef int (*CameraFilesystemPutFileFunc)   (CameraFilesystem *fs,
    00320                                               const char *folder,
    00321                                               CameraFile *file, void *data,
    00322                                               GPContext *context);
    00323 typedef int (*CameraFilesystemDeleteAllFunc) (CameraFilesystem *fs,
    00324                                               const char *folder, void *data,
    00325                                               GPContext *context);
    00326 typedef int (*CameraFilesystemDirFunc)       (CameraFilesystem *fs,
    00327                                               const char *folder,
    00328                                               const char *name, void *data,
    00329                                               GPContext *context);
    00330 int gp_filesystem_set_folder_funcs (CameraFilesystem *fs,
    00331                                   CameraFilesystemPutFileFunc put_file_func,
    00332                                   CameraFilesystemDeleteAllFunc delete_all_func,
    00333                                   CameraFilesystemDirFunc make_dir_func,
    00334                                   CameraFilesystemDirFunc remove_dir_func,
    00335                                   void *data);
    00336
    00337 typedef int (*CameraFilesystemStorageInfoFunc) (CameraFilesystem *fs,
    00338                                               CameraStorageInformation **,
    00339                                               int *nrofstorageinformations,
    00340                                               void *data, GPContext *context);
    00341
    00342 int gp_filesystem_get_storageinfo (CameraFilesystem *fs,
    00343                                    CameraStorageInformation **,
    00344                                    int *nrofstorageinformations,
    00345                                    GPContext *context);
    00346
    00347 typedef struct _CameraFilesystemFuncs CameraFilesystemFuncs;
    00348 struct _CameraFilesystemFuncs {
    00349         CameraFilesystemListFunc        file_list_func;
    00350         CameraFilesystemListFunc        folder_list_func;
    00351         CameraFilesystemPutFileFunc     put_file_func;
    00352         CameraFilesystemDeleteAllFunc   delete_all_func;
    00353         CameraFilesystemGetInfoFunc     get_info_func;
    00354         CameraFilesystemSetInfoFunc     set_info_func;
    00355         CameraFilesystemDirFunc         make_dir_func;
    00356         CameraFilesystemDirFunc         remove_dir_func;
    00357         CameraFilesystemGetFileFunc     get_file_func;
    00358         CameraFilesystemDeleteFileFunc  del_file_func;
    00359
    00360         CameraFilesystemStorageInfoFunc storage_info_func;
    00361
    00362         /* for later use. Remove one if you add a new function */
    00363         void                            *unused[31];
    00364 };
    00365 int gp_filesystem_set_funcs     (CameraFilesystem *fs,
    00366                                  CameraFilesystemFuncs *funcs,
    00367                                  void *data);
    00368 int gp_filesystem_put_file   (CameraFilesystem *fs, const char *folder,
    00369                               CameraFile *file, GPContext *context);
    00370 int gp_filesystem_delete_all (CameraFilesystem *fs, const char *folder,
    00371                               GPContext *context);
    00372 int gp_filesystem_make_dir   (CameraFilesystem *fs, const char *folder,
    00373                               const char *name, GPContext *context);
    00374 int gp_filesystem_remove_dir (CameraFilesystem *fs, const char *folder,
    00375                               const char *name, GPContext *context);
    00376
    00377 /* For debugging */
    00378 int gp_filesystem_dump         (CameraFilesystem *fs);
    00379
    00380 #ifdef __cplusplus
    00381 }
    00382 #endif /* __cplusplus */
    00383
    00384 #endif /* __GPHOTO2_FILESYS_H__ */