summaryrefslogtreecommitdiffstats
path: root/test
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 /test
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 'test')
-rw-r--r--test/test.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/test/test.c b/test/test.c
index 84df874..6537b6b 100644
--- a/test/test.c
+++ b/test/test.c
@@ -4,22 +4,30 @@
int main(int argc, char *argv[])
{
- struct uca_t *uca = uca_init();
- if (uca == NULL) {
- printf("Couldn't find a camera\n");
+ if (argc < 2) {
+ printf("usage: uca <property-name>\n");
return 1;
}
+ else {
+ int property = uca_get_property_id(argv[1]);
+ if (property == UCA_PROP_INVALID) {
+ printf("Property invalid!\n");
+ return 1;
+ }
- uint32_t width = 2560, height = 2160;
+ struct uca_t *uca = uca_init();
+ if (uca == NULL) {
+ printf("Couldn't find a camera\n");
+ return 1;
+ }
- uca->cam_set_property(uca, UCA_PROP_WIDTH, &width);
- uca->cam_set_property(uca, UCA_PROP_HEIGHT, &height);
+ uint32_t value; /* this type should be right, most of the time */
+ if (uca->cam_get_property(uca, property, &value) == UCA_PROP_INVALID)
+ printf("Property not supported on this camera\n");
+ else
+ printf("%s = %u\n", argv[1], value);
- char camera_name[256] = "foobar";
- uca->cam_get_property(uca, UCA_PROP_NAME, camera_name);
-
- printf("Camera name: %s\n", camera_name);
-
- uca_destroy(uca);
+ uca_destroy(uca);
+ }
return 0;
}