// created: 2019/03/12 // filename: main.cpp // // author: Guillaume Sanahuja // Copyright Heudiasyc UMR UTC/CNRS 7253 // // version: $Id: $ // // purpose: vrpnlite, to forward it to bth for exemple // usefull to reduce vrpn frame size // /*********************************************************************/ #include "FrameworkManager.h" #include "VrpnLite.h" #include #include using namespace TCLAP; using namespace std; using namespace flair::core; string xml_file; string clientAddress,serverAddress; int port; void parseOptions(int argc, char **argv); int main (int argc, char ** argv) { parseOptions(argc,argv); FrameworkManager *manager; manager = new FrameworkManager("vrpnforwarder"); manager->SetupConnection("127.0.0.1", port); manager->SetupUserInterface(xml_file); VrpnLite* vrpnlite=new VrpnLite(clientAddress,serverAddress); vrpnlite->Start(); vrpnlite->Join(); delete manager; } void parseOptions(int argc, char **argv) { try { CmdLine cmd("Command description message", ' ', "0.1"); ValueArg clientaddressArg("c", "caddress","client address", true, "127.0.0.1:3884", "string"); cmd.add(clientaddressArg); ValueArg serveraddressArg("s", "saddress","server address", true, "127.0.0.1:3883", "string"); cmd.add(serveraddressArg); ValueArg portArg("p", "port","local port used to connect to the ground station", false, 9000, "int"); cmd.add(portArg); ValueArg xmlArg("x", "xml", "xml file", true, "./settings.xml", "string"); cmd.add(xmlArg); cmd.parse(argc, argv); clientAddress = clientaddressArg.getValue(); serverAddress = serveraddressArg.getValue(); port = portArg.getValue(); xml_file = xmlArg.getValue(); } catch (ArgException &e) { // catch any exceptions cerr << "error: " << e.error() << " for arg " << e.argId() << endl; } }