Utility Macros

Name

Utility Macros -- 

Synopsis


#include <canon.h>


#define     IS_EOS                          (cam)
#define     CHECK_PARAM_NULL                (param)
#define     CON_CHECK_PARAM_NULL            (param)
#define     GP_PORT_DEFAULT
#define     GP_PORT_DEFAULT_RETURN          (RETVAL)
#define     GP_PORT_DEFAULT_RETURN_EMPTY
#define     GP_PORT_DEFAULT_RETURN_INTERNAL (return_statement)
enum        canonJpegMarkerCode;
enum        canonDownloadImageType;

#define     GP_MODULE

Description

Details

IS_EOS()

#define IS_EOS(cam) ((cam)==CANON_CLASS_4)

Checks whether to treat camera as an EOS model; differences in key lock/unlock, no "get picture abilities", different interrupt sequence on remote capture. Returns: 1 if camera is treated as EOS, 0 if otherwise.

Treat PS 230 as EOS just as a guess; I really don't know.

cam :

camera type from camera->pl->md->model


CHECK_PARAM_NULL()

#define     CHECK_PARAM_NULL(param)

Checks if the given parameter is NULL. If so, returns GP_ERROR_BAD_PARAMETERS from the enclosing function.

param :

value to check for NULL


CON_CHECK_PARAM_NULL()

#define     CON_CHECK_PARAM_NULL(param)

Checks if the given parameter is NULL. If so, reports through gp_context_error() (assuming that "context" is defined) and returns GP_ERROR_BAD_PARAMETERS from the enclosing function.

param :

value to check for NULL


GP_PORT_DEFAULT

#define GP_PORT_DEFAULT                GP_PORT_DEFAULT_RETURN(GP_ERROR_BAD_PARAMETERS)

Return as a default case in switch (camera->port->type) statements in functions returning a gphoto2 error code where this value of camera->port->type is unexpected.


GP_PORT_DEFAULT_RETURN()

#define GP_PORT_DEFAULT_RETURN(RETVAL) GP_PORT_DEFAULT_RETURN_INTERNAL(return RETVAL)

Return as a default case in switch (camera->port->type) statements in functions returning a value.

RETVAL :

Value to return from this function


GP_PORT_DEFAULT_RETURN_EMPTY

#define GP_PORT_DEFAULT_RETURN_EMPTY   GP_PORT_DEFAULT_RETURN_INTERNAL(return)

Return as a default case in switch (camera->port->type) statements in functions returning void.


GP_PORT_DEFAULT_RETURN_INTERNAL()

#define     GP_PORT_DEFAULT_RETURN_INTERNAL(return_statement)

Used only by GP_PORT_DEFAULT_RETURN_EMPTY(), GP_PORT_DEFAULT_RETURN(), and GP_PORT_DEFAULT()

return_statement :

Statement to use for return


enum canonJpegMarkerCode

typedef enum {
	JPEG_ESC     = 0xFF,
	JPEG_BEG     = 0xD8,
	JPEG_SOS     = 0xDB,
	JPEG_A50_SOS = 0xC4,
	JPEG_END     = 0xD9
} canonJpegMarkerCode;

Flags to find important points in JFIF or EXIF files

JPEG_ESC

Byte value to flag possible JPEG code.

JPEG_BEG

Byte value which, immediately after JPEG_ESC, marks the start of JPEG image data in a JFIF file.

JPEG_SOS

Byte value to flag a JPEG SOS marker.

JPEG_A50_SOS

Byte value to flag a JPEG SOS marker in a file from a PowerShot A50 camera.

JPEG_END

Byte code to mark the end of a JPEG image?


enum canonDownloadImageType

typedef enum {
	CANON_DOWNLOAD_THUMB = 1,
	CANON_DOWNLOAD_FULL  = 2
} canonDownloadImageType;

Codes for "Download Captured Image" command to tell the camera to download either the thumbnail or the full image for the most recently captured image.

CANON_DOWNLOAD_THUMB

Get just the thumbnail for the image

CANON_DOWNLOAD_FULL

Get the full image


GP_MODULE

#define     GP_MODULE