summaryrefslogtreecommitdiffstats
path: root/test/test.c
blob: 6537b6b8924a3db920da8f445a2ad54ec2a5cba9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

#include <stdio.h>
#include "uca.h"

int main(int argc, char *argv[])
{
    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;
        }

        struct uca_t *uca = uca_init();
        if (uca == NULL) {
            printf("Couldn't find a camera\n");
            return 1;
        }

        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);

        uca_destroy(uca);
    }
    return 0;
}