-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
69 lines (55 loc) · 1.44 KB
/
main.cpp
File metadata and controls
69 lines (55 loc) · 1.44 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//#define ENABLE_KINECT 0
#include <QCoreApplication>
#include <stdio.h>
#include <iostream>
#include <signal.h>
#include <QThread>
#include <opengev.h>
#include "devicewrapper.h"
#include "OpenNICamera/opennicamera.h"
#include "Kinect/kinectv2camera.h"
KinectV2Camera *kinect;
/*
* Check signal interrupt because stop starded kinect
* device can freeze operative system
*
*/
void sigint_handler(int s)
{
std::cout<<"quit signal called"<<std::endl;
kinect->quit();
}
using namespace std;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
OpenGEV::configure();
if(argc>1) {
char* p;
int device = strtol(argv[1], &p, 10);
if(device==1) {
OpenNICamera asus;
asus.start();
return a.exec();
}
if(device==2) {
kinect = new KinectV2Camera;
kinect->start();
//Correctly shutdown device on signal interrupt on console
signal(SIGINT,sigint_handler);
return a.exec();
}
if(device==3) {
int sizex = strtol(argv[2], &p, 10);
int sizey = strtol(argv[3], &p, 10);
DeviceWrapper w(sizex, sizey);
w.start();
return a.exec();
}
if(device<=0 || device >3)
std::cout<<"No valid device selected"<<std::endl;
} else {
std::cout<<"No valid device selected"<<std::endl;
}
return -1;
}