#ifdef WIN32
#include <windows.h>
#else
#include <csignal>
#endif
 
 
static void Exithandler(int sig);
 
#ifdef WIN32
BOOL WINAPI ConsoleHandler(DWORD CEvent)
{
    Exithandler(CEvent);
    return TRUE;
}
#endif
 
 
#include <iostream>
#include <thread>
#include <chrono>
 
 
static bool running = true;
 
static const uint32_t numberOfSamplesToGrab = 100;
 
{    
    {
        static uint32_t samplesGrabbed = 0;
        if (samplesGrabbed++ >= numberOfSamplesToGrab)
            running = false;
 
            std::cout << 
"Detected " << pose.
name << 
"\n";
 
    }
} listener;
 
static void Exithandler(int sig)
{
    running = false;
}
 
int main(int argc, char *argv[])
{
    
#ifdef WIN32
    SetConsoleCtrlHandler((PHANDLER_ROUTINE)ConsoleHandler, TRUE);
#else
    signal(SIGTERM, Exithandler);
    signal(SIGKILL, Exithandler);
    signal(SIGQUIT, Exithandler);
    signal(SIGINT, Exithandler);
#endif
 
    
    
    try
    {
        
#ifdef WIN32
#else
        
        
#endif
 
        
        std::cout << 
"Running PST Server version " << pst.
GetVersionInfo() << 
"\n";
 
 
        
        
        std::cout << "Put the Reference card in front of the PST in order to see tracking results.\n\n";
        
        
        
        
        std::cout << 
"System check: " << (int)pst.
Systemcheck() << 
"\n";
 
        
        
        std::cout << 
"Found " << targets.
size() << 
" tracking targets:\n";
 
            std::cout << t.name << "\t" << t.status << "\n";
        std::cout << "\n";
 
        
        
 
        
        
        std::cout << "3D marker positions making up the Reference target:\n";
        for (auto& marker : markers)
            std::cout << "x: " << marker[0] << "\t" << "y: " << marker[1] << "\t" << "z: " << marker[2] << "\n";
        std::cout << "\n";
        
        
        while (running)
        {
            std::this_thread::sleep_for(std::chrono::milliseconds(100));
        }
    }
    {
        
    }
    
    
 
    
    std::cout << "Press enter to continue...\n";
    std::cin.get();
 
    return 0;
}