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

Last change on this file since 9 was 9, checked in by Sanahuja Guillaume, 5 years ago

gcs

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