[3] | 1 | // %flair:license{
|
---|
[15] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[3] | 4 | // %flair:license}
|
---|
| 5 | /*!
|
---|
| 6 | * \file VrpnClient.h
|
---|
| 7 | * \brief Class to connect to a Vrpn server
|
---|
[15] | 8 | * \author César Richard, Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS
|
---|
| 9 | * 7253
|
---|
[3] | 10 | * \date 2013/04/03
|
---|
| 11 | * \version 4.0
|
---|
| 12 | */
|
---|
| 13 |
|
---|
| 14 | #ifndef VRPNCLIENT_H
|
---|
| 15 | #define VRPNCLIENT_H
|
---|
| 16 |
|
---|
| 17 | #include <Thread.h>
|
---|
| 18 |
|
---|
[15] | 19 | namespace flair {
|
---|
[122] | 20 | namespace core {
|
---|
| 21 | class SerialPort;
|
---|
| 22 | }
|
---|
| 23 | namespace gui {
|
---|
| 24 | class TabWidget;
|
---|
| 25 | class Layout;
|
---|
| 26 | }
|
---|
[3] | 27 | }
|
---|
| 28 |
|
---|
| 29 | class VrpnClient_impl;
|
---|
| 30 | class VrpnObject_impl;
|
---|
| 31 |
|
---|
[15] | 32 | namespace flair {
|
---|
| 33 | namespace sensor {
|
---|
| 34 | /*! \class VrpnClient
|
---|
| 35 | *
|
---|
[122] | 36 | * \brief Class to connect to a Vrpn server. The Thread is created with
|
---|
| 37 | * the FrameworkManager as parent. FrameworkManager must be created before.
|
---|
| 38 | * Only one instance of this class is allowed by program.
|
---|
[15] | 39 | */
|
---|
| 40 | class VrpnClient : public core::Thread {
|
---|
| 41 | friend class ::VrpnObject_impl;
|
---|
[3] | 42 |
|
---|
[15] | 43 | public:
|
---|
[330] | 44 | typedef enum { Vrpn, VrpnLite, Xbee } ConnectionType_t;
|
---|
| 45 |
|
---|
[15] | 46 | /*!
|
---|
| 47 | * \brief Constructor
|
---|
| 48 | *
|
---|
[330] | 49 | * Construct a VrpnClient. Connection is done by IP to a vrpn server or vrpnlite server (see tools/VrpnLite in flair-src)
|
---|
[15] | 50 | *
|
---|
| 51 | * \param name name
|
---|
| 52 | * \param address server address
|
---|
| 53 | * \param priority priority of the Thread
|
---|
[330] | 54 | * \param connection connection type: Vrpn or VrpnLite
|
---|
[15] | 55 | */
|
---|
[122] | 56 | VrpnClient(std::string name,
|
---|
[330] | 57 | std::string address, uint8_t priority,ConnectionType_t connectionType=Vrpn);
|
---|
[309] | 58 |
|
---|
| 59 | /*!
|
---|
| 60 | * \brief Constructor
|
---|
| 61 | *
|
---|
[15] | 62 | * Construct a VrpnClient. Connection is done by XBee modem.
|
---|
| 63 | *
|
---|
| 64 | * \param name name
|
---|
| 65 | * \param serialport SerialPort for XBee modem
|
---|
| 66 | * \param us_period Xbee RX timeout in us
|
---|
| 67 | * \param priority priority of the Thread
|
---|
| 68 | */
|
---|
[122] | 69 | VrpnClient(std::string name,
|
---|
[15] | 70 | core::SerialPort *serialport, uint16_t us_period,
|
---|
| 71 | uint8_t priority);
|
---|
[3] | 72 |
|
---|
[15] | 73 | /*!
|
---|
| 74 | * \brief Destructor
|
---|
| 75 | *
|
---|
| 76 | */
|
---|
| 77 | ~VrpnClient();
|
---|
[3] | 78 |
|
---|
[15] | 79 | /*!
|
---|
| 80 | * \brief Setup Layout
|
---|
| 81 | *
|
---|
| 82 | * \return a Layout available
|
---|
| 83 | */
|
---|
| 84 | gui::Layout *GetLayout(void) const;
|
---|
[3] | 85 |
|
---|
[15] | 86 | /*!
|
---|
| 87 | * \brief Setup Tab
|
---|
| 88 | *
|
---|
| 89 | * \return a Tab available
|
---|
| 90 | */
|
---|
| 91 | gui::TabWidget *GetTabWidget(void) const;
|
---|
[309] | 92 |
|
---|
| 93 | ConnectionType_t ConnectionType(void) const;
|
---|
[3] | 94 |
|
---|
[15] | 95 | private:
|
---|
| 96 | /*!
|
---|
| 97 | * \brief Run function
|
---|
| 98 | *
|
---|
| 99 | * Reimplemented from Thread.
|
---|
| 100 | *
|
---|
| 101 | */
|
---|
| 102 | void Run(void);
|
---|
[3] | 103 |
|
---|
[15] | 104 | class VrpnClient_impl *pimpl_;
|
---|
| 105 | };
|
---|
[122] | 106 |
|
---|
| 107 | /*!
|
---|
| 108 | * \brief get VrpnClient
|
---|
| 109 | *
|
---|
| 110 | * \return the VrpnClient
|
---|
| 111 | */
|
---|
| 112 | VrpnClient *GetVrpnClient(void);
|
---|
| 113 |
|
---|
[3] | 114 | } // end namespace sensor
|
---|
| 115 | } // end namespace flair
|
---|
| 116 | #endif // VRPNCLIENT_H
|
---|