![]() | ![]() | ![]() | The Canon driver reference | ![]() |
---|
#include <canon.h> int canon_int_directory_operations (Camera *camera, const char *path, canonDirFunctionCode action, GPContext *context); enum canonDirFunctionCode; int canon_int_list_directory (Camera *camera, const char *folder, CameraList *list, const canonDirlistFunctionBits flags, GPContext *context); enum canonDirlistFunctionBits;
int canon_int_directory_operations (Camera *camera, const char *path, canonDirFunctionCode action, GPContext *context);
Creates or removes a directory in camera storage.
camera : | Camera to work on |
path : | Path to directory on which to operate |
action : | canonDirFunctionCode (either DIR_CREATE or DIR_REMOVE) |
context : | context for error reporting |
Returns : | gphoto2 status code. GP_OK on success, otherwise status from canon_serial_error(), GP_ERROR if USB operation fails, GP_ERROR_CORRUPTED_DATA if the camera response is not the expected length, GP_ERROR_BAD_PARAMETERS if action is invalid. |
typedef enum { DIR_CREATE = 0, DIR_REMOVE = 1 } canonDirFunctionCode;
Software code to pass to canon_int_directory_operations().
DIR_CREATE | Create the specified directory |
DIR_REMOVE | Remove the specified directory |
int canon_int_list_directory (Camera *camera, const char *folder, CameraList *list, const canonDirlistFunctionBits flags, GPContext *context);
Gets the directory tree of a given flash device, unsorted and with a few missing features (such as correct sorting of files and correctly associating files with each other).
Implicitly assumes that uint8_t[] is a char[] for strings.
A few notes about listing files and camera->pl->list_all_files:
If camera->pl->list_all_files is false (intended default), then we list only "primary files" or ("main" files). Those are files like image files or movie files which the user explicitly created on the camera. "Secondary files" such as .thm files which contain the thumbnail of a movie are not listed here - you can get them using the --get-thumbnail command in gphoto2 or the analog command of your frontend. Same story with ,wav files containing audio annotations to primary files.
If camera->pl->list_all_files is true (can be changed via the configuration interface), then we list _all_ files. This means that we just use the camera like a CF/SD card reader. Use this mode to read/write your .pdf files, .tgz backup tarballs, or whatever. Of course, all the "internal" files the camera puts on the storage medium will be listed in this mode as well.
camera : | Camera to access |
folder : | Folder on the camera to list |
list : | Returns list of folders in this directory |
flags : | canonDirlistFunctionBits specifying to list files, folders, or both |
context : | context for error reporting |
Returns : | a gphoto2 status code. list will contain a list of folders (directories) contained in this folder. Files will be added to the internal gphoto2 file system only if they are image or movie files. |
typedef enum { CANON_LIST_FILES = 2, CANON_LIST_FOLDERS = 4 } canonDirlistFunctionBits;
Software bits to pass in "flags" argument to canon_int_list_directory(), telling what to list. Bits may be ORed together to list both files and folders.
CANON_LIST_FILES | List files |
CANON_LIST_FOLDERS | List folders |
<<< Handling Camera Directories | Directory Entries >>> |