[4] | 1 | // %flair:license{
|
---|
[13] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[4] | 4 | // %flair:license}
|
---|
| 5 | /*!
|
---|
| 6 | * \file VrpnClient.h
|
---|
| 7 | * \brief Class to connect to a Vrpn server
|
---|
[13] | 8 | * \author César Richard, Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS
|
---|
| 9 | * 7253
|
---|
[4] | 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 |
|
---|
[13] | 19 | namespace flair {
|
---|
[44] | 20 | namespace core {
|
---|
| 21 | class SerialPort;
|
---|
| 22 | }
|
---|
| 23 | namespace gui {
|
---|
| 24 | class TabWidget;
|
---|
| 25 | class Layout;
|
---|
| 26 | }
|
---|
[4] | 27 | }
|
---|
| 28 |
|
---|
| 29 | class VrpnClient_impl;
|
---|
| 30 | class VrpnObject_impl;
|
---|
| 31 |
|
---|
[13] | 32 | namespace flair {
|
---|
| 33 | namespace sensor {
|
---|
| 34 | /*! \class VrpnClient
|
---|
| 35 | *
|
---|
[44] | 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.
|
---|
[13] | 39 | */
|
---|
| 40 | class VrpnClient : public core::Thread {
|
---|
| 41 | friend class ::VrpnObject_impl;
|
---|
[4] | 42 |
|
---|
[13] | 43 | public:
|
---|
| 44 | /*!
|
---|
| 45 | * \brief Constructor
|
---|
| 46 | *
|
---|
| 47 | * Construct a VrpnClient. Connection is done by IP.
|
---|
| 48 | *
|
---|
| 49 | * \param name name
|
---|
| 50 | * \param address server address
|
---|
| 51 | * \param us_period Thread period in us
|
---|
| 52 | * \param priority priority of the Thread
|
---|
| 53 | */
|
---|
[44] | 54 | VrpnClient(std::string name,
|
---|
[13] | 55 | std::string address, uint16_t us_period, uint8_t priority);
|
---|
[4] | 56 |
|
---|
[13] | 57 | /*!
|
---|
| 58 | * \brief Constructor
|
---|
| 59 | *
|
---|
| 60 | * Construct a VrpnClient. Connection is done by XBee modem.
|
---|
| 61 | *
|
---|
| 62 | * \param name name
|
---|
| 63 | * \param serialport SerialPort for XBee modem
|
---|
| 64 | * \param us_period Xbee RX timeout in us
|
---|
| 65 | * \param priority priority of the Thread
|
---|
| 66 | */
|
---|
[44] | 67 | VrpnClient(std::string name,
|
---|
[13] | 68 | core::SerialPort *serialport, uint16_t us_period,
|
---|
| 69 | uint8_t priority);
|
---|
[4] | 70 |
|
---|
[13] | 71 | /*!
|
---|
| 72 | * \brief Destructor
|
---|
| 73 | *
|
---|
| 74 | */
|
---|
| 75 | ~VrpnClient();
|
---|
[4] | 76 |
|
---|
[13] | 77 | /*!
|
---|
| 78 | * \brief Setup Layout
|
---|
| 79 | *
|
---|
| 80 | * \return a Layout available
|
---|
| 81 | */
|
---|
| 82 | gui::Layout *GetLayout(void) const;
|
---|
[4] | 83 |
|
---|
[13] | 84 | /*!
|
---|
| 85 | * \brief Setup Tab
|
---|
| 86 | *
|
---|
| 87 | * \return a Tab available
|
---|
| 88 | */
|
---|
| 89 | gui::TabWidget *GetTabWidget(void) const;
|
---|
[4] | 90 |
|
---|
[13] | 91 | /*!
|
---|
| 92 | * \brief Is XBee used?
|
---|
| 93 | *
|
---|
| 94 | * \return true if connection is based on XBee modem
|
---|
| 95 | */
|
---|
| 96 | bool UseXbee(void) const;
|
---|
[4] | 97 |
|
---|
[13] | 98 | private:
|
---|
| 99 | /*!
|
---|
| 100 | * \brief Run function
|
---|
| 101 | *
|
---|
| 102 | * Reimplemented from Thread.
|
---|
| 103 | *
|
---|
| 104 | */
|
---|
| 105 | void Run(void);
|
---|
[4] | 106 |
|
---|
[13] | 107 | class VrpnClient_impl *pimpl_;
|
---|
| 108 | };
|
---|
[44] | 109 |
|
---|
| 110 | /*!
|
---|
| 111 | * \brief get VrpnClient
|
---|
| 112 | *
|
---|
| 113 | * \return the VrpnClient
|
---|
| 114 | */
|
---|
| 115 | VrpnClient *GetVrpnClient(void);
|
---|
| 116 |
|
---|
[4] | 117 | } // end namespace sensor
|
---|
| 118 | } // end namespace flair
|
---|
| 119 | #endif // VRPNCLIENT_H
|
---|