From f200da9c7915521f77c6c23e825181da73db474d Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Mon, 28 Feb 2011 11:09:43 +0100 Subject: Add support for multiple cameras --- src/uca.h | 68 +++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 36 insertions(+), 32 deletions(-) (limited to 'src/uca.h') diff --git a/src/uca.h b/src/uca.h index bf0cc21..c067d9f 100644 --- a/src/uca.h +++ b/src/uca.h @@ -14,18 +14,19 @@ #include struct uca_t; +struct uca_camera_t; struct uca_property_t; /** * \brief Camera probing and initialization * \return UCA_ERR_INIT_NOT_FOUND if camera is not found or could not be initialized */ -typedef uint32_t (*uca_cam_init) (struct uca_t *uca); +typedef uint32_t (*uca_cam_init) (struct uca_camera_t **cam); /** * \brief Free camera resouces */ -typedef uint32_t (*uca_cam_destroy) (struct uca_t *uca); +typedef uint32_t (*uca_cam_destroy) (struct uca_camera_t *cam); /** * \brief Set a property @@ -33,31 +34,31 @@ typedef uint32_t (*uca_cam_destroy) (struct uca_t *uca); * \return UCA_ERR_PROP_INVALID if property is not supported on the camera or * UCA_ERR_PROP_VALUE_OUT_OF_RANGE if value cannot be set. */ -typedef uint32_t (*uca_cam_set_property) (struct uca_t *uca, int32_t property, void *data); +typedef uint32_t (*uca_cam_set_property) (struct uca_camera_t *cam, int32_t property, void *data); /** * \brief Set a property * \param[in] property_name Name of the property as defined in XXX * \return UCA_ERR_PROP_INVALID if property is not supported on the camera */ -typedef uint32_t (*uca_cam_get_property) (struct uca_t *uca, int32_t property, void *data); +typedef uint32_t (*uca_cam_get_property) (struct uca_camera_t *cam, int32_t property, void *data); /** \brief Allocate number of buffers * * The size of each buffer is width x height x bits */ -typedef uint32_t (*uca_cam_alloc) (struct uca_t *uca, uint32_t n_buffers); +typedef uint32_t (*uca_cam_alloc) (struct uca_camera_t *cam, uint32_t n_buffers); /** * \brief Acquire one frame */ -typedef uint32_t (*uca_cam_acquire_image) (struct uca_t *uca, void *buffer); +typedef uint32_t (*uca_cam_acquire_image) (struct uca_camera_t *cam, void *buffer); /** * \brief Initialize the unified camera access interface * \return Pointer to a uca_t structure */ -struct uca_t *uca_init(); +struct uca_t *uca_init(void); /** * \brief Free resources of the unified camera access interface @@ -85,7 +86,6 @@ struct uca_property_t *uca_get_full_property(int32_t property_id); /* The property IDs must start with 0 and must be continuous. Whenever this * library is released, the IDs must not change to guarantee binary compatibility! */ -#define UCA_PROP_INVALID -1 #define UCA_PROP_NAME 0 #define UCA_PROP_WIDTH 1 #define UCA_PROP_WIDTH_MIN 2 @@ -95,31 +95,29 @@ struct uca_property_t *uca_get_full_property(int32_t property_id); #define UCA_PROP_HEIGHT_MAX 6 #define UCA_PROP_X_OFFSET 7 #define UCA_PROP_Y_OFFSET 8 -#define UCA_PROP_MAX_WIDTH 9 -#define UCA_PROP_MAX_HEIGHT 10 -#define UCA_PROP_BITDEPTH 11 -#define UCA_PROP_EXPOSURE 12 -#define UCA_PROP_EXPOSURE_MIN 13 -#define UCA_PROP_EXPOSURE_MAX 14 -#define UCA_PROP_DELAY 15 -#define UCA_PROP_DELAY_MIN 16 -#define UCA_PROP_DELAY_MAX 17 -#define UCA_PROP_FRAMERATE 18 -#define UCA_PROP_TRIGGER_MODE 19 +#define UCA_PROP_BITDEPTH 9 +#define UCA_PROP_EXPOSURE 10 +#define UCA_PROP_EXPOSURE_MIN 11 +#define UCA_PROP_EXPOSURE_MAX 12 +#define UCA_PROP_DELAY 13 +#define UCA_PROP_DELAY_MIN 14 +#define UCA_PROP_DELAY_MAX 15 +#define UCA_PROP_FRAMERATE 16 +#define UCA_PROP_TRIGGER_MODE 17 /* pco.edge specific */ -#define UCA_PROP_TIMESTAMP_MODE 20 -#define UCA_PROP_SCAN_MODE 21 +#define UCA_PROP_TIMESTAMP_MODE 18 +#define UCA_PROP_SCAN_MODE 19 /* IPE camera specific */ -#define UCA_PROP_INTERLACE_SAMPLE_RATE 22 -#define UCA_PROP_INTERLACE_PIXEL_THRESH 23 -#define UCA_PROP_INTERLACE_ROW_THRESH 24 +#define UCA_PROP_INTERLACE_SAMPLE_RATE 20 +#define UCA_PROP_INTERLACE_PIXEL_THRESH 21 +#define UCA_PROP_INTERLACE_ROW_THRESH 22 /* Photon Focus specific */ -#define UCA_PROP_CORRECTION_MODE 25 +#define UCA_PROP_CORRECTION_MODE 23 -#define UCA_PROP_LAST 26 +#define UCA_PROP_LAST 24 /* Possible timestamp modes for UCA_PROP_TIMESTAMP_MODE */ #define UCA_TIMESTAMP_ASCII 0x01 @@ -156,18 +154,24 @@ struct uca_property_t { } type; }; -struct uca_t { +struct uca_camera_t { + struct uca_camera_t *next; + /* Function pointers to camera-specific methods */ - uca_cam_set_property cam_set_property; - uca_cam_get_property cam_get_property; - uca_cam_acquire_image cam_acquire_image; - uca_cam_alloc cam_alloc; + uca_cam_set_property set_property; + uca_cam_get_property get_property; + uca_cam_acquire_image acquire_image; + uca_cam_alloc alloc; /* Private */ - uca_cam_destroy cam_destroy; + uca_cam_destroy destroy; void *user; /**< private user data to be used by the camera driver */ }; +struct uca_t { + struct uca_camera_t *cameras; +}; + #endif -- cgit v1.2.3