From 06890f4bd07aa24f4205a0573c0a57a8c3e9f6b0 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Fri, 25 Feb 2011 12:24:20 +0100 Subject: Property re-ordering. Made test program more useful --- test/test.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'test') 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 \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; } -- cgit v1.2.3