This example can be found in Development\sharedmemory\sharedmemory.cpp.
This example shows how to activate the shared memory communication pipeline that enables communication of the PST Client application through the PST SDK. Note that for the shared memory pipeline to function, the application has to run with elevated access (administrator rights). After enabling shared memory, the PST Client application can be used to download calibration information and manage tracking targets.
#ifdef WIN32
#include <windows.h>
#endif
static void Exithandler(int sig);
#ifdef WIN32
BOOL WINAPI ConsoleHandler(DWORD CEvent)
{
Exithandler(CEvent);
return TRUE;
}
#endif
#include <memory>
#include <iostream>
std::shared_ptr<PSTech::pstsdk::Tracker> pst;
static void Exithandler(int sig)
{
pst->Shutdown();
}
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
{
pst = std::make_shared<PSTech::pstsdk::Tracker>();
pst->Start();
pst->EnableSharedMemory();
Sleep(60000);
pst->DisableSharedMemory();
}
{
}
pst->Shutdown();
return 0;
}