diff options
author | Matthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de> | 2011-02-28 11:40:23 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de> | 2011-02-28 11:40:23 +0100 |
commit | 31a9401a4c18fea613d8a508583dd657c41c384c (patch) | |
tree | 8cd16831d3d6695dbca0b5865f1f5079c8fce39c | |
parent | 49cf589ca2fdcbd9ff55ae70040d6d52c57a3fb1 (diff) | |
download | uca-31a9401a4c18fea613d8a508583dd657c41c384c.tar.gz uca-31a9401a4c18fea613d8a508583dd657c41c384c.tar.bz2 uca-31a9401a4c18fea613d8a508583dd657c41c384c.tar.xz uca-31a9401a4c18fea613d8a508583dd657c41c384c.zip |
Turn property defines into enum
-rw-r--r-- | src/cameras/uca_pco.c | 10 | ||||
-rw-r--r-- | src/uca.c | 6 | ||||
-rw-r--r-- | src/uca.h | 77 |
3 files changed, 48 insertions, 45 deletions
diff --git a/src/cameras/uca_pco.c b/src/cameras/uca_pco.c index 8a89fa0..cd727b9 100644 --- a/src/cameras/uca_pco.c +++ b/src/cameras/uca_pco.c @@ -58,7 +58,7 @@ static uint32_t uca_pco_destroy(struct uca_camera_t *cam) return UCA_NO_ERROR; } -static uint32_t uca_pco_set_property(struct uca_camera_t *cam, int32_t property, void *data) +static uint32_t uca_pco_set_property(struct uca_camera_t *cam, enum uca_property_ids property, void *data) { switch (property) { case UCA_PROP_WIDTH: @@ -94,7 +94,7 @@ static uint32_t uca_pco_set_property(struct uca_camera_t *cam, int32_t property, } -static uint32_t uca_pco_get_property(struct uca_camera_t *cam, int32_t property, void *data) +static uint32_t uca_pco_get_property(struct uca_camera_t *cam, enum uca_property_ids property, void *data) { struct pco_edge_t *pco = GET_PCO(cam); @@ -201,7 +201,6 @@ uint32_t uca_pco_init(struct uca_camera_t **cam) struct uca_camera_t *uca = (struct uca_camera_t *) malloc(sizeof(struct uca_camera_t)); uca->user = pco_cam; - *cam = uca; /* Camera found, set function pointers... */ uca->destroy = &uca_pco_destroy; @@ -238,7 +237,8 @@ uint32_t uca_pco_init(struct uca_camera_t **cam) Fg_setParameter(fg, FG_WIDTH, &width, PORT_A); Fg_setParameter(fg, FG_HEIGHT, &height, PORT_A); - pco_set_rec_state(pco, 1); + uca->state = UCA_CAM_CONFIGURABLE; + *cam = uca; - return 0; + return UCA_NO_ERROR; } @@ -112,7 +112,7 @@ static struct uca_property_t property_map[UCA_PROP_LAST+1] = { { NULL, 0, 0 } }; -int32_t uca_get_property_id(const char *property_name) +enum uca_property_ids uca_get_property_id(const char *property_name) { char *name; int i = 0; @@ -124,14 +124,14 @@ int32_t uca_get_property_id(const char *property_name) return UCA_ERR_PROP_INVALID; } -struct uca_property_t *uca_get_full_property(int32_t property_id) +struct uca_property_t *uca_get_full_property(enum uca_property_ids property_id) { if ((property_id >= 0) && (property_id < UCA_PROP_LAST)) return &property_map[property_id]; return NULL; } -const char* uca_get_property_name(int32_t property_id) +const char* uca_get_property_name(enum uca_property_ids property_id) { if ((property_id >= 0) && (property_id < UCA_PROP_LAST)) return property_map[property_id].name; @@ -18,6 +18,7 @@ struct uca_camera_t; struct uca_property_t; enum uca_camera_state; +enum uca_property_ids; /** * \brief Camera probing and initialization @@ -36,14 +37,14 @@ typedef uint32_t (*uca_cam_destroy) (struct uca_camera_t *cam); * \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_camera_t *cam, int32_t property, void *data); +typedef uint32_t (*uca_cam_set_property) (struct uca_camera_t *cam, enum uca_property_ids 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_camera_t *cam, int32_t property, void *data); +typedef uint32_t (*uca_cam_get_property) (struct uca_camera_t *cam, enum uca_property_ids property, void *data); /** \brief Allocate number of buffers * @@ -73,14 +74,14 @@ enum uca_cam_state uca_get_camera_state(struct uca_camera_t *cam); /** * \brief Convert a property string to the corresponding ID */ -int32_t uca_get_property_id(const char *property_name); +enum uca_property_ids uca_get_property_id(const char *property_name); /** * \brief Convert a property ID to the corresponding string */ -const char* uca_get_property_name(int32_t property_id); +const char* uca_get_property_name(enum uca_property_ids property_id); -struct uca_property_t *uca_get_full_property(int32_t property_id); +struct uca_property_t *uca_get_full_property(enum uca_property_ids property_id); #define UCA_NO_ERROR 0 #define UCA_ERR_INIT_NOT_FOUND 1 /**< camera probing or initialization failed */ @@ -91,38 +92,40 @@ 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_NAME 0 -#define UCA_PROP_WIDTH 1 -#define UCA_PROP_WIDTH_MIN 2 -#define UCA_PROP_WIDTH_MAX 3 -#define UCA_PROP_HEIGHT 4 -#define UCA_PROP_HEIGHT_MIN 5 -#define UCA_PROP_HEIGHT_MAX 6 -#define UCA_PROP_X_OFFSET 7 -#define UCA_PROP_Y_OFFSET 8 -#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 18 -#define UCA_PROP_SCAN_MODE 19 - -/* IPE camera specific */ -#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 23 - -#define UCA_PROP_LAST 24 +enum uca_property_ids { + UCA_PROP_NAME = 0, + UCA_PROP_WIDTH, + UCA_PROP_WIDTH_MIN, + UCA_PROP_WIDTH_MAX, + UCA_PROP_HEIGHT, + UCA_PROP_HEIGHT_MIN, + UCA_PROP_HEIGHT_MAX, + UCA_PROP_X_OFFSET, + UCA_PROP_Y_OFFSET, + UCA_PROP_BITDEPTH, + UCA_PROP_EXPOSURE, + UCA_PROP_EXPOSURE_MIN, + UCA_PROP_EXPOSURE_MAX, + UCA_PROP_DELAY, + UCA_PROP_DELAY_MIN, + UCA_PROP_DELAY_MAX, + UCA_PROP_FRAMERATE, + UCA_PROP_TRIGGER_MODE, + + /* pco.edge specific */ + UCA_PROP_TIMESTAMP_MODE, + UCA_PROP_SCAN_MODE, + + /* IPE camera specific */ + UCA_PROP_INTERLACE_SAMPLE_RATE, + UCA_PROP_INTERLACE_PIXEL_THRESH, + UCA_PROP_INTERLACE_ROW_THRESH, + + /* Photon Focus specific */ + UCA_PROP_CORRECTION_MODE, + + UCA_PROP_LAST +}; /* Possible timestamp modes for UCA_PROP_TIMESTAMP_MODE */ #define UCA_TIMESTAMP_ASCII 0x01 |