This is example source code showing how to use the image capture functionality of AxsunOCTCapture in a C++ client application.
#include <iostream>
#include <chrono>
#include <thread>
#include <conio.h>
using namespace std::chrono_literals;
class AxsunOCTCapture {
private:
public:
AxsunOCTCapture(int32_t capacity) {
if (
auto retval =
axStartSession(&session_, capacity))
throw retval; }
AOChandle operator()() {
if (session_)
return session_;
else throw AxErr::CAPTURE_SESSION_NOT_SETUP; }
};
int main() {
char message[512];
try {
std::cout << "Welcome to the AxsunOCTCapture Example Console Application (C++ version).\n";
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;
AxsunOCTCapture AOC(100);
#ifdef PCIEMODE
#else
#endif
if (
auto retval =
axGetMessage(AOC(), message))
throw retval;
std::cout << message << "\n";
if (
auto retval =
axSetupDisplay(AOC(), 0, 0, 0, 1024, 512, NULL))
throw retval;
#ifdef PCIEMODE
#endif
int32_t counter = 0;
while (!_kbhit()) {
if (
auto retval =
axGetStatus(AOC(), &imaging, &last_packet, &last_frame, &last_image, &dropped_packets, &frames_since_sync))
throw retval;
if (imaging) {
if (
auto retval =
axGetImageInfoAdv(AOC(), -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(AOC(), 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++;
std::this_thread::sleep_for(33ms);
}
#ifdef PCIEMODE
#endif
}
std::cout << "ERROR: " << message << "\n";
}
catch (...) {
std::cout << "***** UNKNOWN ERROR. Program terminating.\n";
}
std::cout << "Quitting...\n\n";
}