#include "examples.h"
void CAEN_MCA_EXAMPLES_DiscoverDevices(void) {
uint64_t timeout_ms = 3000;
library,
timeout_ms
);
uint32_t cnt_found = 0;
if (ip_addresses != NULL) ip_addresses[i] = calloc(
DISCOVERY_IP_MAXLEN,
sizeof(*ip_addresses[i]));
if (model_names != NULL) model_names[i] = calloc(
DISCOVERY_IP_MAXLEN,
sizeof(*ip_addresses[i]));
}
library,
&cnt_found,
names,
serial_numbers,
ip_addresses,
input_channels,
model_names,
paths
);
fprintf(stderr, "%s(): failed. Error: '%"PRIi32"'.\n", __func__, ret);
}
else {
fprintf(stdout, "Number of devices found: %"PRIu32"\n", cnt_found);
for (uint32_t i = 0; i < cnt_found; i++) {
fprintf(stdout, "%"PRIu32": ", i);
fprintf(stdout, "Name: %s\t", names[i]);
fprintf(stdout, "Model name: %s\t", model_names[i]);
fprintf(stdout, "Serial number: %"PRIu32"\t", serial_numbers[i]);
fprintf(stdout, "Input channels: %"PRIu32"\t", input_channels[i]);
fprintf(stdout, "IP address: %s\t", ip_addresses[i]);
fprintf(stdout, "Path: %s\t", paths[i]);
fprintf(stdout, "\n");
}
}
if (names != NULL) free(names[i]);
if (ip_addresses != NULL) free(ip_addresses[i]);
if (model_names != NULL) free(model_names[i]);
if (paths != NULL) free(paths[i]);
}
free(names);
free(ip_addresses);
free(model_names);
free(paths);
}