This is example source code showing how to use the image capture functionality of AxsunOCTCapture in a ANSI C client application.
#include <stdio.h>
#include <windows.h>
#include <conio.h>
#define PCIEMODE // comment this line out for Ethernet interface, leave uncommented for PCIe interface
int main()
{
printf("Welcome to the AxsunOCTCapture Example Console Application (ANSI C version).\n");
AxErr retval = NO_AxERROR;
char message[512];
uint32_t imaging, last_packet, last_frame, last_image, dropped_packets, frames_since_sync, returned_image_number, required_buffer_size;
int32_t height, width;
uint8_t force_trig, trig_too_fast;
#ifdef PCIEMODE
#else
#endif
printf(message); printf("\n");
if (retval =
axSetupDisplay(session, 0, 0, 0, 1024, 512, NULL))
goto axerror;
#ifdef PCIEMODE
#endif
int32_t counter = 0;
while (!_kbhit()) {
if (retval =
axGetStatus(session, &imaging, &last_packet, &last_frame, &last_image, &dropped_packets, &frames_since_sync))
goto axerror;
if (imaging) {
if (retval =
axGetImageInfoAdv(session, -1, &returned_image_number, &height, &width, &data_type, &required_buffer_size, &force_trig, &trig_too_fast)) {
printf("axGetImageInfo() returned %d ", retval);
printf(message); printf("\n");
}
else {
retval =
axDisplayImage(session, returned_image_number, &returned_image_number, &height, &width);
if (!(counter % 25)) {
printf("Image number: %d, Width: %d, Dropped Packets: %d", returned_image_number, width, dropped_packets);
if (force_trig) printf(" *** TRIGGER TOO SLOW, FORCE TRIGGERED ***");
if (trig_too_fast) printf(" *** TRIGGER TOO FAST ***");
printf("\n");
}
}
}
else {
if (!(counter % 50)) {
printf("Imaging is off. Turn on laser emission and set DAQ to Imaging On mode.\n");
}
}
counter++;
Sleep(33);
}
#ifdef PCIEMODE
#endif
axerror:
if (retval) {
printf("Error %: ", retval);
printf(message); printf("\n");
}
printf("Quitting...\n\n");
}