This example reads similarly to the Acquisition_C example, except that loops are used to allow for pseudo-simultaneous acquisitions.
#include "stdio.h"
#include "string.h"
#define MAX_BUFF_LEN 256
{
}
{
{
printf("Unable to retrieve node readability (%s node), with error %d...\n\n", nodeName, err);
}
return pbReadable;
}
{
{
printf("Unable to retrieve node writability (%s node), with error %d...\n\n", nodeName, err);
}
return pbWritable;
}
{
printf("Unable to get %s (%s %s retrieval failed).\n\n", node, name, node);
}
{
{
printf(
"Unable to retrieve GenICam nodemap. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
{
printf(
"Unable to retrieve TL device nodemap. Non-fatal error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
{
return err;
}
{
return err;
}
if (strcmp(deviceType, "GigEVision") != 0)
{
return 0;
}
if (enableHeartbeat)
{
printf("Resetting heartbeat...\n\n");
}
else
{
printf("Disabling heartbeat...\n\n");
}
{
printf(
"Unable to disable heartbeat on camera, error %d occurred. Continuing with execution as this "
"may be non-fatal...\n\n",
err);
}
if (!
IsWritable(hHeartbeatDisable,
"GevGVCPHeartbeatDisable"))
{
printf(
"Unable to disable heartbeat on camera, error %d occurred. Continuing with execution as this "
"may be non-fatal...\n\n",
err);
}
{
printf(
"Unable to disable heartbeat on camera (boolean node), error %d occured. Continuing with "
"execution as this may be non-fatal...\n\n",
err);
return err;
}
if (!enableHeartbeat)
{
printf("WARNING: Heartbeat has been disabled for the rest of this example run.\n");
printf(" Heartbeat will be reset upon the completion of this run. If the \n");
printf(" example is aborted unexpectedly before the heartbeat is reset, the\n");
printf(" camera may need to be power cycled to reset the heartbeat.\n\n");
}
else
{
printf("Heartbeat has been reset.\n\n");
}
return err;
}
{
}
{
}
{
unsigned int i = 0;
printf("\n*** IMAGE ACQUISITION ***\n\n");
for (i = 0; i < numCameras; i++)
{
{
printf(
"Unable to select camera. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
{
printf(
"Unable to retrieve GenICam nodemap. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
{
printf(
"Unable to retrieve TL device nodemap. Non-fatal error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
int64_t acquisitionModeContinuous = 0;
{
printf(
"Unable to set acquisition mode to continuous (node retrieval). Aborting with error: %s [%d]\n\n",
err);
return err;
}
if (
IsReadable(hAcquisitionMode,
"AcquisitionMode"))
{
{
printf(
"Unable to set acquisition mode to continuous (enum entry retrieval). Aborting with error "
"%d...\n\n",
err);
return err;
}
}
else
{
}
if (
IsReadable(hAcquisitionModeContinuous,
"AcquisitionModeContinuous"))
{
{
printf(
"Unable to set acquisition mode to continuous (enum entry int value retrieval). Aborting with "
"error %d...\n\n",
err);
return err;
}
}
else
{
}
if (
IsWritable(hAcquisitionMode,
"AcquisitionMode"))
{
{
printf(
"Unable to set acquisition mode to continuous (enum entry setting). Aborting with error %d...\n\n",
err);
return err;
}
}
else
{
}
printf("Camera %d acquisition mode set to continuous...\n", i);
#ifdef _DEBUG
#else
#endif
{
return err;
}
{
printf(
"Unable to begin image acquisition. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
{
printf(
"Unable to release camera. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
printf("Camera %d acquiring images...\n\n", i);
}
const unsigned int k_numImages = 10;
unsigned int imageCnt = 0;
{
printf(
"Unable to create image processor. Non-fatal error: %s [%d]\n\n",
GetLastErrorMessage(), err);
}
{
printf(
"Unable to set image processor color processing method. Non-fatal error: %s [%d]\n\n",
err);
}
for (imageCnt = 0; imageCnt < k_numImages; imageCnt++)
{
for (i = 0; i < numCameras; i++)
{
{
printf(
"Unable to select camera. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
{
{
printf(
"Unable to release camera. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
continue;
}
{
printf(
"Unable to determine image completion. Non-fatal error: %s [%d]\n\n",
GetLastErrorMessage(), err);
}
if (isIncomplete)
{
{
printf("Unable to retrieve image status. Non-fatal error %d...\n\n", imageStatus);
}
else
{
printf("Image incomplete with image status %d...\n", imageStatus);
}
}
if (hasFailed)
{
{
}
{
printf(
"Unable to release camera. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
continue;
}
size_t width = 0;
size_t height = 0;
printf("Camera %d grabbed image %d, ", i, imageCnt);
{
printf("width = unknown, ");
}
else
{
printf("width = %u, ", (unsigned int)width);
}
{
printf("height = unknown\n");
}
else
{
printf("height = %u\n", (unsigned int)height);
}
{
}
{
}
{
printf(
"Unable to retrieve TL device nodemap. Non-fatal error: %s [%d]\n\n",
GetLastErrorMessage(), err);
}
{
strcpy(deviceSerialNumber, "");
lenDeviceSerialNumber = 0;
}
else
{
err =
spinStringGetValue(hDeviceSerialNumber, deviceSerialNumber, &lenDeviceSerialNumber);
{
strcpy(deviceSerialNumber, "");
lenDeviceSerialNumber = 0;
}
printf("Device serial number retrieved as %s...\n", deviceSerialNumber);
}
if (lenDeviceSerialNumber == 0)
{
sprintf(filename, "AcquisitionMultipleCamera-C-%d.jpg", imageCnt);
}
else
{
sprintf(filename, "AcquisitionMultipleCamera-C-%s-%d.jpg", deviceSerialNumber, imageCnt);
}
{
}
else
{
printf("Image saved at %s\n\n", filename);
}
{
}
{
}
{
printf(
"Unable to release camera. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
}
}
{
printf(
"Unable to destroy image processor. Non-fatal error: %s [%d]\n\n",
GetLastErrorMessage(), err);
}
for (i = 0; i < numCameras; i++)
{
{
break;
}
{
}
{
printf(
"Unable to release camera. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
}
return err;
}
{
unsigned int i = 0;
printf("\n*** DEVICE INFORMATION ***\n\n");
{
return err;
}
size_t numFeatures = 0;
if (
IsReadable(hDeviceInformation,
"DeviceInformation"))
{
{
printf(
"Unable to retrieve number of nodes. Non-fatal error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
}
else
{
}
for (i = 0; i < numFeatures; i++)
{
{
continue;
}
{
strcpy(featureName, "Unknown name");
}
{
{
printf(
"Unable to retrieve node type. Non-fatal error: %s [%d]\n\n",
GetLastErrorMessage(), err);
continue;
}
}
else
{
printf("%s: Node not readable\n", featureName);
continue;
}
{
strcpy(featureValue, "Unknown value");
}
printf("%s: %s\n", featureName, featureValue);
}
printf("\n");
return err;
}
{
unsigned int i = 0;
printf("\n*** DEVICE INFORMATION ***\n\n");
for (i = 0; i < numCameras; i++)
{
{
break;
}
{
printf(
"Unable to retrieve TL device nodemap. Non-fatal error: %s [%d]\n\n",
GetLastErrorMessage(), err);
}
else
{
}
{
printf(
"Unable to release camera. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
}
for (i = 0; i < numCameras; i++)
{
{
break;
}
{
printf(
"Unable to initialize camera. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
{
printf(
"Unable to release camera. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
}
{
return err;
}
for (i = 0; i < numCameras; i++)
{
{
break;
}
#ifdef _DEBUG
{
printf(
"Unable to reset GVCP heartbeat. Non-fatal error: %s [%d]\n\n",
GetLastErrorMessage(), err);
}
#endif
{
printf(
"Unable to deinitialize camera. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
{
printf(
"Unable to release camera. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
}
return err;
}
{
FILE* tempFile;
tempFile = fopen("test.txt", "w+");
if (tempFile == NULL)
{
printf("Failed to create file in current folder. Please check "
"permissions.\n");
printf("Press Enter to exit...\n");
getchar();
return -1;
}
fclose(tempFile);
remove("test.txt");
printf("Application build date: %s %s \n\n", __DATE__, __TIME__);
{
printf(
"Unable to retrieve system instance. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
spinLibraryVersion hLibraryVersion;
printf(
"Spinnaker library version: %d.%d.%d.%d\n\n",
hLibraryVersion.major,
hLibraryVersion.minor,
hLibraryVersion.type,
hLibraryVersion.build);
{
printf(
"Unable to create camera list. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
{
printf(
"Unable to retrieve camera list. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
size_t numCameras = 0;
{
printf(
"Unable to retrieve number of cameras. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
printf("Number of cameras detected: %u\n\n", (unsigned int)numCameras);
if (numCameras == 0)
{
{
printf(
"Unable to clear camera list. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
{
printf(
"Unable to destroy camera list. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
{
printf(
"Unable to release system instance. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
printf("Not enough cameras!\n");
printf("Done! Press Enter to exit...\n");
getchar();
return -1;
}
printf("\nRunning example...\n");
{
errReturn = err;
}
printf("Example complete...\n\n");
{
printf(
"Unable to clear camera list. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
{
printf(
"Unable to destroy camera list. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
{
printf(
"Unable to release system instance. Aborting with error: %s [%d]\n\n",
GetLastErrorMessage(), err);
return err;
}
printf("\nDone! Press Enter to exit...\n");
getchar();
return errReturn;
}