// %flair:license{ // This file is part of the Flair framework distributed under the // CECILL-C License, Version 1.0. // %flair:license} // created: 2013/04/03 // filename: VrpnClient.cpp // // author: César Richard, Guillaume Sanahuja // Copyright Heudiasyc UMR UTC/CNRS 7253 // // version: $Id: $ // // purpose: Class to connect to a Vrpn server // /*********************************************************************/ #include "VrpnClient.h" #include "VrpnClient_impl.h" #include #include #include using std::string; using namespace flair::core; using namespace flair::gui; namespace { flair::sensor::VrpnClient *singleton = NULL; } namespace flair { namespace sensor { VrpnClient *GetVrpnClient(void) { return singleton; } VrpnClient::VrpnClient(string name, string address, uint8_t priority,ConnectionType_t connectionType) : Thread(getFrameworkManager(), name, priority) { if (singleton != NULL) { SimpleWarn("VrpnClient should be instanced only one time!\n"); SimpleWarn("Next calls to GetVrpnClient() will return the first created VrpnClient (%s)\n",singleton->ObjectName().c_str()); } else { singleton = this; } pimpl_ = new VrpnClient_impl(this, name, address,connectionType); } VrpnClient::VrpnClient(string name, SerialPort *serialport, uint16_t us_period, uint8_t priority) : Thread(getFrameworkManager(), name, priority) { if (singleton != NULL) { SimpleWarn("VrpnClient should be instanced only one time!\n"); SimpleWarn("Next calls to GetVrpnClient() will return the first created VrpnClient (%s)\n",singleton->ObjectName().c_str()); } else { singleton = this; } pimpl_ = new VrpnClient_impl(this, name, serialport, us_period); } VrpnClient::~VrpnClient() { SafeStop(); Join(); delete pimpl_; } VrpnClient::ConnectionType_t VrpnClient::ConnectionType(void) const { return pimpl_->connectionType; } Layout *VrpnClient::GetLayout(void) const { return (Layout *)(pimpl_->setup_tab); } TabWidget *VrpnClient::GetTabWidget(void) const { return pimpl_->tab; } void VrpnClient::Run(void) { pimpl_->Run(); } } // end namespace sensor } // end namespace flair