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 | typedef enum { Vrpn, VrpnLite, Xbee } ConnectionType_t;
|
---|
45 |
|
---|
46 | /*!
|
---|
47 | * \brief Constructor
|
---|
48 | *
|
---|
49 | * Construct a VrpnClient. Connection is done by IP to a vrpn server or vrpnlite server (see tools/VrpnLite in flair-src)
|
---|
50 | *
|
---|
51 | * \param name name
|
---|
52 | * \param address server address
|
---|
53 | * \param priority priority of the Thread
|
---|
54 | * \param connection connection type: Vrpn or VrpnLite
|
---|
55 | */
|
---|
56 | VrpnClient(std::string name,
|
---|
57 | std::string address, uint8_t priority,ConnectionType_t connectionType=Vrpn);
|
---|
58 |
|
---|
59 | /*!
|
---|
60 | * \brief Constructor
|
---|
61 | *
|
---|
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 | */
|
---|
69 | VrpnClient(std::string name,
|
---|
70 | core::SerialPort *serialport, uint16_t us_period,
|
---|
71 | uint8_t priority);
|
---|
72 |
|
---|
73 | /*!
|
---|
74 | * \brief Destructor
|
---|
75 | *
|
---|
76 | */
|
---|
77 | ~VrpnClient();
|
---|
78 |
|
---|
79 | /*!
|
---|
80 | * \brief Setup Layout
|
---|
81 | *
|
---|
82 | * \return a Layout available
|
---|
83 | */
|
---|
84 | gui::Layout *GetLayout(void) const;
|
---|
85 |
|
---|
86 | /*!
|
---|
87 | * \brief Setup Tab
|
---|
88 | *
|
---|
89 | * \return a Tab available
|
---|
90 | */
|
---|
91 | gui::TabWidget *GetTabWidget(void) const;
|
---|
92 |
|
---|
93 | ConnectionType_t ConnectionType(void) const;
|
---|
94 |
|
---|
95 | private:
|
---|
96 | /*!
|
---|
97 | * \brief Run function
|
---|
98 | *
|
---|
99 | * Reimplemented from Thread.
|
---|
100 | *
|
---|
101 | */
|
---|
102 | void Run(void);
|
---|
103 |
|
---|
104 | class VrpnClient_impl *pimpl_;
|
---|
105 | };
|
---|
106 |
|
---|
107 | /*!
|
---|
108 | * \brief get VrpnClient
|
---|
109 | *
|
---|
110 | * \return the VrpnClient
|
---|
111 | */
|
---|
112 | VrpnClient *GetVrpnClient(void);
|
---|
113 |
|
---|
114 | } // end namespace sensor
|
---|
115 | } // end namespace flair
|
---|
116 | #endif // VRPNCLIENT_H
|
---|