source: flair-src/trunk/tools/FlairGCS/src/main.cpp@ 176

Last change on this file since 176 was 45, checked in by Sanahuja Guillaume, 8 years ago

added compile info

File size: 1.5 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
5#include <QApplication>
6#include <QCleanlooksStyle>
7#include <QLocale>
8#include <qmetatype.h>
9#include <tclap/CmdLine.h>
10
11#include "Manager.h"
12#include "unexported/compile_info.h"
13
14using namespace TCLAP;
15using namespace std;
16
17string name;
18int port;
19
20void parseOptions(int argc, char **argv) {
21 try {
22 CmdLine cmd("Command description message", ' ', "0.1");
23
24 ValueArg<string> nameArg("n", "name", "uav name", false, "x4-0", "string");
25 cmd.add(nameArg);
26
27 ValueArg<int> portArg("p", "port", "port number", false, 9000, "int");
28 cmd.add(portArg);
29
30 cmd.parse(argc, argv);
31
32 // Get the value parsed by each arg.
33 name = nameArg.getValue();
34 port = portArg.getValue();
35
36 } catch (ArgException &e) { // catch any exceptions
37 cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
38 }
39}
40
41int main(int argc, char *argv[]) {
42
43 union {
44 uint32_t i;
45 char c[4];
46 } bint = {0x01020304};
47
48 if (bint.c[0] == 1) {
49 printf("error, ground station is only compatible with little endian\n");
50 return -1;
51 }
52
53 compile_info("FlairGCS");
54
55 parseOptions(argc, argv);
56 printf("listening on port %i\n", port);
57
58 qRegisterMetaType<const char *>("const char*");
59 QLocale::setDefault(QLocale::C);
60 QApplication app(argc, argv);
61 app.setStyle(new QCleanlooksStyle);
62
63 Manager manager(QString::fromStdString(name), port);
64
65 manager.show();
66
67 app.exec();
68}
Note: See TracBrowser for help on using the repository browser.