Cross platform example: This example shows the implementation of a TCP streaming server application.
Cross platform example: This example shows the implementation of a TCP streaming server application.
#include <iostream>
#ifdef _WIN32
#include<winsock2.h>
#include<WS2tcpip.h>
#else
#include <csignal>
#endif
#include <IRLogger.h>
#include "IRDaemon.h"
#define DIRECT_DAEMON_PORT 1337
#ifdef _WIN32
BOOL ctrlHandler(DWORD fdwCtrlType)
{
if(_daemon) _daemon->
exit();
return true;
}
#else
void sigHandler(int signum)
{
if(_daemon) _daemon->
exit();
}
#endif
int main(int argc, char* argv[])
{
#ifdef _WIN32
SetConsoleCtrlHandler((PHANDLER_ROUTINE)ctrlHandler, TRUE);
#else
std::signal(SIGINT, sigHandler);
#endif
if(argc < 2)
{
std::cout << "No parameters given, taking default parameters. If you want to specify your own parameters, pass an xml file:" << std::endl << " ";
std::cout << argv[0] << " <path to xml file>" << std::endl;
IRDeviceParams_InitDefault(params);
}
else
{
}
IRDeviceParams_Print(params);
_daemon->
run(¶ms, DIRECT_DAEMON_PORT);
delete _daemon;
return 0;
}
Daemon providing IRImager data via TCP.
Definition: IRDaemon.h:27
void exit()
Notifies run method to terminate.
bool run(evo::IRDeviceParams *params, int port)
Blocking run method: Instantiates camera and streaming objects.
static bool readXMLC(const char *xmlFile, IRDeviceParams ¶ms)
Static xml parsing method for 8-bit character path.
static void setVerbosity(IRLoggerVerbosityLevel levelStdout, IRLoggerVerbosityLevel levelFile, const char *filename=NULL)
Change verbosity level.
Structure containing device parameters.
Definition: IRDeviceParams.h:125