"Fossies" - the Fresh Open Source Software Archive 
Member "libgphoto2-2.5.27/camlibs/canon/canon.h" (4 Nov 2020, 22935 Bytes) of package /linux/privat/libgphoto2-2.5.27.tar.bz2:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "canon.h" see the
Fossies "Dox" file reference documentation and the latest
Fossies "Diffs" side-by-side code changes report:
2.5.26_vs_2.5.27.
1 /*
2 * canon.h - Canon "native" operations.
3 *
4 * Written 1999 by Wolfgang G. Reissnegger and Werner Almesberger
5 *
6 */
7
8 #ifndef _CANON_H
9 #define _CANON_H
10
11 #ifdef CANON_EXPERIMENTAL_UPLOAD
12 # ifdef __GCC__
13 # warning COMPILING WITH EXPERIMENTAL UPLOAD FEATURE
14 # endif
15 #endif
16
17 /**
18 * canonPowerStatus:
19 * @CAMERA_POWER_BAD: Value returned if power source is bad
20 * (i.e. battery is low).
21 * @CAMERA_POWER_OK: Value returned if power source is OK.
22 *
23 * Battery status values
24 *
25 */
26 typedef enum {
27 CAMERA_POWER_BAD = 4,
28 CAMERA_POWER_OK = 6
29 } canonPowerStatus;
30 /* #define CAMERA_ON_AC 16 obsolete; we now just use*/
31 /* #define CAMERA_ON_BATTERY 48 the bit that makes the difference */
32
33 /**
34 * CAMERA_MASK_BATTERY
35 *
36 * Bit mask to use to find battery/AC flag
37 *
38 */
39 #define CAMERA_MASK_BATTERY 32
40
41 /**
42 * canonJpegMarkerCode:
43 * @JPEG_ESC: Byte value to flag possible JPEG code.
44 * @JPEG_BEG: Byte value which, immediately after %JPEG_ESC, marks the start
45 * of JPEG image data in a JFIF file.
46 * @JPEG_SOS: Byte value to flag a JPEG SOS marker.
47 * @JPEG_A50_SOS: Byte value to flag a JPEG SOS marker in a file from
48 * a PowerShot A50 camera.
49 * @JPEG_END: Byte code to mark the end of a JPEG image?
50 *
51 * Flags to find important points in JFIF or EXIF files
52 *
53 */
54 typedef enum {
55 JPEG_ESC = 0xFF,
56 JPEG_A50_SOS = 0xC4,
57 JPEG_BEG = 0xD8,
58 JPEG_SOI = 0xD8,
59 JPEG_END = 0xD9,
60 JPEG_SOS = 0xDB,
61 JPEG_APP1 = 0xE1,
62 } canonJpegMarkerCode;
63
64 /**
65 * canonCamClass:
66 * @CANON_CLASS_0: does not support key lock at all.
67 * Only known models: G1, Pro 90is, S100, S110, IXUS
68 * v, IXY DIGITAL, Digital IXUS, S10, S20
69 *
70 * @CANON_CLASS_1: supports lock, but not unlock. Supports (and
71 * requires) "get picture abilities" before capture.
72 * Examples: A5, A5 Zoom, A50, S30, S40, S200, S300,
73 * S330, G2, A10, A20, A30, A40, A100, A200,
74 * Optura200/MVX2i.
75 *
76 * @CANON_CLASS_2: like class 1, but doesn't support EXIF. Pro 70
77 * is only known model.
78 *
79 * @CANON_CLASS_3: like class 1, but can't delete image. Only known models:
80 * A5, A5 Zoom.
81 *
82 * @CANON_CLASS_4: supports lock/unlock. EOS D30 was first example; others
83 * include D60, 10D, 300D, S230, S400. Doesn't support
84 * "get picture abilities".
85 *
86 * @CANON_CLASS_5: supports lock, no unlock, but not "get picture abilities".
87 * Examples: S45, G3.
88 *
89 * @CANON_CLASS_6: major protocol revision. Examples: EOS 20D and 350D.
90 *
91 * Enumeration of all camera types currently supported. Simplified so
92 * that all cameras with similar behavior have the same code.
93 *
94 */
95 typedef enum {
96 CANON_CLASS_NONE,
97 CANON_CLASS_0,
98 CANON_CLASS_1,
99 CANON_CLASS_2,
100 CANON_CLASS_3,
101 CANON_CLASS_4,
102 CANON_CLASS_5,
103 CANON_CLASS_6
104 } canonCamClass;
105
106 /**
107 * canonTransferMode:
108 * @REMOTE_CAPTURE_THUMB_TO_PC: Transfer the thumbnail to the host
109 * @REMOTE_CAPTURE_FULL_TO_PC: Transfer the full-size image directly to the host
110 * @REMOTE_CAPTURE_THUMB_TO_DRIVE: Store the thumbnail on the camera storage
111 * @REMOTE_CAPTURE_FULL_TO_DRIVE: Store the full-size image on the camera storage
112 *
113 * Hardware codes to control image transfer in a remote capture
114 * operation. These are bits that may be OR'ed together to get
115 * multiple things to happen at once. For example,
116 * @REMOTE_CAPTURE_THUMB_TO_PC|@REMOTE_CAPTURE_FULL_TO_DRIVE is what
117 * D30Capture uses to store the full image on the camera, but provide
118 * an on-screen thumbnail.
119 *
120 */
121 typedef enum {
122 REMOTE_CAPTURE_THUMB_TO_PC = 0x0001,
123 REMOTE_CAPTURE_FULL_TO_PC = 0x0002,
124 REMOTE_CAPTURE_THUMB_TO_DRIVE = 0x0004,
125 REMOTE_CAPTURE_FULL_TO_DRIVE = 0x0008
126 } canonTransferMode;
127
128 /**
129 * canonDownloadImageType:
130 * @CANON_DOWNLOAD_THUMB: Get just the thumbnail for the image
131 * @CANON_DOWNLOAD_FULL: Get the full image
132 * @CANON_DOWNLOAD_SECONDARY: Get the full secondary image
133 *
134 * Codes for "Download Captured Image" command to tell the camera to
135 * download either the thumbnail or the full image for the most
136 * recently captured image.
137 *
138 */
139 typedef enum {
140 CANON_DOWNLOAD_THUMB = 1,
141 CANON_DOWNLOAD_FULL = 2,
142 CANON_DOWNLOAD_SECONDARY = 3
143 } canonDownloadImageType;
144
145 /**
146 * CON_CHECK_PARAM_NULL
147 * @param: value to check for NULL
148 *
149 * Checks if the given parameter is NULL. If so, reports through
150 * gp_context_error() (assuming that "context" is defined) and returns
151 * %GP_ERROR_BAD_PARAMETERS from the enclosing function.
152 *
153 */
154 #define CON_CHECK_PARAM_NULL(param) \
155 if (param == NULL) { \
156 gp_context_error (context, _("NULL parameter \"%s\" in %s line %i"), #param, __FILE__, __LINE__); \
157 return GP_ERROR_BAD_PARAMETERS; \
158 }
159
160 /**
161 * CHECK_PARAM_NULL
162 * @param: value to check for NULL
163 *
164 * Checks if the given parameter is NULL. If so, returns
165 * %GP_ERROR_BAD_PARAMETERS from the enclosing function.
166 *
167 */
168 #define CHECK_PARAM_NULL(param) \
169 if (param == NULL) { \
170 gp_log (GP_LOG_ERROR, "canon/canon.h", _("NULL parameter \"%s\" in %s line %i"), #param, __FILE__, __LINE__); \
171 return GP_ERROR_BAD_PARAMETERS; \
172 }
173
174
175 /**
176 * canonCaptureSupport:
177 * @CAP_NON: No support for capture with this camera
178 * @CAP_SUP: Capture is fully supported for this camera
179 * @CAP_EXP: Capture support for this camera is experimental, i.e. it
180 * has known problems
181 *
182 * State of capture support
183 * Non-zero if any support exists, but lets caller know
184 * if support is to be trusted.
185 *
186 */
187 typedef enum {
188 CAP_NON = 0, /* no support */
189 CAP_SUP, /* supported */
190 CAP_EXP /* experimental support */
191 } canonCaptureSupport;
192
193
194 /**
195 * These ISO, shutter speed, aperture, etc. settings are correct for the
196 * EOS 5D and some for the G1; unsure about other cameras.
197 */
198 typedef enum {
199 ISO_50 = 0x40,
200 ISO_100 = 0x48,
201 ISO_125 = 0x4b,
202 ISO_160 = 0x4d,
203 ISO_200 = 0x50,
204 ISO_250 = 0x53,
205 ISO_320 = 0x55,
206 ISO_400 = 0x58,
207 ISO_500 = 0x5b,
208 ISO_640 = 0x5d,
209 ISO_800 = 0x60,
210 ISO_1000 = 0x63,
211 ISO_1250 = 0x65,
212 ISO_1600 = 0x68,
213 ISO_3200 = 0x70
214 } canonIsoState;
215
216 struct canonIsoStateStruct {
217 canonIsoState value;
218 char *label;
219 };
220
221 struct canonShootingModeStateStruct {
222 unsigned char value;
223 char *label;
224 };
225
226 typedef enum {
227 APERTURE_F1_2 = 0x0d,
228 APERTURE_F1_4 = 0x10,
229 APERTURE_F1_6 = 0x13,
230 APERTURE_F1_8 = 0x15,
231 APERTURE_F2_0 = 0x18,
232 APERTURE_F2_2 = 0x1b,
233 APERTURE_F2_5 = 0x1d,
234 APERTURE_F2_8 = 0x20,
235 APERTURE_F3_2 = 0x23,
236 APERTURE_F3_5 = 0x25,
237 APERTURE_F4_0 = 0x28,
238 APERTURE_F4_5 = 0x2b,
239 APERTURE_F5_0 = 0x2d,
240 APERTURE_F5_6 = 0x30,
241 APERTURE_F6_3 = 0x33,
242 APERTURE_F7_1 = 0x35,
243 APERTURE_F8 = 0x38,
244 APERTURE_F9 = 0x3b,
245 APERTURE_F10 = 0x3d,
246 APERTURE_F11 = 0x40,
247 APERTURE_F13 = 0x43,
248 APERTURE_F14 = 0x45,
249 APERTURE_F16 = 0x48,
250 APERTURE_F18 = 0x4b,
251 APERTURE_F20 = 0x4d,
252 APERTURE_F22 = 0x50,
253 APERTURE_F25 = 0x53,
254 APERTURE_F29 = 0x55,
255 APERTURE_F32 = 0x58,
256 } canonApertureState;
257
258 struct canonApertureStateStruct {
259 canonApertureState value;
260 char *label;
261 };
262
263 typedef enum {
264 SHUTTER_SPEED_BULB = 0x04,
265 SHUTTER_SPEED_30_SEC = 0x10,
266 SHUTTER_SPEED_25_SEC = 0x13,
267 SHUTTER_SPEED_20_SEC = 0x15,
268 SHUTTER_SPEED_15_SEC = 0x18,
269 SHUTTER_SPEED_13_SEC = 0x1b,
270 SHUTTER_SPEED_10_SEC = 0x1d,
271 SHUTTER_SPEED_8_SEC = 0x20,
272 SHUTTER_SPEED_6_SEC = 0x23,
273 SHUTTER_SPEED_5_SEC = 0x25,
274 SHUTTER_SPEED_4_SEC = 0x28,
275 SHUTTER_SPEED_3_2_SEC = 0x2b,
276 SHUTTER_SPEED_2_5_SEC = 0x2d,
277 SHUTTER_SPEED_2_SEC = 0x30,
278 SHUTTER_SPEED_1_6_SEC = 0x32,
279 SHUTTER_SPEED_1_3_SEC = 0x35,
280 SHUTTER_SPEED_1_SEC = 0x38,
281 SHUTTER_SPEED_0_8_SEC = 0x3b,
282 SHUTTER_SPEED_0_6_SEC = 0x3d,
283 SHUTTER_SPEED_0_5_SEC = 0x40,
284 SHUTTER_SPEED_0_4_SEC = 0x43,
285 SHUTTER_SPEED_0_3_SEC = 0x45,
286 SHUTTER_SPEED_1_4 = 0x48,
287 SHUTTER_SPEED_1_5 = 0x4b,
288 SHUTTER_SPEED_1_6 = 0x4d,
289 SHUTTER_SPEED_1_8 = 0x50,
290 SHUTTER_SPEED_1_10 = 0x53,
291 SHUTTER_SPEED_1_13 = 0x55,
292 SHUTTER_SPEED_1_15 = 0x58,
293 SHUTTER_SPEED_1_20 = 0x5b,
294 SHUTTER_SPEED_1_25 = 0x5d,
295 SHUTTER_SPEED_1_30 = 0x60,
296 SHUTTER_SPEED_1_40 = 0x63,
297 SHUTTER_SPEED_1_50 = 0x65,
298 SHUTTER_SPEED_1_60 = 0x68,
299 SHUTTER_SPEED_1_80 = 0x6b,
300 SHUTTER_SPEED_1_100 = 0x6d,
301 SHUTTER_SPEED_1_125 = 0x70,
302 SHUTTER_SPEED_1_160 = 0x73,
303 SHUTTER_SPEED_1_200 = 0x75,
304 SHUTTER_SPEED_1_250 = 0x78,
305 SHUTTER_SPEED_1_320 = 0x7b,
306 SHUTTER_SPEED_1_400 = 0x7d,
307 SHUTTER_SPEED_1_500 = 0x80,
308 SHUTTER_SPEED_1_640 = 0x83,
309 SHUTTER_SPEED_1_800 = 0x85,
310 SHUTTER_SPEED_1_1000 = 0x88,
311 SHUTTER_SPEED_1_1250 = 0x8b,
312 SHUTTER_SPEED_1_1600 = 0x8d,
313 SHUTTER_SPEED_1_2000 = 0x90,
314 SHUTTER_SPEED_1_2500 = 0x93,
315 SHUTTER_SPEED_1_3200 = 0x95,
316 SHUTTER_SPEED_1_4000 = 0x98,
317 SHUTTER_SPEED_1_5000 = 0x9a,
318 SHUTTER_SPEED_1_6400 = 0x9d,
319 SHUTTER_SPEED_1_8000 = 0xA0
320 } canonShutterSpeedState;
321
322 struct canonShutterSpeedStateStruct {
323 canonShutterSpeedState value;
324 char *label;
325 };
326
327 typedef enum {
328 IMAGE_FORMAT_RAW = 0,
329 IMAGE_FORMAT_RAW_2,
330 IMAGE_FORMAT_RAW_AND_LARGE_FINE_JPEG,
331 IMAGE_FORMAT_RAW_AND_LARGE_NORMAL_JPEG,
332 IMAGE_FORMAT_RAW_AND_MEDIUM_FINE_JPEG,
333 IMAGE_FORMAT_RAW_AND_MEDIUM_NORMAL_JPEG,
334 IMAGE_FORMAT_RAW_AND_SMALL_FINE_JPEG,
335 IMAGE_FORMAT_RAW_AND_SMALL_NORMAL_JPEG,
336 IMAGE_FORMAT_LARGE_FINE_JPEG,
337 IMAGE_FORMAT_LARGE_NORMAL_JPEG,
338 IMAGE_FORMAT_MEDIUM_FINE_JPEG,
339 IMAGE_FORMAT_MEDIUM_NORMAL_JPEG,
340 IMAGE_FORMAT_SMALL_FINE_JPEG,
341 IMAGE_FORMAT_SMALL_NORMAL_JPEG
342 } canonImageFormatState;
343
344
345 struct canonImageFormatStateStruct {
346 canonImageFormatState value;
347 char *label;
348 unsigned char res_byte1;
349 unsigned char res_byte2;
350 unsigned char res_byte3;
351 };
352
353 typedef enum {
354 AUTO_FOCUS_ONE_SHOT = 0,
355 AUTO_FOCUS_AI_SERVO,
356 AUTO_FOCUS_AI_FOCUS,
357 MANUAL_FOCUS
358 } canonFocusModeState;
359
360 struct canonFocusModeStateStruct {
361 canonFocusModeState value;
362 char *label;
363 };
364
365 /**
366 * canonFlashMode:
367 * @FLASH_MODE_OFF: The flash does not fire
368 * @FLASH_MODE_ON: The flash does fire (compulsory)
369 * @FLASH_MODE_AUTO: The flash fires if necessary
370 */
371 typedef enum {
372 FLASH_MODE_OFF = 0,
373 FLASH_MODE_ON,
374 FLASH_MODE_AUTO
375 } canonFlashMode;
376
377 struct canonFlashModeStateStruct {
378 canonFlashMode value;
379 char* label;
380 };
381
382 /**
383 * canonBeepMode:
384 * @BEEP_OFF: The camera does not beep after focusing the image
385 * @BEEP_ON: The camera emits an audible beep after focusing the image
386 */
387 typedef enum {
388 BEEP_OFF = 0x00,
389 BEEP_ON = 0x01
390 } canonBeepMode;
391
392 struct canonBeepModeStateStruct {
393 canonBeepMode value;
394 char* label;
395 };
396
397 struct canonZoomLevelStateStruct {
398 unsigned char value;
399 char* label;
400 };
401
402 struct canonExposureBiasStateStruct {
403 unsigned char valueEOS;
404 unsigned char valuePS;
405 char* label;
406 };
407
408
409 /* Size of the release parameter block */
410 #define RELEASE_PARAMS_LEN 0x2f
411
412 /* These indexes are byte offsets into the release parameter data */
413 #define IMAGE_FORMAT_1_INDEX 0x01
414 #define IMAGE_FORMAT_2_INDEX 0x02
415 #define IMAGE_FORMAT_3_INDEX 0x03
416 #define SELF_TIMER_1_INDEX 0x04 /* Currently not used */
417 #define SELF_TIMER_2_INDEX 0x05 /* Currently not used */
418 #define FLASH_INDEX 0x06
419 #define BEEP_INDEX 0x07
420 #define FOCUS_MODE_INDEX 0x12
421 #define ISO_INDEX 0x1a
422 #define APERTURE_INDEX 0x1c
423 #define SHUTTERSPEED_INDEX 0x1e
424 #define EXPOSUREBIAS_INDEX 0x20
425 #define SHOOTING_MODE_INDEX 0x08
426
427 /**
428 * canonCaptureSizeClass:
429 * @CAPTURE_COMPATIBILITY: operate in the traditional gphoto2 mode
430 * @CAPTURE_THUMB: capture thumbnails
431 * @CAPTURE_FULL_IMAGES: capture full-sized images
432 *
433 * By default (CAPTURE_COMPATIBILITY mode), the driver will capture
434 * thumbnails to the host computer in capture_preview, and full-sized
435 * images to the camera's drive in capture_image.
436 * CAPTURE_FULL_IMAGE will capture a full-sized image to the host
437 * computer in capture_preview, or to the camera's drive in capture_image.
438 * CAPTURE_THUMB is likewise intended to capture thumbnails to either
439 * the host computer or to the camera's drive, although these modes do not
440 * seem to work right now.
441 *
442 */
443 typedef enum {
444 CAPTURE_COMPATIBILITY = 1,
445 CAPTURE_THUMB,
446 CAPTURE_FULL_IMAGE
447 } canonCaptureSizeClass;
448
449 struct canonCaptureSizeClassStruct {
450 canonCaptureSizeClass value;
451 char *label;
452 };
453
454 struct canonCamModelData
455 {
456 char *id_str;
457 canonCamClass model;
458 unsigned short usb_vendor;
459 unsigned short usb_product;
460 canonCaptureSupport usb_capture_support;
461 /* these three constants aren't used properly */
462 unsigned int max_movie_size;
463 unsigned int max_thumbnail_size;
464 unsigned int max_picture_size;
465 char *serial_id_string; /* set to NULL if camera doesn't support serial connections */
466 };
467
468 extern const struct canonCamModelData models[];
469
470 struct _CameraPrivateLibrary
471 {
472 struct canonCamModelData *md;
473 int speed; /* The speed we're using for this camera */
474 char ident[32]; /* Model ID string given by the camera */
475 char owner[32]; /* Owner name */
476 char firmwrev[4]; /* Firmware revision */
477 unsigned char psa50_eot[8];
478
479 int receive_error; /* status of transfer on serial connection */
480 int first_init; /* first use of camera 1 = yes 0 = no */
481 int uploading; /* 1 = yes ; 0 = no */
482 int slow_send; /* to send data via serial with a usleep(1)
483 * between each byte 1 = yes ; 0 = no */
484
485 unsigned char seq_tx;
486 unsigned char seq_rx;
487
488 /* driver settings
489 * leave these as int, as gp_widget_get_value sets them as int!
490 */
491 int list_all_files; /* whether to list all files, not just know types */
492
493 int upload_keep_filename; /* 0=DCIF compatible filenames (AUT_*),
494 1=keep original filename */
495
496 char *cached_drive; /* usually something like C: */
497 int cached_ready; /* whether the camera is ready to rock */
498
499 unsigned char *directory_state; /* directory content state for wait_for_event */
500
501 long image_key, thumb_length, image_length; /* For immediate download of captured image */
502 long image_b_key, image_b_length; /* For immediate download of secondary captured image */
503 int capture_step; /* To record progress in interrupt
504 * reads from capture */
505 int transfer_mode; /* To remember what interrupt messages
506 are expected during capture from
507 newer cameras. */
508 int keys_locked; /* whether the keys are currently
509 locked out */
510 unsigned int xfer_length; /* Length of max transfer for
511 download */
512
513 int remote_control; /* is the camera currently under USB control? */
514
515 canonCaptureSizeClass capture_size; /* Size class for remote-
516 captured images */
517
518 unsigned int body_id; /* hardware serial number for some cameras */
519
520 unsigned char release_params[RELEASE_PARAMS_LEN]; /* "Release
521 parameters:"
522 ISO, aperture,
523 etc */
524
525 int secondary_image; /* Should we attempt to download a
526 secondary image? (e.g., RAW + JPEG) */
527
528 /*
529 * Directory access may be rather expensive, so we cached some information.
530 * This is now done by libgphoto2, so we are continuously removing this stuff.
531 * So the following variables are OBSOLETE.
532 */
533
534 int cached_disk;
535 int cached_capacity;
536 int cached_available;
537 };
538
539 /**
540 * canonDirentOffset:
541 * @CANON_DIRENT_ATTRS: Attribute byte
542 * @CANON_DIRENT_SIZE: 4 byte file size
543 * @CANON_DIRENT_TIME: 4 byte Unix time
544 * @CANON_DIRENT_NAME: Variable length ASCII path name
545 * @CANON_MINIMUM_DIRENT_SIZE: Minimum size of a directory entry,
546 * including a null byte for an empty path name
547 *
548 * Offsets of fields of direntry in bytes.
549 * A minimum directory entry is:
550 * 2 bytes attributes,
551 * 4 bytes file date (UNIX localtime),
552 * 4 bytes file size,
553 * 1 byte empty path '' plus NULL byte.
554 *
555 * Wouldn't this be better as a struct?
556 *
557 */
558 typedef enum {
559 CANON_DIRENT_ATTRS = 0,
560 CANON_DIRENT_SIZE = 2,
561 CANON_DIRENT_TIME = 6,
562 CANON_DIRENT_NAME = 10,
563 CANON_MINIMUM_DIRENT_SIZE
564 } canonDirentOffset;
565
566 /**
567 * canonDirentAttributeBits:
568 * @CANON_ATTR_WRITE_PROTECTED: File is write-protected
569 * @CANON_ATTR_UNKNOWN_2:
570 * @CANON_ATTR_UNKNOWN_4:
571 * @CANON_ATTR_UNKNOWN_8:
572 * @CANON_ATTR_NON_RECURS_ENT_DIR: This entry represents a directory
573 * that was not entered in this listing.
574 * @CANON_ATTR_NOT_DOWNLOADED: This file has not yet been downloaded
575 * (the bit is cleared by the host software).
576 * @CANON_ATTR_UNKNOWN_40:
577 * @CANON_ATTR_RECURS_ENT_DIR: This entry represents a directory
578 * that was entered in this listing; look for its contents
579 * later in the listing.
580 *
581 * Attribute bits in the %CANON_DIRENT_ATTRS byte in each directory
582 * entry.
583 *
584 */
585
586 typedef enum {
587 CANON_ATTR_WRITE_PROTECTED = 0x01,
588 CANON_ATTR_UNKNOWN_2 = 0x02,
589 CANON_ATTR_UNKNOWN_4 = 0x04,
590 CANON_ATTR_UNKNOWN_8 = 0x08,
591 CANON_ATTR_NON_RECURS_ENT_DIR = 0x10,
592 CANON_ATTR_NOT_DOWNLOADED = 0x20,
593 CANON_ATTR_UNKNOWN_40 = 0x40,
594 CANON_ATTR_RECURS_ENT_DIR = 0x80
595 } canonDirentAttributeBits;
596
597 /**
598 * canonDirlistFunctionBits:
599 * @CANON_LIST_FILES: List files
600 * @CANON_LIST_FOLDERS: List folders
601 *
602 * Software bits to pass in "flags" argument to
603 * canon_int_list_directory(), telling what to list. Bits may be ORed
604 * together to list both files and folders.
605 *
606 */
607 typedef enum {
608 CANON_LIST_FILES = 2,
609 CANON_LIST_FOLDERS = 4
610 } canonDirlistFunctionBits;
611
612 /**
613 * canonDirFunctionCode:
614 * @DIR_CREATE: Create the specified directory
615 * @DIR_REMOVE: Remove the specified directory
616 *
617 * Software code to pass to canon_int_directory_operations().
618 *
619 */
620 typedef enum {
621 DIR_CREATE = 0,
622 DIR_REMOVE = 1
623 } canonDirFunctionCode;
624
625 /* These macros contain the default label for all the
626 * switch (camera->port->type) statements
627 */
628
629 /**
630 * GP_PORT_DEFAULT_RETURN_INTERNAL:
631 * @return_statement: Statement to use for return
632 *
633 * Used only by GP_PORT_DEFAULT_RETURN_EMPTY(),
634 * GP_PORT_DEFAULT_RETURN(), and GP_PORT_DEFAULT()
635 *
636 */
637 #define GP_PORT_DEFAULT_RETURN_INTERNAL(return_statement) \
638 default: \
639 gp_context_error (context, _("Don't know how to handle " \
640 "camera->port->type value %i aka 0x%x " \
641 "in %s line %i."), camera->port->type, \
642 camera->port->type, __FILE__, __LINE__); \
643 return_statement; \
644 break;
645
646 /**
647 * GP_PORT_DEFAULT_RETURN_EMPTY:
648 *
649 * Return as a default case in switch (camera->port->type)
650 * statements in functions returning void.
651 *
652 */
653 #define GP_PORT_DEFAULT_RETURN_EMPTY GP_PORT_DEFAULT_RETURN_INTERNAL(return)
654 /**
655 * GP_PORT_DEFAULT_RETURN
656 * @RETVAL: Value to return from this function
657 *
658 * Return as a default case in switch (camera->port->type)
659 * statements in functions returning a value.
660 *
661 */
662 #define GP_PORT_DEFAULT_RETURN(RETVAL) GP_PORT_DEFAULT_RETURN_INTERNAL(return RETVAL)
663
664 /**
665 * GP_PORT_DEFAULT
666 *
667 * Return as a default case in switch (camera->port->type) statements
668 * in functions returning a gphoto2 error code where this value of
669 * camera->port->type is unexpected.
670 *
671 */
672 #define GP_PORT_DEFAULT GP_PORT_DEFAULT_RETURN(GP_ERROR_BAD_PARAMETERS)
673
674 /*
675 * All functions returning a pointer have malloc'ed the data. The caller must
676 * free() it when done.
677 */
678
679 int canon_int_ready(Camera *camera, GPContext *context);
680
681 char *canon_int_get_disk_name(Camera *camera, GPContext *context);
682
683 int canon_int_get_battery(Camera *camera, int *pwr_status, int *pwr_source, GPContext *context);
684
685 int canon_int_capture_image (Camera *camera, CameraFilePath *path, GPContext *context);
686 int canon_int_capture_preview (Camera *camera, unsigned char **data, unsigned int *length,
687 GPContext *context);
688
689 int canon_int_get_disk_name_info(Camera *camera, const char *name,int *capacity,int *available, GPContext *context);
690
691 int canon_int_list_directory (Camera *camera, const char *folder, CameraList *list, const canonDirlistFunctionBits flags, GPContext *context);
692 int canon_int_get_info_func (Camera *camera, const char *folder, const char *filename, CameraFileInfo * info, GPContext *context);
693
694 int canon_int_get_file(Camera *camera, const char *name, unsigned char **data, unsigned int *length, GPContext *context);
695 int canon_int_get_thumbnail(Camera *camera, const char *name, unsigned char **retdata, unsigned int *length, GPContext *context);
696 int canon_int_put_file(Camera *camera, CameraFile *file, const char *filename, const char *destname, const char *destpath, GPContext *context);
697 int canon_int_wait_for_event (Camera *camera, int timeout, CameraEventType *eventtype, void **eventdata, GPContext *context);
698 int canon_int_set_file_attributes(Camera *camera, const char *file, const char *dir, canonDirentAttributeBits attrs, GPContext *context);
699 int canon_int_delete_file(Camera *camera, const char *name, const char *dir, GPContext *context);
700 int canon_int_set_shutter_speed(Camera *camera, canonShutterSpeedState shutter_speed, GPContext *context);
701 int canon_int_set_iso(Camera *camera, canonIsoState iso, GPContext *context);
702 int canon_int_set_shooting_mode (Camera *camera, unsigned char shooting_mode, GPContext *context);
703 int canon_int_set_aperture(Camera *camera, canonApertureState aperture, GPContext *context);
704 int canon_int_set_exposurebias(Camera *camera, unsigned char expbias, GPContext *context);
705 int canon_int_set_focus_mode (Camera *camera, canonFocusModeState focus_mode, GPContext *context);
706 int canon_int_set_image_format (Camera *camera, unsigned char res_byte1, unsigned char res_byte2, unsigned char res_byte3, GPContext *context);
707 int canon_serial_off(Camera *camera);
708 int canon_int_get_time(Camera *camera, time_t *camera_time, GPContext *context);
709 int canon_int_set_time(Camera *camera, time_t date, GPContext *context);
710 int canon_int_directory_operations(Camera *camera, const char *path, canonDirFunctionCode action, GPContext *context);
711 int canon_int_identify_camera(Camera *camera, GPContext *context);
712 int canon_int_set_owner_name(Camera *camera, const char *name, GPContext *context);
713 int canon_int_start_remote_control(Camera *camera, GPContext *context);
714 int canon_int_end_remote_control(Camera *camera, GPContext *context);
715 int canon_int_set_beep(Camera *camera, canonBeepMode beep_mode, GPContext *context);
716 int canon_int_set_flash(Camera *camera, canonFlashMode flash_mode, GPContext *context);
717 int canon_int_set_zoom(Camera *camera, unsigned char zoom_level, GPContext *context);
718 int canon_int_get_zoom(Camera *camera, unsigned char *zoom_level, unsigned char *zoom_max, GPContext *context);
719
720 /*
721 * introduced for capturing
722 */
723 int canon_int_get_release_params (Camera *camera, GPContext *context);
724
725 void canon_int_find_new_image ( Camera *camera, unsigned char *initial_state, unsigned char *final_state, CameraFilePath *path );
726
727
728 /* path conversion - needs drive letter, and therefore cannot be moved
729 * to util.c */
730 const char *gphoto2canonpath(Camera *camera, const char *path, GPContext *context);
731
732 const char *canon_int_filename2thumbname (Camera *camera, const char *filename);
733 const char *canon_int_filename2audioname (Camera *camera, const char *filename);
734
735 int canon_int_extract_jpeg_thumb (unsigned char *data, const unsigned int datalen, unsigned char **retdata, unsigned int *retdatalen, GPContext *context);
736
737 /* for the macros abbreviating gp_log* */
738 #define GP_MODULE "canon"
739
740 #endif /* _CANON_H */
741
742 /*
743 * Local Variables:
744 * c-file-style:"linux"
745 * indent-tabs-mode:t
746 * End:
747 */