summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cameras/uca_pco.c8
-rw-r--r--src/uca.c2
-rw-r--r--src/uca.h2
-rw-r--r--test/test.c3
4 files changed, 14 insertions, 1 deletions
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 <stdlib.h>
+#include <string.h>
#include <clser.h>
#include <fgrab_struct.h>
#include <fgrab_prototyp.h>
@@ -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;
}