summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2012-02-03 16:14:18 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2012-02-03 16:14:18 +0100
commit85546868f4df692803d21ddbaa20673fd8b5be0b (patch)
tree8a8079c69adf483b6ab2dd435faf1ba72191287c
parent0da06d904850330f583e1e8cdededcf6aa8cbe29 (diff)
downloaduca-85546868f4df692803d21ddbaa20673fd8b5be0b.tar.gz
uca-85546868f4df692803d21ddbaa20673fd8b5be0b.tar.bz2
uca-85546868f4df692803d21ddbaa20673fd8b5be0b.tar.xz
uca-85546868f4df692803d21ddbaa20673fd8b5be0b.zip
Typedef types
-rw-r--r--NEWS1
-rw-r--r--src/cameras/pco.c4
-rw-r--r--src/cameras/pf.c6
-rw-r--r--src/cameras/simple.c4
-rw-r--r--src/uca-cam.h6
-rw-r--r--src/uca-grabber.h2
-rw-r--r--src/uca.c52
-rw-r--r--src/uca.h88
-rw-r--r--test/benchmark.c6
-rw-r--r--test/control.c18
-rw-r--r--test/enum.c6
-rw-r--r--test/grab-async.c6
-rw-r--r--test/grab.c4
13 files changed, 102 insertions, 101 deletions
diff --git a/NEWS b/NEWS
index b76512a..f7d7928 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ Changes in libuca 0.5.0
- API changes
- new enum type uca_buffer_status
- uca_cam_grab_callback()s have to return uca_buffer_status
+ - typedef all types
- New symbols:
- uca_cam_release_buffer()
diff --git a/src/cameras/pco.c b/src/cameras/pco.c
index 2e02dfe..4510fa6 100644
--- a/src/cameras/pco.c
+++ b/src/cameras/pco.c
@@ -71,7 +71,7 @@ static uint32_t uca_pco_destroy(struct uca_camera_priv *cam)
return UCA_NO_ERROR;
}
-static uint32_t uca_pco_set_property(struct uca_camera_priv *cam, enum uca_property_ids property, void *data)
+static uint32_t uca_pco_set_property(struct uca_camera_priv *cam, uca_property_ids property, void *data)
{
struct uca_grabber_priv *grabber = cam->grabber;
struct pco_desc *pco_d = GET_PCO_DESC(cam);
@@ -144,7 +144,7 @@ static uint32_t uca_pco_set_property(struct uca_camera_priv *cam, enum uca_prope
}
-static uint32_t uca_pco_get_property(struct uca_camera_priv *cam, enum uca_property_ids property, void *data, size_t num)
+static uint32_t uca_pco_get_property(struct uca_camera_priv *cam, uca_property_ids property, void *data, size_t num)
{
pco_handle pco = GET_PCO(cam);
struct uca_grabber_priv *grabber = cam->grabber;
diff --git a/src/cameras/pf.c b/src/cameras/pf.c
index 1812aaf..829b94a 100644
--- a/src/cameras/pf.c
+++ b/src/cameras/pf.c
@@ -24,7 +24,7 @@
#include "uca-grabber.h"
struct uca_pf_map {
- enum uca_property_ids uca_prop;
+ uca_property_ids uca_prop;
const char *pf_prop;
};
@@ -63,7 +63,7 @@ static int uca_pf_set_uint32_property(TOKEN token, void *data, uint32_t *update_
return pfDevice_SetProperty(0, token, &value);
}
-static uint32_t uca_pf_set_property(struct uca_camera_priv *cam, enum uca_property_ids property, void *data)
+static uint32_t uca_pf_set_property(struct uca_camera_priv *cam, uca_property_ids property, void *data)
{
struct uca_grabber_priv *grabber = cam->grabber;
TOKEN token = INVALID_TOKEN;
@@ -121,7 +121,7 @@ static uint32_t uca_pf_set_property(struct uca_camera_priv *cam, enum uca_proper
}
-static uint32_t uca_pf_get_property(struct uca_camera_priv *cam, enum uca_property_ids property, void *data, size_t num)
+static uint32_t uca_pf_get_property(struct uca_camera_priv *cam, uca_property_ids property, void *data, size_t num)
{
TOKEN t; /* You gotta love developers who name types capitalized... */
PFValue value;
diff --git a/src/cameras/simple.c b/src/cameras/simple.c
index 368eb62..9b8be9a 100644
--- a/src/cameras/simple.c
+++ b/src/cameras/simple.c
@@ -23,7 +23,7 @@
#include "uca-grabber.h"
-static uint32_t uca_simple_set_property(struct uca_camera_priv *cam, enum uca_property_ids property, void *data)
+static uint32_t uca_simple_set_property(struct uca_camera_priv *cam, uca_property_ids property, void *data)
{
struct uca_grabber_priv *grabber = cam->grabber;
int err = UCA_NO_ERROR;
@@ -43,7 +43,7 @@ static uint32_t uca_simple_set_property(struct uca_camera_priv *cam, enum uca_pr
}
-static uint32_t uca_simple_get_property(struct uca_camera_priv *cam, enum uca_property_ids property, void *data, size_t num)
+static uint32_t uca_simple_get_property(struct uca_camera_priv *cam, uca_property_ids property, void *data, size_t num)
{
struct uca_grabber_priv *grabber = cam->grabber;
uint32_t value32 = 0;
diff --git a/src/uca-cam.h b/src/uca-cam.h
index 08b7941..5535dd0 100644
--- a/src/uca-cam.h
+++ b/src/uca-cam.h
@@ -57,8 +57,8 @@ struct uca_camera_priv *uca_cam_new(void);
typedef struct uca_camera_priv {
/* virtual methods to be overridden by concrete cameras */
uint32_t (*destroy) (struct uca_camera_priv *cam);
- uint32_t (*set_property) (struct uca_camera_priv *cam, enum uca_property_ids property, void *data);
- uint32_t (*get_property) (struct uca_camera_priv *cam, enum uca_property_ids property, void *data, size_t num);
+ uint32_t (*set_property) (struct uca_camera_priv *cam, uca_property_ids property, void *data);
+ uint32_t (*get_property) (struct uca_camera_priv *cam, uca_property_ids property, void *data, size_t num);
uint32_t (*start_recording) (struct uca_camera_priv *cam);
uint32_t (*stop_recording) (struct uca_camera_priv *cam);
uint32_t (*trigger) (struct uca_camera_priv *cam);
@@ -68,7 +68,7 @@ typedef struct uca_camera_priv {
uint32_t (*readout) (struct uca_camera_priv *cam);
struct uca_grabber_priv *grabber; /**< grabber associated with this camera */
- enum uca_cam_state state; /**< camera state handled in uca.c */
+ uca_cam_state state; /**< camera state handled in uca.c */
uint32_t frame_width; /**< current frame width */
uint32_t frame_height; /**< current frame height */
uint64_t current_frame; /**< last grabbed frame number */
diff --git a/src/uca-grabber.h b/src/uca-grabber.h
index 8104d1f..414b9ac 100644
--- a/src/uca-grabber.h
+++ b/src/uca-grabber.h
@@ -127,7 +127,7 @@ typedef uint32_t (*uca_grabber_grab) (struct uca_grabber_priv *grabber, void **b
*
* \param[in] cb Callback function for when a frame arrived
*/
-typedef uint32_t (*uca_grabber_register_callback) (struct uca_grabber_priv *grabber, uca_cam_grab_callback cb, void *meta_data, void *user);
+typedef uca_buffer_status (*uca_grabber_register_callback) (struct uca_grabber_priv *grabber, uca_cam_grab_callback cb, void *meta_data, void *user);
/**
diff --git a/src/uca.c b/src/uca.c
index 3b2a84c..04af76b 100644
--- a/src/uca.c
+++ b/src/uca.c
@@ -65,7 +65,7 @@ const char *uca_unit_map[] = {
""
};
-static struct uca_property property_map[UCA_PROP_LAST+1] = {
+static uca_property property_map[UCA_PROP_LAST+1] = {
{ "General.Name", uca_na, uca_string, uca_read },
{ "Image.Width", uca_pixel, uca_uint32t, uca_readwrite },
{ "Image.Width.Min", uca_pixel, uca_uint32t, uca_read },
@@ -124,16 +124,16 @@ static pthread_mutex_t g_uca_init_lock = PTHREAD_MUTEX_INITIALIZER;
#define uca_unlock(lock)
#endif
-struct uca *g_uca = NULL;
+uca *g_uca = NULL;
-struct uca *uca_init(const char *config_filename)
+uca *uca_init(const char *config_filename)
{
uca_lock();
if (g_uca != NULL) {
uca_unlock();
return g_uca;
}
- g_uca = (struct uca *) malloc(sizeof(struct uca));
+ g_uca = (uca *) malloc(sizeof(uca));
g_uca->cameras = NULL;
uca_grabber_init grabber_inits[] = {
@@ -179,13 +179,13 @@ struct uca *uca_init(const char *config_filename)
* each camera must make sure to check for such a situation. */
if (grabber != NULL) {
- g_uca->grabbers = (struct uca_grabber *) malloc(sizeof(struct uca_grabber));
+ g_uca->grabbers = (uca_grabber *) malloc(sizeof(uca_grabber));
g_uca->grabbers->priv = grabber;
g_uca->grabbers->next = NULL;
}
i = 0;
- struct uca_camera *current = NULL;
+ uca_camera *current = NULL;
/* Probe each camera that is configured and append a found camera to the
* linked list. */
while (cam_inits[i] != NULL) {
@@ -193,13 +193,13 @@ struct uca *uca_init(const char *config_filename)
uca_cam_init init = cam_inits[i];
if (init(&cam, grabber) == UCA_NO_ERROR) {
if (current == NULL) {
- g_uca->cameras = (struct uca_camera *) malloc(sizeof(struct uca_camera));
+ g_uca->cameras = (uca_camera *) malloc(sizeof(uca_camera));
g_uca->cameras->priv = cam;
g_uca->cameras->next = NULL;
current = g_uca->cameras;
}
else {
- current->next = (struct uca_camera *) malloc(sizeof(struct uca_camera));
+ current->next = (uca_camera *) malloc(sizeof(uca_camera));
current->next->priv = cam;
current = current->next;
}
@@ -218,11 +218,11 @@ struct uca *uca_init(const char *config_filename)
return g_uca;
}
-void uca_destroy(struct uca *u)
+void uca_destroy(uca *u)
{
uca_lock();
if (u != NULL) {
- struct uca_camera *cam = u->cameras, *tmp;
+ uca_camera *cam = u->cameras, *tmp;
struct uca_camera_priv *cam_priv;
while (cam != NULL) {
tmp = cam;
@@ -232,7 +232,7 @@ void uca_destroy(struct uca *u)
free(tmp);
}
- struct uca_grabber *grabber = u->grabbers, *tmpg;
+ uca_grabber *grabber = u->grabbers, *tmpg;
struct uca_grabber_priv *grabber_priv;
while (grabber != NULL) {
tmpg = grabber;
@@ -247,12 +247,12 @@ void uca_destroy(struct uca *u)
uca_unlock();
}
-uint32_t uca_get_property_id(const char *property_name, enum uca_property_ids *prop_id)
+uint32_t uca_get_property_id(const char *property_name, uca_property_ids *prop_id)
{
int i = 0;
while (property_map[i].name != NULL) {
if (!strcmp(property_map[i].name, property_name)) {
- *prop_id = (enum uca_property_ids) i;
+ *prop_id = (uca_property_ids) i;
return UCA_NO_ERROR;
}
i++;
@@ -260,21 +260,21 @@ uint32_t uca_get_property_id(const char *property_name, enum uca_property_ids *p
return UCA_ERR_CAMERA | UCA_ERR_PROP | UCA_ERR_INVALID;
}
-struct uca_property *uca_get_full_property(enum uca_property_ids property_id)
+uca_property *uca_get_full_property(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(enum uca_property_ids property_id)
+const char* uca_get_property_name(uca_property_ids property_id)
{
if ((property_id >= 0) && (property_id < UCA_PROP_LAST))
return property_map[property_id].name;
return UCA_NO_ERROR;
}
-uint32_t uca_cam_alloc(struct uca_camera *cam, uint32_t n_buffers)
+uint32_t uca_cam_alloc(uca_camera *cam, uint32_t n_buffers)
{
uint32_t bitdepth;
struct uca_camera_priv *priv = cam->priv;
@@ -285,25 +285,25 @@ uint32_t uca_cam_alloc(struct uca_camera *cam, uint32_t n_buffers)
return UCA_NO_ERROR;
}
-enum uca_cam_state uca_cam_get_state(struct uca_camera *cam)
+uca_cam_state uca_cam_get_state(uca_camera *cam)
{
struct uca_camera_priv *priv = cam->priv;
return priv->state;
}
-uint32_t uca_cam_set_property(struct uca_camera *cam, enum uca_property_ids property, void *data)
+uint32_t uca_cam_set_property(uca_camera *cam, uca_property_ids property, void *data)
{
struct uca_camera_priv *priv = cam->priv;
return priv->set_property(priv, property, data);
}
-uint32_t uca_cam_get_property(struct uca_camera *cam, enum uca_property_ids property, void *data, size_t num)
+uint32_t uca_cam_get_property(uca_camera *cam, uca_property_ids property, void *data, size_t num)
{
struct uca_camera_priv *priv = cam->priv;
return priv->get_property(priv, property, data, num);
}
-uint32_t uca_cam_start_recording(struct uca_camera *cam)
+uint32_t uca_cam_start_recording(uca_camera *cam)
{
struct uca_camera_priv *priv = cam->priv;
if (priv->state == UCA_CAM_RECORDING)
@@ -315,7 +315,7 @@ uint32_t uca_cam_start_recording(struct uca_camera *cam)
return err;
}
-uint32_t uca_cam_stop_recording(struct uca_camera *cam)
+uint32_t uca_cam_stop_recording(uca_camera *cam)
{
struct uca_camera_priv *priv = cam->priv;
if (priv->state != UCA_CAM_RECORDING)
@@ -327,7 +327,7 @@ uint32_t uca_cam_stop_recording(struct uca_camera *cam)
return err;
}
-uint32_t uca_cam_trigger(struct uca_camera *cam)
+uint32_t uca_cam_trigger(uca_camera *cam)
{
struct uca_camera_priv *priv = cam->priv;
if (priv->state != UCA_CAM_RECORDING)
@@ -335,13 +335,13 @@ uint32_t uca_cam_trigger(struct uca_camera *cam)
return priv->trigger(priv);
}
-uint32_t uca_cam_register_callback(struct uca_camera *cam, uca_cam_grab_callback callback, void *user)
+uint32_t uca_cam_register_callback(uca_camera *cam, uca_cam_grab_callback callback, void *user)
{
struct uca_camera_priv *priv = cam->priv;
return priv->register_callback(priv, callback, user);
}
-uint32_t uca_cam_release_buffer(struct uca_camera *cam, void *buffer)
+uint32_t uca_cam_release_buffer(uca_camera *cam, void *buffer)
{
struct uca_camera_priv *priv = cam->priv;
if (priv->release_buffer != NULL)
@@ -349,7 +349,7 @@ uint32_t uca_cam_release_buffer(struct uca_camera *cam, void *buffer)
return UCA_ERR_NOT_IMPLEMENTED;
}
-uint32_t uca_cam_grab(struct uca_camera *cam, char *buffer, void *meta_data)
+uint32_t uca_cam_grab(uca_camera *cam, char *buffer, void *meta_data)
{
struct uca_camera_priv *priv = cam->priv;
if ((priv->state != UCA_CAM_RECORDING) && (priv->state != UCA_CAM_READOUT))
@@ -357,7 +357,7 @@ uint32_t uca_cam_grab(struct uca_camera *cam, char *buffer, void *meta_data)
return priv->grab(priv, buffer, meta_data);
}
-uint32_t uca_cam_readout(struct uca_camera *cam)
+uint32_t uca_cam_readout(uca_camera *cam)
{
struct uca_camera_priv *priv = cam->priv;
if (priv->state == UCA_CAM_RECORDING)
diff --git a/src/uca.h b/src/uca.h
index 1df870f..7cf053e 100644
--- a/src/uca.h
+++ b/src/uca.h
@@ -84,7 +84,7 @@ extern "C" {
/* 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! */
-enum uca_property_ids {
+typedef enum {
UCA_PROP_NAME = 0,
UCA_PROP_WIDTH,
UCA_PROP_WIDTH_MIN,
@@ -141,7 +141,7 @@ enum uca_property_ids {
UCA_PROP_CORRECTION_MODE,
UCA_PROP_LAST
-};
+} uca_property_ids;
/* Possible timestamp modes for UCA_PROP_TIMESTAMP_MODE */
#define UCA_TIMESTAMP_NONE 0x00
@@ -169,7 +169,7 @@ enum uca_property_ids {
* the values into their respective target value. It is also used for human
* interfaces.
*/
-enum uca_unit {
+typedef enum {
uca_pixel, /**< number of pixels */
uca_bits, /**< number of bits */
uca_ns, /**< nanoseconds */
@@ -181,7 +181,7 @@ enum uca_unit {
uca_dc, /**< degree celsius */
uca_bool, /**< 1 or 0 for true and false */
uca_na /**< no unit available (for example modes) */
-};
+} uca_unit;
/**
* The data type of this property.
@@ -190,33 +190,33 @@ enum uca_unit {
* must be respected and correct data transfered, as the values are
* interpreted like defined here.
*/
-enum uca_types {
+typedef enum {
uca_uint32t,
uca_uint8t,
uca_string
-};
+} uca_types;
/**
* Access rights determine if uca_cam_get_property() and/or
* uca_cam_set_property() can be used with this property.
*/
-enum uca_access_rights {
+typedef enum {
uca_read = 0x01, /**< property can be read */
uca_write = 0x02, /**< property can be written */
uca_readwrite = 0x01 | 0x02 /**< property can be read and written */
-};
+} uca_access_rights;
/**
* Describes the current state of the camera.
*
* \see uca_cam_get_state()
*/
-enum uca_cam_state {
+typedef enum {
UCA_CAM_CONFIGURABLE, /**< Camera can be configured and is not recording */
UCA_CAM_ARMED, /**< Camera is ready for recording */
UCA_CAM_RECORDING, /**< Camera is currently recording */
UCA_CAM_READOUT /**< Camera recorded and is currently in readout mode */
-};
+} uca_cam_state;
/**
* Specify if the callback function keeps the buffer and will call
@@ -225,10 +225,10 @@ enum uca_cam_state {
*
* \since 0.5
*/
-enum uca_buffer_status {
+typedef enum {
UCA_BUFFER_KEEP, /**< Keep the buffer and call ufo_cam_release_buffer() manually */
UCA_BUFFER_RELEASE /**< Buffer is released upon return */
-};
+} uca_buffer_status;
/**
* A uca_property_t describes a vendor-independent property used by cameras and
@@ -236,7 +236,7 @@ enum uca_buffer_status {
* unit, a type and some access rights.
* \see uca_get_full_property()
*/
-typedef struct uca_property {
+typedef struct {
/**
* A human-readable string for this property.
*
@@ -247,11 +247,11 @@ typedef struct uca_property {
*/
const char *name;
- enum uca_unit unit;
- enum uca_types type;
- enum uca_access_rights access;
+ uca_unit unit;
+ uca_types type;
+ uca_access_rights access;
-} uca_property_t;
+} uca_property;
union uca_value {
uint32_t u32;
@@ -277,7 +277,7 @@ union uca_value {
*
* \note The meta data parameter is not yet specified but just a place holder.
*/
-typedef enum uca_buffer_status (*uca_cam_grab_callback) (uint64_t image_number, void *buffer, void *meta_data, void *user);
+typedef uca_buffer_status (*uca_cam_grab_callback) (uint64_t image_number, void *buffer, void *meta_data, void *user);
extern const char *uca_unit_map[]; /**< maps unit numbers to corresponding strings */
@@ -339,24 +339,24 @@ struct uca_camera_priv;
* uca_camera is an opaque structure that is only accessed with the uca_cam_*
* methods.
*/
-struct uca_camera {
+typedef struct uca_camera {
struct uca_camera *next;
struct uca_camera_priv* priv;
-};
+} uca_camera;
struct uca_grabber_priv;
-struct uca_grabber {
+typedef struct uca_grabber {
struct uca_grabber *next;
struct uca_grabber_priv* priv;
-};
+} uca_grabber;
/**
* Keeps a list of cameras and grabbers.
*/
-typedef struct uca {
- struct uca_camera *cameras;
- struct uca_grabber *grabbers;
-} uca_t;
+typedef struct {
+ uca_camera *cameras;
+ uca_grabber *grabbers;
+} uca;
/**
* Initialize the unified camera access interface.
@@ -369,29 +369,29 @@ typedef struct uca {
*
* \note uca_init() is thread-safe if a Pthread-implementation is available.
*/
-struct uca *uca_init(const char *config_filename);
+uca *uca_init(const char *config_filename);
/**
* Free resources of the unified camera access interface
*
* \note uca_destroy() is thread-safe if a Pthread-implementation is available.
*/
-void uca_destroy(struct uca *u);
+void uca_destroy(uca *u);
/**
* Convert a property string to the corresponding ID
*/
-uint32_t uca_get_property_id(const char *property_name, enum uca_property_ids *prop_id);
+uint32_t uca_get_property_id(const char *property_name, uca_property_ids *prop_id);
/**
* Convert a property ID to the corresponding string
*/
-const char* uca_get_property_name(enum uca_property_ids property_id);
+const char* uca_get_property_name(uca_property_ids property_id);
/**
* Return the full property structure for a given ID
*/
-uca_property_t *uca_get_full_property(enum uca_property_ids property_id);
+uca_property *uca_get_full_property(uca_property_ids property_id);
/**
* Allocates buffer memory for the internal frame grabber.
@@ -403,7 +403,7 @@ uca_property_t *uca_get_full_property(enum uca_property_ids property_id);
* \param[in] n_buffers Number of sub-buffers with size frame_width*frame_height.
* \return Error code
*/
-uint32_t uca_cam_alloc(struct uca_camera *cam, uint32_t n_buffers);
+uint32_t uca_cam_alloc(uca_camera *cam, uint32_t n_buffers);
/**
* Retrieve current state of the camera.
@@ -412,7 +412,7 @@ uint32_t uca_cam_alloc(struct uca_camera *cam, uint32_t n_buffers);
* \return A value from the uca_cam_state enum representing the current state of
* the camera.
*/
-enum uca_cam_state uca_cam_get_state(struct uca_camera *cam);
+uca_cam_state uca_cam_get_state(uca_camera *cam);
/**
@@ -426,7 +426,7 @@ enum uca_cam_state uca_cam_get_state(struct uca_camera *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.
*/
-uint32_t uca_cam_set_property(struct uca_camera *cam, enum uca_property_ids property, void *data);
+uint32_t uca_cam_set_property(uca_camera *cam, uca_property_ids property, void *data);
/**
* Get a property.
@@ -439,7 +439,7 @@ uint32_t uca_cam_set_property(struct uca_camera *cam, enum uca_property_ids prop
*
* \return UCA_ERR_PROP_INVALID if property is not supported on the camera
*/
-uint32_t uca_cam_get_property(struct uca_camera *cam, enum uca_property_ids property, void *data, size_t num);
+uint32_t uca_cam_get_property(uca_camera *cam, uca_property_ids property, void *data, size_t num);
/**
* Begin recording.
@@ -450,7 +450,7 @@ uint32_t uca_cam_get_property(struct uca_camera *cam, enum uca_property_ids prop
* \param[in] cam A uca_camera object
* \return Error code
*/
-uint32_t uca_cam_start_recording(struct uca_camera *cam);
+uint32_t uca_cam_start_recording(uca_camera *cam);
/**
* Stop recording.
@@ -458,18 +458,18 @@ uint32_t uca_cam_start_recording(struct uca_camera *cam);
* \param[in] cam A uca_camera object
* \return Error code
*/
-uint32_t uca_cam_stop_recording(struct uca_camera *cam);
+uint32_t uca_cam_stop_recording(uca_camera *cam);
/**
* Send a software trigger signal to start a sensor read-out.
*
- * This method is only useful when UCA_PROP_TRIGGER_MODE is set to
- * UCA_TRIGGER_SOFTWARE.
+ * This method is only useful when #UCA_PROP_TRIGGER_MODE is set to
+ * #UCA_TRIGGER_SOFTWARE.
*
* \param[in] cam A uca_camera object
* \return Error code
*/
-uint32_t uca_cam_trigger(struct uca_camera *cam);
+uint32_t uca_cam_trigger(uca_camera *cam);
/**
* Register callback for given frame grabber. To actually start receiving
@@ -480,7 +480,7 @@ uint32_t uca_cam_trigger(struct uca_camera *cam);
* \param[in] user User data that is passed to the callback function
* \return Error code
*/
-uint32_t uca_cam_register_callback(struct uca_camera *cam, uca_cam_grab_callback callback, void *user);
+uint32_t uca_cam_register_callback(uca_camera *cam, uca_cam_grab_callback callback, void *user);
/**
* Release the buffer that was given in the grab callback.
@@ -491,7 +491,7 @@ uint32_t uca_cam_register_callback(struct uca_camera *cam, uca_cam_grab_callback
* \see uca_cam_register_callback(), uca_cam_grab_callback
* \since 0.5
*/
-uint32_t uca_cam_release_buffer(struct uca_camera *cam, void *buffer);
+uint32_t uca_cam_release_buffer(uca_camera *cam, void *buffer);
/**
* \brief Grab one image from the camera
@@ -508,7 +508,7 @@ uint32_t uca_cam_release_buffer(struct uca_camera *cam, void *buffer);
* \note The meta data parameter is not yet specified but just a place holder.
*
*/
-uint32_t uca_cam_grab(struct uca_camera *cam, char *buffer, void *meta_data);
+uint32_t uca_cam_grab(uca_camera *cam, char *buffer, void *meta_data);
/**
* \brief Initiate read out for recording based cameras like pco.dimax or
@@ -521,7 +521,7 @@ uint32_t uca_cam_grab(struct uca_camera *cam, char *buffer, void *meta_data);
* \param[in] cam A uca_camera object
* \return Error code
*/
-uint32_t uca_cam_readout(struct uca_camera *cam);
+uint32_t uca_cam_readout(uca_camera *cam);
#define uca_set_void(p, type, value) { *((type *) p) = (type) value; }
diff --git a/test/benchmark.c b/test/benchmark.c
index 60d030d..0d7962a 100644
--- a/test/benchmark.c
+++ b/test/benchmark.c
@@ -35,7 +35,7 @@ void grab_callback_raw(uint32_t image_number, void *buffer, void *meta_data, voi
*count = image_number;
}
-void benchmark_cam(struct uca_camera *cam)
+void benchmark_cam(uca_camera *cam)
{
char name[256];
uca_cam_get_property(cam, UCA_PROP_NAME, name, 256);
@@ -81,7 +81,7 @@ void benchmark_cam(struct uca_camera *cam)
int main(int argc, char *argv[])
{
- struct uca *u = uca_init(NULL);
+ uca *u = uca_init(NULL);
if (u == NULL) {
printf("Couldn't find a camera\n");
return 1;
@@ -90,7 +90,7 @@ int main(int argc, char *argv[])
printf("# camera;width;height;experiment;frames-per-second;throughput in MB/s\n");
/* take first camera */
- struct uca_camera *cam = u->cameras;
+ uca_camera *cam = u->cameras;
while (cam != NULL) {
benchmark_cam(cam);
cam = cam->next;
diff --git a/test/control.c b/test/control.c
index 372acf6..4397dbe 100644
--- a/test/control.c
+++ b/test/control.c
@@ -40,8 +40,8 @@ typedef struct {
int width;
int height;
int pixel_size;
- struct uca_camera *cam;
- struct uca *u;
+ uca_camera *cam;
+ uca *u;
float scale;
} ThreadData;
@@ -103,7 +103,7 @@ void reallocate_buffers(ThreadData *td, int width, int height)
void *grab_thread(void *args)
{
ThreadData *data = (ThreadData *) args;
- struct uca_camera *cam = data->cam;
+ uca_camera *cam = data->cam;
char filename[FILENAME_MAX] = {0,};
int counter = 0;
@@ -210,7 +210,7 @@ void on_valuecell_edited(GtkCellRendererText *renderer, gchar *path, gchar *new_
GtkTreeIter iter;
if (gtk_tree_model_get_iter(tree_model, &iter, tree_path)) {
- struct uca_camera *cam = value_data->thread_data->cam;
+ uca_camera *cam = value_data->thread_data->cam;
uint32_t prop_id;
gtk_tree_model_get(tree_model, &iter, COLUMN_UCA_ID, &prop_id, -1);
@@ -297,10 +297,10 @@ static void find_recursively(GtkTreeStore *store, GtkTreeIter *root, GtkTreeIter
find_recursively(store, &iter, result, tokens, depth+1);
}
-static void fill_tree_store(GtkTreeStore *tree_store, struct uca_camera *cam)
+static void fill_tree_store(GtkTreeStore *tree_store, uca_camera *cam)
{
GtkTreeIter iter, child;
- struct uca_property *property;
+ uca_property *property;
const size_t num_bytes = 256;
gchar *value_string = g_malloc(num_bytes);
guint8 value_8;
@@ -354,7 +354,7 @@ static void value_cell_data_func(GtkTreeViewColumn *column, GtkCellRenderer *cel
uint32_t prop_id;
gtk_tree_model_get(model, iter, COLUMN_UCA_ID, &prop_id, -1);
- struct uca_property *property = uca_get_full_property(prop_id);
+ uca_property *property = uca_get_full_property(prop_id);
if (property->access & uca_write) {
g_object_set(cell, "mode", GTK_CELL_RENDERER_MODE_EDITABLE, NULL);
g_object_set(GTK_CELL_RENDERER_TEXT(cell), "editable", TRUE, NULL);
@@ -369,14 +369,14 @@ static void value_cell_data_func(GtkTreeViewColumn *column, GtkCellRenderer *cel
int main(int argc, char *argv[])
{
- struct uca *u = uca_init(NULL);
+ uca *u = uca_init(NULL);
if (u == NULL) {
g_print("Couldn't initialize frame grabber and/or cameras\n");
return 1;
}
int width, height, bits_per_sample;
- struct uca_camera *cam = u->cameras;
+ uca_camera *cam = u->cameras;
uca_cam_get_property(cam, UCA_PROP_WIDTH, &width, 0);
uca_cam_get_property(cam, UCA_PROP_HEIGHT, &height, 0);
uca_cam_get_property(cam, UCA_PROP_BITDEPTH, &bits_per_sample, 0);
diff --git a/test/enum.c b/test/enum.c
index 148304c..17b595f 100644
--- a/test/enum.c
+++ b/test/enum.c
@@ -36,14 +36,14 @@ void print_level(int depth)
int main(int argc, char *argv[])
{
- struct uca *u = uca_init(NULL);
+ uca *u = uca_init(NULL);
if (u == NULL) {
printf("Couldn't find a camera\n");
return 1;
}
/* take first camera */
- struct uca_camera *cam = u->cameras;
+ uca_camera *cam = u->cameras;
const size_t num_bytes = 256;
char string_value[num_bytes];
@@ -52,7 +52,7 @@ int main(int argc, char *argv[])
while (cam != NULL) {
for (int i = 0; i < UCA_PROP_LAST; i++) {
- struct uca_property *prop = uca_get_full_property(i);
+ uca_property *prop = uca_get_full_property(i);
print_level(count_dots(prop->name));
printf("%s = ", prop->name);
switch (prop->type) {
diff --git a/test/grab-async.c b/test/grab-async.c
index 7bcd5f7..53cf9ad 100644
--- a/test/grab-async.c
+++ b/test/grab-async.c
@@ -26,7 +26,7 @@ struct image_props {
uint32_t bits;
};
-enum uca_buffer_status grab_callback(uint64_t image_number, void *buffer, void *meta_data, void *user)
+uca_buffer_status grab_callback(uint64_t image_number, void *buffer, void *meta_data, void *user)
{
struct image_props *props = (struct image_props *) user;
const int pixel_size = props->bits == 8 ? 1 : 2;
@@ -46,14 +46,14 @@ enum uca_buffer_status grab_callback(uint64_t image_number, void *buffer, void *
int main(int argc, char *argv[])
{
- struct uca *u = uca_init(NULL);
+ uca *u = uca_init(NULL);
if (u == NULL) {
printf("Couldn't find a camera\n");
return 1;
}
/* take first camera */
- struct uca_camera *cam = u->cameras;
+ uca_camera *cam = u->cameras;
uint32_t val = 5000;
uca_cam_set_property(cam, UCA_PROP_EXPOSURE, &val);
diff --git a/test/grab.c b/test/grab.c
index 54e6955..16bafb1 100644
--- a/test/grab.c
+++ b/test/grab.c
@@ -24,7 +24,7 @@
#define handle_error(errno) {if ((errno) != UCA_NO_ERROR) printf("error at <%s:%i>\n", \
__FILE__, __LINE__);}
-static struct uca *u = NULL;
+uca *u = NULL;
void sigint_handler(int signal)
{
@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
}
/* take first camera */
- struct uca_camera *cam = u->cameras;
+ uca_camera *cam = u->cameras;
uint32_t val = 5000;
handle_error(uca_cam_set_property(cam, UCA_PROP_EXPOSURE, &val));