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

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

added compile info

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