Пример #1
0
void loop()
{
    eprintf("-------------------- GO ! --------------------\n");
    int i = 10, j = 0, count;
    float value[] = {0., 0., 0., 0.};

    while ((!terminate || i < 50) && !done) {
        for (j = 0; j < 4; j++)
            value[j] = (i % 10) * 1.0f;
        for (j = 0; j < 4; j++) {
            mapper_signal_update(recvsig[j], value, 0, MAPPER_NOW);
        }
        eprintf("\ndestination values updated to %f -->\n", (i % 10) * 1.0f);
        for (j = 0; j < 4; j++) {
            sent += count = mapper_signal_query_remotes(sendsig[j], MAPPER_NOW);
            eprintf("Sent %i queries for sendsig[%i]\n", count, j);
        }
        mapper_device_poll(destination, 50);
        mapper_device_poll(source, 50);
        i++;

        if (!verbose) {
            printf("\r  Sent: %4i, Received: %4i   ", sent, received);
            fflush(stdout);
        }
    }
}
Пример #2
0
int setup_maps()
{
    mapper_map map = mapper_map_new(num_sources, sendsigs, 1, &recvsig);
    if (!map) {
        eprintf("Failed to create map\n");
        return 1;
    }
    mapper_map_set_mode(map, MAPPER_MODE_EXPRESSION);

    // build expression string
    int i, offset = 2, len = num_sources * 3 + 3;
    char expr[len];
    snprintf(expr, 3, "y=");
    for (i = 0; i < num_sources; i++) {
        mapper_slot slot = mapper_map_slot_by_signal(map, sendsigs[i]);
        snprintf(expr + offset, len - offset, "-x%d", mapper_slot_index(slot));
        if (i > 0)
            mapper_slot_set_causes_update(slot, 0);
        offset += 3;
    }
    mapper_map_set_expression(map, expr);
    mapper_map_push(map);

    // wait until mappings have been established
    while (!done && !mapper_map_ready(map)) {
        for (i = 0; i < num_sources; i++)
            mapper_device_poll(sources[i], 10);
        mapper_device_poll(destination, 10);
    }

    return 0;
}
Пример #3
0
int setup_maps()
{
    int i;
    mapper_map maps[4] = {0, 0, 0, 0};
    for (i = 0; i < 2; i++) {
        maps[i] = mapper_map_new(1, &sendsig[i], 1, &recvsig[i]);
        mapper_map_push(maps[i]);
    }

    // swap the last two signals to mix up signal vector lengths
    maps[2] = mapper_map_new(1, &sendsig[2], 1, &recvsig[3]);
    mapper_map_push(maps[2]);
    maps[3] = mapper_map_new(1, &sendsig[3], 1, &recvsig[2]);
    mapper_map_push(maps[3]);

    i = 0;
    int ready = 0;
    // wait until mapping has been established
    while (!done && !ready) {
        mapper_device_poll(source, 10);
        mapper_device_poll(destination, 10);
        if (i++ > 100)
            return 1;
        ready = 1;
        for (i = 0; i < 4; i++) {
            if (!mapper_map_ready(maps[i])) {
                ready = 0;
                break;
            }
        }
    }

    return 0;
}
Пример #4
0
void wait_ready()
{
    while (!(mapper_device_ready(source) && mapper_device_ready(destination))) {
        mapper_device_poll(source, 10);
        mapper_device_poll(destination, 10);
    }
}
Пример #5
0
void loop()
{
    eprintf("Polling device..\n");
	int i = 0;
	float j=1;
	while ((!terminate || i < 50) && !done) {
        j=i;
        mapper_timetag_t now;
        mapper_timetag_now(&now);
        mapper_device_start_queue(source, now);
		mapper_device_poll(source, 0);
        eprintf("Updating signal %s to %f\n", mapper_signal_name(sendsig), j);
        mapper_signal_update(sendsig, &j, 0, now);
		mapper_signal_update(sendsig1, &j, 0, now);
		mapper_device_send_queue(sendsig->device, now);
		sent = sent+2;
        mapper_device_poll(destination, 100);
        i++;

        if (!verbose) {
            printf("\r  Sent: %4i, Received: %4i   ", sent, received);
            fflush(stdout);
        }
    }
}
Пример #6
0
void wait_ready()
{
    while (!done && !(mapper_device_ready(source)
                      && mapper_device_ready(destination))) {
        mapper_device_poll(source, 0);
        mapper_device_poll(destination, 0);
        usleep(500 * 1000);
    }
}
Пример #7
0
void loop()
{
    int i;
    for (i = 0; i < 10; i++) {
        mapper_device_poll(source, 0);
        printf("Updating signal %s to %f\n", mapper_signal_name(sendsig),
               (i * 1.0f));
        mapper_signal_update_float(sendsig, (i * 1.0f));
        sent++;
        mapper_device_poll(destination, 100);
    }
}
Пример #8
0
int setup_map()
{
    map = mapper_map_new(1, &sendsig, 1, &recvsig);
    mapper_map_push(map);

    // wait until map is established
    while (!mapper_map_ready(map)) {
        mapper_device_poll(destination, 10);
        mapper_device_poll(source, 10);
    }

    return 0;
}
Пример #9
0
void map_signals()
{
    mapper_map map = mapper_map_new(1, &sendsig, 1, &recvsig);
    mapper_map_set_mode(map, MAPPER_MODE_EXPRESSION);
    mapper_map_set_expression(map, "y{-1}=-10;y=y{-1}+1");
    mapper_map_push(map);

    // wait until mapping has been established
    while (!done && !mapper_map_ready(map)) {
        mapper_device_poll(source, 10);
        mapper_device_poll(destination, 10);
    }
}
Пример #10
0
void set_map_protocol(mapper_protocol proto)
{
    if (!map || (mapper_map_protocol(map) == proto))
        return;

    mapper_map_set_protocol(map, proto);
    mapper_map_push(map);

    // wait until change has taken effect
    while (mapper_map_protocol(map) != proto) {
        mapper_device_poll(source, 10);
        mapper_device_poll(destination, 10);
    }
}
Пример #11
0
int setup_maps()
{
    mapper_map map = mapper_map_new(1, &sendsig, 1, &recvsig);
    mapper_map_set_mode(map, MAPPER_MODE_EXPRESSION);
    mapper_map_set_expression(map, "y=x*10");
    mapper_map_push(map);

    // wait until mapping has been established
    while (!done && !mapper_map_ready(map)) {
        mapper_device_poll(source, 10);
        mapper_device_poll(destination, 10);
    }

    return 0;
}
Пример #12
0
int create_maps()
{
    mapper_map maps[2];
    maps[0] = mapper_map_new(1, &sendsig, 1, &recvsig);
    mapper_map_push(maps[0]);
    maps[1] = mapper_map_new(1, &sendsig1, 1, &recvsig);
    mapper_map_push(maps[1]);

    // wait until mapping has been established
    while (!done && !mapper_map_ready(maps[0]) && !mapper_map_ready(maps[1])) {
        mapper_device_poll(source, 10);
        mapper_device_poll(destination, 10);
    }

    return 0;
}
Пример #13
0
// *********************************************************
// -(poll libmapper)----------------------------------------
void impmap_poll(impmap *x)
{
    mapper_device_poll(x->device, 0);
    if (!x->ready) {
        if (mapper_device_ready(x->device)) {
            x->ready = 1;

            // create a new generic output signal
            x->dummy_output = mapper_device_add_output_signal(x->device,
                                                              "CONNECT_TO_DESTINATION",
                                                              1, 'f', 0, 0, 0);

            // create a new generic input signal
            x->dummy_input = mapper_device_add_input_signal(x->device,
                                                            "CONNECT_TO_SOURCE",
                                                            1, 'f', 0, 0, 0, 0, x);

            impmap_print_properties(x);
        }
    }
    if (x->new_in) {
        outlet_anything(x->outlet1, gensym("list"), x->size_in, x->buffer_in);
        x->new_in = 0;
    }
    clock_delay(x->clock, INTERVAL);  // Set clock to go off after delay
}
Пример #14
0
int test_network()
{
    int error = 0, wait;

    net = mapper_network_new(0, 0, 0);
    if (!net) {
        eprintf("Error creating network structure.\n");
        return 1;
    }

    eprintf("Network structure initialized.\n");

    dev = mapper_device_new("testnetwork", 0, net);
    if (!dev) {
        eprintf("Error creating device structure.\n");
        return 1;
    }

    eprintf("Device structure initialized.\n");

    eprintf("Found interface %s has IP %s\n", net->interface_name,
           inet_ntoa(net->interface_ip));

    while (!dev->local->registered) {
        mapper_device_poll(dev, 100);
    }

    eprintf("Using port %d.\n", mapper_device_port(dev));
    eprintf("Allocated ordinal %d.\n", dev->local->ordinal.value);

    eprintf("Delaying for 5 seconds..\n");
    wait = 50;
    while (wait-- > 0) {
        mapper_device_poll(dev, 100);
        if (!verbose) {
            printf(".");
            fflush(stdout);
        }
    }

    mapper_device_free(dev);
    eprintf("Device structure freed.\n");
    mapper_network_free(net);
    eprintf("Network structure freed.\n");

    return error;
}
Пример #15
0
void wait_ready(int *cancel)
{
    int i, keep_waiting = 1;
    while (keep_waiting && !*cancel) {
        keep_waiting = 0;

        for (i = 0; i < num_sources; i++) {
            mapper_device_poll(sources[i], 50);
            if (!mapper_device_ready(sources[i])) {
                keep_waiting = 1;
            }
        }
        mapper_device_poll(destination, 50);
        if (!mapper_device_ready(destination))
            keep_waiting = 1;
    }
}
Пример #16
0
void loop()
{
    eprintf("-------------------- GO ! --------------------\n");
    int i = 0;
    float value = 0;
    mapper_id instance;

    while (i < iterations && !done) {
        // here we should create, update and destroy some instances
        instance = (rand() % 10);
        switch (rand() % 5) {
            case 0:
                // try to destroy an instance
                eprintf("--> Retiring sender instance %"PR_MAPPER_ID"\n", instance);
                mapper_signal_instance_release(sendsig, (long)instance, MAPPER_NOW);
                break;
            default:
                // try to update an instance
                value = (rand() % 10) * 1.0f;
                mapper_signal_instance_update(sendsig, instance, &value, 0,
                                              MAPPER_NOW);
                eprintf("--> sender instance %"PR_MAPPER_ID" updated to %f\n",
                        instance, value);
                sent++;
                break;
        }

        mapper_device_poll(destination, 100);
        mapper_device_poll(source, 0);
        i++;

        if (verbose) {
            print_instance_ids(sendsig);
            print_instance_ids(recvsig);
            eprintf("\n");

            print_instance_vals(sendsig);
            print_instance_vals(recvsig);
            printf("\n");
        }
        else {
            printf("\r  Sent: %4i, Received: %4i   ", sent, received);
            fflush(stdout);
        }
    }
}
Пример #17
0
void loop()
{
    eprintf("Polling device..\n");
    int i = 0;
    while ((!terminate || i < 50) && !done) {
        mapper_device_poll(source, 0);
        eprintf("Updating signal %s to %f\n", mapper_signal_name(sendsig),
                (i * 1.0f));
        mapper_signal_update_float(sendsig, (i * 1.0f));
        sent++;
        mapper_device_poll(destination, 100);
        i++;

        if (!verbose) {
            printf("\r  Sent: %4i, Received: %4i   ", sent, received);
            fflush(stdout);
        }
    }
}
Пример #18
0
void loop()
{
    eprintf("Polling device..\n");
    int i = 0, j;
    while ((!terminate || i < 50) && !done) {
        for (j = 0; j < num_sources; j++) {
            mapper_device_poll(sources[j], 0);
            eprintf("Updating signal %s/%s = %i\n", sources[j]->name,
                    sendsigs[j]->name, i);
            mapper_signal_update_int(sendsigs[j], i);
        }
        sent++;
        mapper_device_poll(destination, 100);
        i++;

        if (!verbose) {
            printf("\r  Sent: %4i, Received: %4i   ", sent, received);
            fflush(stdout);
        }
    }
}
Пример #19
0
int main(int argc, char **argv)
{
    int i, j, seen, result = 0;

    // process flags for -v verbose, -h help
    for (i = 1; i < argc; i++) {
        if (argv[i] && argv[i][0] == '-') {
            int len = strlen(argv[i]);
            for (j = 1; j < len; j++) {
                switch (argv[i][j]) {
                    case 'h':
                        eprintf("testprops.c: possible arguments "
                                "-q quiet (suppress output), "
                                "-h help\n");
                        return 1;
                        break;
                    case 'q':
                        verbose = 0;
                        break;
                    default:
                        break;
                }
            }
        }
    }

    mapper_device dev = mapper_device_new("testprops", 0, 0);
    mapper_signal sig = mapper_device_add_input_signal(dev, "test", 1, 'f', "Hz",
                                                       0, 0, 0, 0);

    while (!mapper_device_ready(dev)) {
        mapper_device_poll(dev, 100);
    }

    /* Test that default parameters are all listed. */
    eprintf("Test 1:  checking default parameters... ");
    seen = check_keys(sig);
    if (seen != (SEEN_DIR | SEEN_LENGTH | SEEN_NAME | SEEN_TYPE | SEEN_UNIT)) {
        eprintf("ERROR\n");
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    /* Test that adding maximum causes it to be listed. */
    float mx = 35.0;
    mapper_signal_set_maximum(sig, &mx);
    eprintf("Test 2:  adding static property 'maximum'... ");
    seen = check_keys(sig);
    if (seen != (SEEN_DIR | SEEN_LENGTH | SEEN_NAME | SEEN_TYPE | SEEN_UNIT
                 | SEEN_MAX)) {
        eprintf("ERROR\n");
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    /* Test that adding an extra parameter causes the extra parameter
     * to be listed. */
    char *str = "test_value";
    mapper_signal_set_property(sig, "test", 1, 's', str, 1);
    eprintf("Test 3:  adding extra string property 'test'... ");
    seen = check_keys(sig);
    if (seen != (SEEN_DIR | SEEN_LENGTH | SEEN_NAME | SEEN_TYPE | SEEN_UNIT
                 | SEEN_MAX | SEEN_TEST)) {
        eprintf("ERROR\n");
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("Test 4:  retrieving property 'test'... ");
    char type;
    const void *val;
    int length;
    if (mapper_signal_property(sig, "test", &length, &type, &val)) {
        eprintf("ERROR\n");
        result = 1;
        goto cleanup;
    }
    eprintf("OK\n");

    eprintf("\t checking type: %c ... ", type);
    if (type != 's') {
        eprintf("ERROR (expected %c)\n", 's');
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("\t checking length: %d ... ", length);
    if (length != 1) {
        eprintf("ERROR (expected %d)\n", 1);
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("\t checking value: '%s' ... ", (char*)val);
    if (strcmp((char*)val, str)) {
        eprintf("ERROR (expected '%s')\n", str);
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    /* Test that removing an extra parameter causes the extra
     * parameter to _not_ be listed. */
    mapper_signal_remove_property(sig, "test");
    eprintf("Test 5:  removing extra property 'test'... ");
    seen = check_keys(sig);
    if (seen != (SEEN_DIR | SEEN_LENGTH | SEEN_NAME | SEEN_TYPE | SEEN_UNIT
                 | SEEN_MAX)) {
        eprintf("ERROR\n");
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    /* Test that adding two more properties works as expected. */
    int x = 123;
    mapper_signal_set_property(sig, "x", 1, 'i', &x, 1);
    int y = 234;
    mapper_signal_set_property(sig, "y", 1, 'i', &y, 1);
    eprintf("Test 6:  adding extra integer properties 'x' and 'y'... ");
    seen = check_keys(sig);
    if (seen != (SEEN_DIR | SEEN_LENGTH | SEEN_NAME | SEEN_TYPE | SEEN_UNIT
                 | SEEN_MAX | SEEN_X | SEEN_Y)) {
        eprintf("ERROR\n");
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    /* Test the type and value associated with "x". */
    eprintf("Test 7:  retrieving property 'x'...");
    if (mapper_signal_property(sig, "x", &length, &type, &val)) {
        eprintf("ERROR\n");
        result = 1;
        goto cleanup;
    }
    eprintf("OK\n");

    eprintf("\t checking type: %c ... ", type);
    if (type != 'i') {
        eprintf("ERROR (expected %c)\n", 'i');
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("\t checking length: %d ... ", length);
    if (length != 1) {
        eprintf("ERROR (expected %d)\n", 1);
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("\t checking value: %i ... ", *(int*)val);
    if (*(int*)val != 123) {
        eprintf("ERROR (expected %d)\n", 123);
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    /* Check that there is no value associated with previously-removed
     * "test". */
    eprintf("Test 8:  retrieving removed property 'test': ");
    if (!mapper_signal_property(sig, "test", &length, &type, &val)) {
        eprintf("found... ERROR\n");
        result = 1;
        goto cleanup;
    }
    else
        eprintf("not found... OK\n");

    /* Check that there is an integer value associated with static,
     * required property "length". */
    eprintf("Test 9:  retrieving static, required property 'length'... ");
    if (mapper_signal_property(sig, "length", &length, &type, &val)) {
        eprintf("not found... ERROR\n");
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("\t checking type: %c ... ", type);
    if (type != 'i') {
        eprintf("ERROR (expected %c)\n", 'i');
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("\t checking length: %d ... ", length);
    if (length != 1) {
        eprintf("ERROR (expected %d)\n", 1);
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("\t checking value: '%d' ... ", *(int*)val);
    if (*(int*)val != 1) {
        eprintf("ERROR (expected %d)\n", 1);
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    /* Check that there is a string value associated with static,
     * required property "name". */
    eprintf("Test 10: retrieving static, required property 'name'... ");
    if (mapper_signal_property(sig, "name", &length, &type, &val)) {
        eprintf("not found... ERROR\n");
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("\t checking type: %c ... ", type);
    if (type != 's') {
        eprintf("ERROR (expected %c)\n", 's');
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("\t checking length: %d ... ", length);
    if (length != 1) {
        eprintf("ERROR (expected %d)\n", 1);
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("\t checking value: '%s' ... ", (char*)val);
    if (strcmp((char*)val, "test")) {
        eprintf("ERROR (expected '%s')\n", str);
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    /* Check that there is a float value associated with static,
     * optional property "max". */
    eprintf("Test 11: retrieving static, optional property 'max'... ");
    if (mapper_signal_property(sig, "max", &length, &type, &val)) {
        eprintf("not found... ERROR\n");
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("\t checking type: %c ... ", type);
    if (type != 'f') {
        eprintf("ERROR (expected %c)\n", 'f');
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("\t checking length: %d ... ", length);
    if (length != 1) {
        eprintf("ERROR (expected %d)\n", 1);
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("\t checking value: '%f' ... ", *(float*)val);
    if (*(float*)val != 35.0f) {
        eprintf("ERROR (expected %f)\n", *(float*)val);
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    /* Test that removing maximum causes it to _not_ be listed. */
    mapper_signal_set_maximum(sig, 0);
    eprintf("Test 12: removing optional property 'max'... ");
    seen = check_keys(sig);
    if (seen & SEEN_MAX)
    {
        eprintf("ERROR\n");
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("Test 13: retrieving optional property 'max': ");
    if (!mapper_signal_property(sig, "max", &length, &type, &val)) {
        eprintf("found... ERROR\n");
        result = 1;
        goto cleanup;
    }
    else
        eprintf("not found... OK\n");

    /* Test adding and retrieving an integer vector property. */
    eprintf("Test 14: adding an extra integer vector property 'test'... ");
    int set_int[] = {1, 2, 3, 4, 5};
    mapper_signal_set_property(sig, "test", 5, 'i', &set_int, 1);
    seen = check_keys(sig);
    if (seen != (SEEN_DIR | SEEN_LENGTH | SEEN_NAME | SEEN_TYPE | SEEN_UNIT
                 | SEEN_X | SEEN_Y | SEEN_TEST))
    {
        eprintf("ERROR\n");
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("Test 15: retrieving vector property 'test': ");
    if (mapper_signal_property(sig, "test", &length, &type, &val)) {
        eprintf("not found... ERROR\n");
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("\t checking type: %c ... ", type);
    if (type != 'i') {
        eprintf("ERROR (expected %c)\n", 'i');
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("\t checking length: %d ... ", length);
    if (length != 5) {
        eprintf("ERROR (expected %d)\n", 1);
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    int *read_int = (int*)val;
    int matched = 0;
    eprintf("\t checking value: [%i,%i,%i,%i,%i] ... ", read_int[0],
           read_int[1], read_int[2], read_int[3], read_int[4]);
    for (i = 0; i < 5; i++) {
        if (read_int[i] == set_int[i])
            matched++;
    }
    if (matched != 5) {
        eprintf("ERROR (expected [%i,%i,%i,%i,%i])\n", set_int[0],
               set_int[1], set_int[2], set_int[3], set_int[4]);
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    /* Test rewriting 'test' as float vector property. */
    eprintf("Test 16: rewriting 'test' as vector float property... ");
    float set_float[] = {10., 20., 30., 40., 50.};
    mapper_signal_set_property(sig, "test", 5, 'f', &set_float, 1);
    seen = check_keys(sig);
    if (seen != (SEEN_DIR | SEEN_LENGTH | SEEN_NAME | SEEN_TYPE | SEEN_UNIT
                 | SEEN_X | SEEN_Y | SEEN_TEST))
    {
        eprintf("ERROR\n");
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("Test 17: retrieving property 'test'... ");
    if (mapper_signal_property(sig, "test", &length, &type, &val)) {
        eprintf("not found... ERROR\n");
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("\t checking type: %c ... ", type);
    if (type != 'f') {
        eprintf("ERROR (expected '%c')\n", 'f');
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("\t checking length: %i ... ", length);
    if (length != 5) {
        eprintf("ERROR (expected %d)\n", length);
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    float *read_float = (float*)val;
    eprintf("\t checking value: [%f,%f,%f,%f,%f] ... ", read_float[0],
           read_float[1], read_float[2], read_float[3], read_float[4]);
    matched = 0;
    for (i = 0; i < 5; i++) {
        if (read_float[i] == set_float[i])
            matched++;
    }
    if (matched != 5) {
        eprintf("ERROR (expected [%f,%f,%f,%f,%f]\n", set_float[0],
               set_float[1], set_float[2], set_float[3], set_float[4]);
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    /* Test rewriting property 'test' as string vector property. */
    eprintf("Test 18: rewriting 'test' as vector string property... ");
    char *set_string[] = {"foo", "bar"};
    mapper_signal_set_property(sig, "test", 2, 's', &set_string, 1);
    seen = check_keys(sig);
    if (seen != (SEEN_DIR | SEEN_LENGTH | SEEN_NAME | SEEN_TYPE | SEEN_UNIT
                 | SEEN_X | SEEN_Y | SEEN_TEST))
    {
        eprintf("ERROR\n");
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("Test 19: retrieving property 'test'... ");
    if (mapper_signal_property(sig, "test", &length, &type, &val)) {
        eprintf("not found... ERROR\n");
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("\t checking type: %c ... ", type);
    if (type != 's') {
        eprintf("ERROR (expected '%c')\n", 's');
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    eprintf("\t checking length: %d ...", length);
    if (length != 2) {
        eprintf("ERROR (expected %d)\n", 2);
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

    char **read_string = (char**)val;
    eprintf("\t checking value: ['%s','%s'] ... ",
           read_string[0], read_string[1]);
    matched = 0;
    for (i = 0; i < 2; i++) {
        if (read_string[i] && strcmp(read_string[i], set_string[i]) == 0)
            matched++;
    }
    if (matched != 2) {
        eprintf("ERROR (expected ['%s','%s'])\n", set_string[0], set_string[1]);
        result = 1;
        goto cleanup;
    }
    else
        eprintf("OK\n");

  cleanup:
    if (dev) mapper_device_free(dev);
    if (!verbose)
        printf("..................................................");
    printf("Test %s.\n", result ? "FAILED" : "PASSED");
    return result;
}