summaryrefslogtreecommitdiffstats
path: root/src/cameras
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-02-25 12:24:20 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-02-25 12:24:20 +0100
commit06890f4bd07aa24f4205a0573c0a57a8c3e9f6b0 (patch)
treeb7083943888ae0b884f23f97ce3137a0299b005b /src/cameras
parentb32564991609717631b2b3926dccd9db21c28f46 (diff)
downloadlibuca-06890f4bd07aa24f4205a0573c0a57a8c3e9f6b0.tar.gz
libuca-06890f4bd07aa24f4205a0573c0a57a8c3e9f6b0.tar.bz2
libuca-06890f4bd07aa24f4205a0573c0a57a8c3e9f6b0.tar.xz
libuca-06890f4bd07aa24f4205a0573c0a57a8c3e9f6b0.zip
Property re-ordering. Made test program more useful
Diffstat (limited to 'src/cameras')
-rw-r--r--src/cameras/uca_pco.c53
1 files changed, 39 insertions, 14 deletions
diff --git a/src/cameras/uca_pco.c b/src/cameras/uca_pco.c
index 93d50f6..1c189b7 100644
--- a/src/cameras/uca_pco.c
+++ b/src/cameras/uca_pco.c
@@ -16,6 +16,8 @@ struct pco_cam_t {
#define GET_PCO(uca) (((struct pco_cam_t *)(uca->user))->pco)
#define GET_FG(uca) (((struct pco_cam_t *)(uca->user))->fg)
+#define set_void(p, type, value) { *((type *) p) = value; }
+
static uint32_t uca_pco_set_bitdepth(struct uca_t *uca, uint8_t *bitdepth)
{
@@ -91,6 +93,7 @@ static uint32_t uca_pco_set_property(struct uca_t *uca, int32_t property, void *
return UCA_NO_ERROR;
}
+
static uint32_t uca_pco_get_property(struct uca_t *uca, int32_t property, void *data)
{
struct pco_edge_t *pco = GET_PCO(uca);
@@ -110,11 +113,27 @@ static uint32_t uca_pco_get_property(struct uca_t *uca, int32_t property, void *
return UCA_ERR_PROP_GENERAL;
break;
+ case UCA_PROP_WIDTH_MIN:
+ set_void(data, uint32_t, 1);
+ break;
+
+ case UCA_PROP_WIDTH_MAX:
+ set_void(data, uint32_t, pco->description.wMaxHorzResStdDESC);
+ break;
+
case UCA_PROP_HEIGHT:
if (Fg_getParameter(GET_FG(uca), FG_HEIGHT, (uint32_t *) data, PORT_A) != FG_OK)
return UCA_ERR_PROP_GENERAL;
break;
+ case UCA_PROP_HEIGHT_MIN:
+ set_void(data, uint32_t, 1);
+ break;
+
+ case UCA_PROP_HEIGHT_MAX:
+ set_void(data, uint32_t, pco->description.wMaxVertResStdDESC);
+ break;
+
case UCA_PROP_X_OFFSET:
if (Fg_getParameter(GET_FG(uca), FG_XOFFSET, (uint32_t *) data, PORT_A) != FG_OK)
return UCA_ERR_PROP_GENERAL;
@@ -125,19 +144,21 @@ static uint32_t uca_pco_get_property(struct uca_t *uca, int32_t property, void *
return UCA_ERR_PROP_GENERAL;
break;
- case UCA_PROP_MAX_WIDTH:
- {
- uint32_t w, h;
- pco_get_actual_size(pco, &w, &h);
- *((uint32_t *) data) = w;
- }
+ case UCA_PROP_DELAY_MIN:
+ set_void(data, uint32_t, pco->description.dwMinDelayDESC);
+ break;
- case UCA_PROP_MAX_HEIGHT:
- {
- int w, h;
- pco_get_actual_size(pco, &w, &h);
- *((uint32_t *) data) = h;
- }
+ case UCA_PROP_DELAY_MAX:
+ set_void(data, uint32_t, pco->description.dwMaxDelayDESC);
+ break;
+
+ case UCA_PROP_EXPOSURE_MIN:
+ set_void(data, uint32_t, pco->description.dwMinExposureDESC);
+ break;
+
+ case UCA_PROP_EXPOSURE_MAX:
+ set_void(data, uint32_t, pco->description.dwMaxExposureDESC);
+ break;
default:
return UCA_ERR_PROP_INVALID;
@@ -157,15 +178,19 @@ uint32_t uca_pco_init(struct uca_t *uca)
struct pco_cam_t *pco_cam = uca->user;
struct pco_edge_t *pco = pco_cam->pco = pco_init();
+ if (pco == NULL) {
+ free(uca->user);
+ return UCA_ERR_INIT_NOT_FOUND;
+ }
+
if ((pco->serial_ref == NULL) || !pco_active(pco)) {
+ free(uca->user);
pco_destroy(pco);
return UCA_ERR_INIT_NOT_FOUND;
}
Fg_Struct *fg = pco_cam->fg = Fg_Init("libFullAreaGray8.so", 0);
- pco_scan_and_set_baud_rate(pco);
-
/* Camera found, set function pointers... */
uca->cam_destroy = &uca_pco_destroy;
uca->cam_set_property = &uca_pco_set_property;