summaryrefslogtreecommitdiffstats
path: root/src/main_client.cpp
blob: 19f366edb3178a2f83241383672715960224c4c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "UDPClient/UDPClient.h"
#include "DetectorModule/DetectorModule.h"
#include "Detector/Detector.h"

#include <boost/log/core.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/expressions.hpp>

#include <iostream>
#include <string>

void initLog() {
#ifndef NDEBUG
   boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::debug);
#else
   boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::info);
#endif
}

int main (int argc, char *argv[]){

  if(argc < 3){
     BOOST_LOG_TRIVIAL(error) << "Program usage: ./onlineDetectorSimulatorClient <images_per_second> <packet_size_in_byte>!";
     return 0;
  }

  int imagesPerSec = std::stoi(argv[1]);

  int packetSize = std::stoi(argv[2]);

  double timegap = 1./(double)imagesPerSec;
  unsigned int intervall = timegap*1000*1000;

  initLog();

  std::cout << "Sending UDP packages: " << std::endl;

  auto configPath = std::string { "config.cfg" };
  std::string address = "127.0.0.1";

  Detector detector{address, configPath, intervall, packetSize};

  //DetectorModule detModule0 = DetectorModule(1, address, configPath);

  detector.run();

  std::cin.ignore();

  return 0;

}