-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
33 lines (26 loc) · 945 Bytes
/
main.cpp
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
#include <QCoreApplication>
#include <QCommandLineParser>
#include "serialreader.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QCoreApplication::setApplicationName("Seeed 24GHz Radar Serial Reader");
QCoreApplication::setApplicationVersion("0.1");
QCommandLineParser parser;
parser.setApplicationDescription("Read serial data of a Seeed 24GHz Radar Sensor");
parser.addHelpOption();
parser.addVersionOption();
QCommandLineOption portOption("p", "port", "Serial port to read from.");
parser.addOption(portOption);
// Process the actual command line arguments given by the user
parser.process(a);
if (!parser.isSet(portOption)) {
qWarning() << "You need to set a serial port with -p.";
}
else{
QString serialPort = parser.value(portOption);
qDebug() << serialPort;
new SerialReader(serialPort);
return a.exec();
}
}