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.
|
---|
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 | */
|
---|
54 | VrpnClient(std::string name,
|
---|
55 | std::string address, uint16_t us_period, uint8_t priority);
|
---|
56 |
|
---|
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 | */
|
---|
67 | VrpnClient(std::string name,
|
---|
68 | core::SerialPort *serialport, uint16_t us_period,
|
---|
69 | uint8_t priority);
|
---|
70 |
|
---|
71 | /*!
|
---|
72 | * \brief Destructor
|
---|
73 | *
|
---|
74 | */
|
---|
75 | ~VrpnClient();
|
---|
76 |
|
---|
77 | /*!
|
---|
78 | * \brief Setup Layout
|
---|
79 | *
|
---|
80 | * \return a Layout available
|
---|
81 | */
|
---|
82 | gui::Layout *GetLayout(void) const;
|
---|
83 |
|
---|
84 | /*!
|
---|
85 | * \brief Setup Tab
|
---|
86 | *
|
---|
87 | * \return a Tab available
|
---|
88 | */
|
---|
89 | gui::TabWidget *GetTabWidget(void) const;
|
---|
90 |
|
---|
91 | /*!
|
---|
92 | * \brief Is XBee used?
|
---|
93 | *
|
---|
94 | * \return true if connection is based on XBee modem
|
---|
95 | */
|
---|
96 | bool UseXbee(void) const;
|
---|
97 |
|
---|
98 | private:
|
---|
99 | /*!
|
---|
100 | * \brief Run function
|
---|
101 | *
|
---|
102 | * Reimplemented from Thread.
|
---|
103 | *
|
---|
104 | */
|
---|
105 | void Run(void);
|
---|
106 |
|
---|
107 | class VrpnClient_impl *pimpl_;
|
---|
108 | };
|
---|
109 |
|
---|
110 | /*!
|
---|
111 | * \brief get VrpnClient
|
---|
112 | *
|
---|
113 | * \return the VrpnClient
|
---|
114 | */
|
---|
115 | VrpnClient *GetVrpnClient(void);
|
---|
116 |
|
---|
117 | } // end namespace sensor
|
---|
118 | } // end namespace flair
|
---|
119 | #endif // VRPNCLIENT_H
|
---|