From aa6ebf67fa2601a5fc087423be3ad40d742e1cd3 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Wed, 23 Feb 2011 10:26:25 +0100 Subject: Set camera name (so we have at least some kind of feedback which camera is used) --- src/cameras/uca_pco.c | 8 +++++++- src/uca.c | 2 ++ src/uca.h | 2 ++ test/test.c | 3 +++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/cameras/uca_pco.c b/src/cameras/uca_pco.c index 413d389..7de8955 100644 --- a/src/cameras/uca_pco.c +++ b/src/cameras/uca_pco.c @@ -1,5 +1,6 @@ #include +#include #include #include #include @@ -56,6 +57,7 @@ static uint32_t uca_pco_destroy(struct uca_t *uca) Fg_FreeGrabber(GET_FG(uca)); pco_destroy(GET_PCO(uca)); free(uca->user); + free(uca->camera_name); } uint32_t uca_pco_init(struct uca_t *uca) @@ -70,7 +72,7 @@ uint32_t uca_pco_init(struct uca_t *uca) return UCA_ERR_INIT_NOT_FOUND; } - pco_cam->fg = Fg_Init("libFullAreaGray8.so", 0); + Fg_Struct *fg = pco_cam->fg = Fg_Init("libFullAreaGray8.so", 0); pco_scan_and_set_baud_rate(pco); @@ -85,6 +87,10 @@ uint32_t uca_pco_init(struct uca_t *uca) /* ... and some properties */ pco_get_actual_size(pco, &uca->image_width, &uca->image_height); + SC2_Camera_Name_Response name; + if (pco_read_property(pco, GET_CAMERA_NAME, &name, sizeof(name)) == PCO_NOERROR) + uca->camera_name = strdup(name.szName); + /* Prepare camera for recording */ pco_set_rec_state(pco, 0); pco_set_timestamp_mode(pco, 2); diff --git a/src/uca.c b/src/uca.c index facccb4..73015dd 100644 --- a/src/uca.c +++ b/src/uca.c @@ -38,6 +38,8 @@ struct uca_t *uca_init() uca->cam_set_exposure = NULL; uca->cam_acquire_image = NULL; + uca->camera_name = NULL; + int i = 0; while (inits[i] != NULL) { uca_cam_init init = inits[i]; diff --git a/src/uca.h b/src/uca.h index bf0c249..a4586d7 100644 --- a/src/uca.h +++ b/src/uca.h @@ -72,6 +72,8 @@ struct uca_t { unsigned int image_height; unsigned int image_bitdepth; unsigned int image_flags; + + char *camera_name; /* Function pointers to camera-specific methods */ uca_cam_set_dimensions cam_set_dimensions; diff --git a/test/test.c b/test/test.c index 7e29a88..87e1b21 100644 --- a/test/test.c +++ b/test/test.c @@ -14,6 +14,9 @@ int main(int argc, char *argv[]) uca->cam_set_dimensions(uca, &width, &height); + if (uca->camera_name != NULL) + printf("Camera name: %s\n", uca->camera_name); + uca_destroy(uca); return 0; } -- cgit v1.2.3