summaryrefslogtreecommitdiffstats
path: root/src/main_client.cpp
blob: 28c472cf8d29801cbf7e85b512ab9c94fb2ea9b0 (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
#include "UDPClient/UDPClient.h"
#include "DetectorModule/DetectorModule.h"
#include "Detector/Detector.h"

#include <iostream>
#include <string>


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

  if(argc < 5){
     std::cerr << "Program usage: ./onlineDetectorSimulatorClient <address> <first_port> <num_ports> <packets_per_second>";
     return 0;
  }

  std::string address = argv[1];
  int firstPort = std::stoi(argv[2]);
  int numPorts = std::stoi(argv[3]);
  int imagesPerSec = std::stoi(argv[4]);


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

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

  auto configPath = std::string { "config.cfg" };
  
  Detector detector{address, configPath, firstPort, numPorts, intervall};

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

  detector.run();

  std::cin.ignore();

  return 0;

}