Changeset 446 in flair-src for trunk/tools/VrpnLite/src


Ignore:
Timestamp:
Sep 14, 2021, 11:04:41 AM (3 years ago)
Author:
Sanahuja Guillaume
Message:

vrpnlite: add headless mode and kill button

Location:
trunk/tools/VrpnLite/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/VrpnLite/src/VrpnLite.cpp

    r434 r446  
    1717#include <Thread.h>
    1818#include <UdpSocket.h>
     19#include <TabWidget.h>
     20#include <Tab.h>
     21#include <PushButton.h>
    1922#include <FrameworkManager.h>
    2023#include <Quaternion.h>
     
    2427using namespace flair::core;
    2528using namespace flair::sensor;
     29using namespace flair::gui;
    2630
    2731VrpnLite::VrpnLite(int vrpnLitePort,string vrpnServerAddress): Thread(getFrameworkManager(),"VrpnLite",90) {
    2832  vrpnclient=new VrpnClient("vrpn", vrpnServerAddress,80);
     33  Tab* tab=new Tab(vrpnclient->GetTabWidget(),"Main");
     34  killButton=new PushButton(tab->NewRow(),"kill");
    2935  dataSocket = new UdpSocket(this,"client socket",vrpnLitePort);
    3036  vrpnclient->Start();
     
    4046 
    4147  while (!ToBeStopped()) {
     48    if(killButton->Clicked()) SafeStop();
     49   
    4250    if(vrpnobjects.size()>0) {
    4351      //wait for last one to be sure all are up to date
  • trunk/tools/VrpnLite/src/VrpnLite.h

    r363 r446  
    2222    class UdpSocket;
    2323  }
     24  namespace gui {
     25    class PushButton;
     26  }
    2427        namespace sensor {
    2528                class VrpnClient;
     
    3437
    3538private:
     39      flair::gui::PushButton* killButton;
    3640      void Run(void);
    3741      flair::sensor::VrpnClient* vrpnclient;
  • trunk/tools/VrpnLite/src/main.cpp

    r330 r446  
    2424string vrpnServerAddress;
    2525int gcsPort,vrpnLitePort;
     26bool headless;
    2627
    2728void parseOptions(int argc, char **argv);
     
    3233  FrameworkManager *manager;
    3334  manager = new FrameworkManager("vrpnforwarder");
    34   manager->SetupConnection("127.0.0.1", gcsPort);
     35  if(!headless) manager->SetupConnection("127.0.0.1", gcsPort);
    3536  manager->SetupUserInterface(xml_file);
    3637 
     
    4546void parseOptions(int argc, char **argv) {
    4647  try {
    47     CmdLine cmd("Command description message", ' ', "0.1");
     48    CmdLine cmd("Command description message", ' ', "0.1",false);
    4849
    49     ValueArg<int> vrpnLitePortArg("v", "vport","vrpn lite port", true,
    50                                 3884, "int");
     50    ValueArg<int> vrpnLitePortArg("v", "vport","vrpn lite port", true,3884, "int");
    5151    cmd.add(vrpnLitePortArg);
    5252   
    53     ValueArg<string> serveraddressArg("s", "saddress","server address", true,
    54                                 "127.0.0.1:3883", "string");
     53    ValueArg<string> serveraddressArg("s", "saddress","server address", true,"127.0.0.1:3883", "string");
    5554    cmd.add(serveraddressArg);
    5655
    57     ValueArg<int> gcsPortArg("p", "port","local port used to connect to the ground station",
    58                           false, 9000, "int");
     56    ValueArg<int> gcsPortArg("p", "port","local port used to connect to the ground station",false, 9000, "int");
    5957    cmd.add(gcsPortArg);
    6058
    61 
    62     ValueArg<string> xmlArg("x", "xml", "xml file", true, "./settings.xml",
    63                             "string");
     59    ValueArg<string> xmlArg("x", "xml", "xml file", true, "./settings.xml","string");
    6460    cmd.add(xmlArg);
     61   
     62    ValueArg<bool> headlessArg("h", "headless", "headless mode", false, false,"bool");
     63    cmd.add(headlessArg);
    6564
    6665    cmd.parse(argc, argv);
     
    7069    gcsPort = gcsPortArg.getValue();
    7170    xml_file = xmlArg.getValue();
     71    headless = headlessArg.getValue();
    7272
    7373  } catch (ArgException &e) { // catch any exceptions
Note: See TracChangeset for help on using the changeset viewer.