source: flair-src/trunk/tools/VrpnLite/src/main.cpp@ 456

Last change on this file since 456 was 446, checked in by Sanahuja Guillaume, 3 years ago

vrpnlite: add headless mode and kill button

File size: 2.1 KB
RevLine 
[308]1// created: 2019/03/12
2// filename: main.cpp
3//
4// author: Guillaume Sanahuja
5// Copyright Heudiasyc UMR UTC/CNRS 7253
6//
7// version: $Id: $
8//
9// purpose: vrpnlite, to forward it to bth for exemple
10// usefull to reduce vrpn frame size
11//
12/*********************************************************************/
13
14#include "FrameworkManager.h"
15#include "VrpnLite.h"
16#include <stdio.h>
17#include <tclap/CmdLine.h>
18
19using namespace TCLAP;
20using namespace std;
21using namespace flair::core;
22
23string xml_file;
[330]24string vrpnServerAddress;
25int gcsPort,vrpnLitePort;
[446]26bool headless;
[308]27
28void parseOptions(int argc, char **argv);
29
30int main (int argc, char ** argv) {
31 parseOptions(argc,argv);
32
33 FrameworkManager *manager;
34 manager = new FrameworkManager("vrpnforwarder");
[446]35 if(!headless) manager->SetupConnection("127.0.0.1", gcsPort);
[308]36 manager->SetupUserInterface(xml_file);
37
[330]38 VrpnLite* vrpnlite=new VrpnLite(vrpnLitePort,vrpnServerAddress);
[308]39
40 vrpnlite->Start();
41 vrpnlite->Join();
42
43 delete manager;
44}
45
46void parseOptions(int argc, char **argv) {
47 try {
[446]48 CmdLine cmd("Command description message", ' ', "0.1",false);
[308]49
[446]50 ValueArg<int> vrpnLitePortArg("v", "vport","vrpn lite port", true,3884, "int");
[330]51 cmd.add(vrpnLitePortArg);
[308]52
[446]53 ValueArg<string> serveraddressArg("s", "saddress","server address", true,"127.0.0.1:3883", "string");
[308]54 cmd.add(serveraddressArg);
55
[446]56 ValueArg<int> gcsPortArg("p", "port","local port used to connect to the ground station",false, 9000, "int");
[330]57 cmd.add(gcsPortArg);
[308]58
[446]59 ValueArg<string> xmlArg("x", "xml", "xml file", true, "./settings.xml","string");
[308]60 cmd.add(xmlArg);
[446]61
62 ValueArg<bool> headlessArg("h", "headless", "headless mode", false, false,"bool");
63 cmd.add(headlessArg);
[308]64
65 cmd.parse(argc, argv);
66
[330]67 vrpnLitePort = vrpnLitePortArg.getValue();
68 vrpnServerAddress = serveraddressArg.getValue();
69 gcsPort = gcsPortArg.getValue();
[308]70 xml_file = xmlArg.getValue();
[446]71 headless = headlessArg.getValue();
[308]72
73 } catch (ArgException &e) { // catch any exceptions
74 cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
75 }
76}
Note: See TracBrowser for help on using the repository browser.