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

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

vrpnlite: add headless mode and kill button

File size: 2.1 KB
Line 
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;
24string vrpnServerAddress;
25int gcsPort,vrpnLitePort;
26bool headless;
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");
35 if(!headless) manager->SetupConnection("127.0.0.1", gcsPort);
36 manager->SetupUserInterface(xml_file);
37
38 VrpnLite* vrpnlite=new VrpnLite(vrpnLitePort,vrpnServerAddress);
39
40 vrpnlite->Start();
41 vrpnlite->Join();
42
43 delete manager;
44}
45
46void parseOptions(int argc, char **argv) {
47 try {
48 CmdLine cmd("Command description message", ' ', "0.1",false);
49
50 ValueArg<int> vrpnLitePortArg("v", "vport","vrpn lite port", true,3884, "int");
51 cmd.add(vrpnLitePortArg);
52
53 ValueArg<string> serveraddressArg("s", "saddress","server address", true,"127.0.0.1:3883", "string");
54 cmd.add(serveraddressArg);
55
56 ValueArg<int> gcsPortArg("p", "port","local port used to connect to the ground station",false, 9000, "int");
57 cmd.add(gcsPortArg);
58
59 ValueArg<string> xmlArg("x", "xml", "xml file", true, "./settings.xml","string");
60 cmd.add(xmlArg);
61
62 ValueArg<bool> headlessArg("h", "headless", "headless mode", false, false,"bool");
63 cmd.add(headlessArg);
64
65 cmd.parse(argc, argv);
66
67 vrpnLitePort = vrpnLitePortArg.getValue();
68 vrpnServerAddress = serveraddressArg.getValue();
69 gcsPort = gcsPortArg.getValue();
70 xml_file = xmlArg.getValue();
71 headless = headlessArg.getValue();
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.