summaryrefslogtreecommitdiffstats
path: root/test/test.c
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-02-28 11:09:43 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-02-28 11:09:43 +0100
commitf200da9c7915521f77c6c23e825181da73db474d (patch)
treee44d75bf6dc82284e7b089cc20b1a0e616e44356 /test/test.c
parenta10b4d2abbb2aafbcb398f659975d673b0181e8c (diff)
downloaduca-f200da9c7915521f77c6c23e825181da73db474d.tar.gz
uca-f200da9c7915521f77c6c23e825181da73db474d.tar.bz2
uca-f200da9c7915521f77c6c23e825181da73db474d.tar.xz
uca-f200da9c7915521f77c6c23e825181da73db474d.zip
Add support for multiple cameras
Diffstat (limited to 'test/test.c')
-rw-r--r--test/test.c66
1 files changed, 36 insertions, 30 deletions
diff --git a/test/test.c b/test/test.c
index 0f5b6fe..e3d07ff 100644
--- a/test/test.c
+++ b/test/test.c
@@ -26,44 +26,50 @@ int main(int argc, char *argv[])
return 1;
}
+ /* take first camera */
+ struct uca_camera_t *cam = uca->cameras;
+
char string_value[256];
uint32_t uint32_value;
uint8_t uint8_value;
const char *unit_map[] = {
- "px",
- "bits",
- "ns",
- "µs",
- "ms",
- "s",
- "rows",
- ""
+ "px", "bits",
+ "ns", "µs", "ms", "s",
+ "rows", ""
};
- for (int i = 0; i < UCA_PROP_LAST-2; i++) {
- struct uca_property_t *prop = uca_get_full_property(i);
- switch (prop->type) {
- case uca_string:
- if (uca->cam_get_property(uca, i, string_value) != UCA_PROP_INVALID) {
- print_level(count_dots(prop->name));
- printf("%s = %s %s ", prop->name, string_value, unit_map[prop->unit]);
- }
- break;
- case uca_uint32t:
- if (uca->cam_get_property(uca, i, &uint32_value) != UCA_PROP_INVALID) {
- print_level(count_dots(prop->name));
- printf("%s = %i %s ", prop->name, uint32_value, unit_map[prop->unit]);
- }
- break;
- case uca_uint8t:
- if (uca->cam_get_property(uca, i, &uint8_value) != UCA_PROP_INVALID) {
- print_level(count_dots(prop->name));
- printf("%s = %i %s ", prop->name, uint8_value, unit_map[prop->unit]);
- }
- break;
+ while (cam != NULL) {
+ for (int i = 0; i < UCA_PROP_LAST; i++) {
+ struct uca_property_t *prop = uca_get_full_property(i);
+ print_level(count_dots(prop->name));
+ printf("%s = ", prop->name);
+ switch (prop->type) {
+ case uca_string:
+ if (cam->get_property(cam, i, string_value) != UCA_ERR_PROP_INVALID) {
+ printf("%s ", string_value);
+ }
+ else
+ printf("n/a");
+ break;
+ case uca_uint32t:
+ if (cam->get_property(cam, i, &uint32_value) != UCA_ERR_PROP_INVALID) {
+ printf("%i %s", uint32_value, unit_map[prop->unit]);
+ }
+ else
+ printf("n/a");
+ break;
+ case uca_uint8t:
+ if (cam->get_property(cam, i, &uint8_value) != UCA_ERR_PROP_INVALID) {
+ printf("%i %s", uint8_value, unit_map[prop->unit]);
+ }
+ else
+ printf("n/a");
+ break;
+ }
+ printf("\n");
}
- printf("\n");
+ cam = cam->next;
}
uca_destroy(uca);