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