Changeset 15 in flair-src for trunk/tools/FlairGCS/src/main.cpp
- Timestamp:
- Apr 8, 2016, 3:40:57 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/FlairGCS/src/main.cpp
r10 r15 18 18 int port; 19 19 20 void parseOptions(int argc, char **argv) {21 22 20 void parseOptions(int argc, char **argv) { 21 try { 22 CmdLine cmd("Command description message", ' ', "0.1"); 23 23 24 ValueArg<string> nameArg("n","name","uav name",false,"x4-0","string");25 cmd.add( nameArg);24 ValueArg<string> nameArg("n", "name", "uav name", false, "x4-0", "string"); 25 cmd.add(nameArg); 26 26 27 ValueArg<int> portArg("p","port","port number",false,9000,"int");28 cmd.add( portArg);27 ValueArg<int> portArg("p", "port", "port number", false, 9000, "int"); 28 cmd.add(portArg); 29 29 30 cmd.parse( argc, argv);30 cmd.parse(argc, argv); 31 31 32 33 name= nameArg.getValue();34 32 // Get the value parsed by each arg. 33 name = nameArg.getValue(); 34 port = portArg.getValue(); 35 35 36 } catch (ArgException &e) {// catch any exceptions37 38 36 } catch (ArgException &e) { // catch any exceptions 37 cerr << "error: " << e.error() << " for arg " << e.argId() << endl; 38 } 39 39 } 40 40 41 41 int main(int argc, char *argv[]) { 42 42 43 44 45 46 43 union { 44 uint32_t i; 45 char c[4]; 46 } bint = {0x01020304}; 47 47 48 if(bint.c[0] == 1) {49 50 51 48 if (bint.c[0] == 1) { 49 printf("error, ground station is only compatible with little endian\n"); 50 return -1; 51 } 52 52 53 53 printf(SVN_REV); 54 54 55 parseOptions(argc,argv);56 printf("listening on port %i\n",port);55 parseOptions(argc, argv); 56 printf("listening on port %i\n", port); 57 57 58 qRegisterMetaType<const char*>("const char*");59 60 61 58 qRegisterMetaType<const char *>("const char*"); 59 QLocale::setDefault(QLocale::C); 60 QApplication app(argc, argv); 61 app.setStyle(new QCleanlooksStyle); 62 62 63 Manager manager(QString::fromStdString(name),port);63 Manager manager(QString::fromStdString(name), port); 64 64 65 65 manager.show(); 66 66 67 67 app.exec(); 68 68 }
Note:
See TracChangeset
for help on using the changeset viewer.