source: flair-src/trunk/lib/FlairCore/src/FrameworkManager.h@ 120

Last change on this file since 120 was 55, checked in by Sanahuja Guillaume, 8 years ago

simu gps

File size: 5.7 KB
Line 
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 FrameworkManager.h
7 * \brief Main class of the Framework library
8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
9 * \date 2011/08/31
10 * \version 4.0
11 */
12
13#ifndef FRAMEWORKMANAGER_H
14#define FRAMEWORKMANAGER_H
15
16#include <Object.h>
17
18class FrameworkManager_impl;
19
20namespace flair {
21 namespace gui {
22 class TabWidget;
23 class SendData;
24 }
25}
26namespace flair {
27namespace core {
28class IODevice;
29
30/*! \class FrameworkManager
31*
32* \brief Main class of the Framework library
33*
34* This is the main class of the library. Only one instance of this class is
35*allowed
36* by program. Morevoer, its name must be unique if more than one program using
37*this class
38* is running on the same system (a control and a simlator for example). \n
39* This class allows: \n
40* -connexion with ground station, \n
41* -creation of a QTabWidget on ground station, \n
42* -handling of xml files, used for default values of Widgets, \n
43* -logging of datas.
44*/
45class FrameworkManager : public Object {
46public:
47 /*!
48 * \brief Constructor
49 *
50 * Construct a FrameworkManager. \n
51 * Call SetupConnection method just after this constructor to setup the
52 *conection with a ground station.
53 *
54 * \param name name, must be unique
55 */
56 FrameworkManager(std::string name);
57
58 /*!
59 * \brief Destructor
60 *
61 * Calling it will automatically destruct all childs. \n
62 * Destruction implies destruction of the QTabWidget on ground station.
63 *
64 */
65 ~FrameworkManager();
66
67 /*!
68 * \brief Setup the connection with ground station
69 *
70 * Call this method just after the constructor of this class. If this method is
71 * not called, the program will run headless.
72 * If this method is called, SetupUserInterface must also be called after this.
73 *
74 * \param address address of ground station
75 * \param port port of ground station
76 * \param watchdogTimeout watchdog timeout for the connection, passing TIME_INFINITE will disable the watchdog
77 * \param rcv_buf_size receive buffer size
78 */
79 void SetupConnection(std::string address, uint16_t port,Time watchdogTimeout=(Time)1000000000,
80 size_t rcv_buf_size = 10000);
81
82 /*!
83 * \brief Setup the user interface
84 *
85 * If this method is called after SetupConnection, Widgets will be displayed in
86 * the ground station.
87 * If this method is called and SetupConnection was not called, it will run headless but default values of Widgets will be taken
88 * from the xml file.
89 * If this method is not called, Widgets will not be available. Constructing an object based on Widget class will fail.
90 *
91 * \param xml_file xml file for default values of Widgets
92 */
93 void SetupUserInterface(std::string xml_file);
94
95 /*!
96 * \brief Get TabWidget
97 *
98 * \return TabWidget
99 */
100 gui::TabWidget *GetTabWidget(void) const;
101
102 /*!
103 * \brief Logger setup
104 *
105 * Setup path of log files. \n
106 * No logging will be performed if this method is not called. \n
107 *
108 * \param log_path path to store logs
109 */
110 void SetupLogger(std::string log_path);
111
112 /*!
113 * \brief Add log element
114 *
115 * The added element will be automatically logged once
116 * logging started (see StartLog()). \n
117 * This element must define on its side the io_data
118 * to log, trough IODevice::SetDataToLog method.
119 *
120 * \param device IODevice to add
121 */
122 void AddDeviceToLog(IODevice *device);
123
124 /*!
125 * \brief Start logging
126 *
127 * All IODevice added through AddDeviceToLog() method
128 * will automatically be logged. \n
129 * SetupLogger() must have been called before.
130 */
131 void StartLog(void);
132
133 /*!
134 * \brief Stop logging
135 *
136 * Logs will automatically be sent to ground station.
137 */
138 void StopLog(void);
139
140 /*!
141 * \brief Is logging?
142 *
143 * \return true if is logging
144 */
145 bool IsLogging(void) const;
146
147 /*!
148 * \brief Notify that SendData's period has changed
149 *
150 * This funtion must be called when the period has changed. \n
151 * Normally, it occurs in the Widget::XmlEvent method. \n
152 * This method must be called with communication blocked (see BlockCom()).
153 *
154 * \param obj SendData which changed
155 */
156 void UpdateSendData(const gui::SendData *obj);
157
158 /*!
159 * \brief Block communication
160 *
161 * This funtion blocks the communication beetween the program and ground
162 *station. \n
163 * It must be called before changing datas or parameters exchanged between the
164 *program
165 * and the ground station.
166 *
167 */
168 void BlockCom(void);
169
170 /*!
171 * \brief Unblock communication
172 *
173 * This funtion unblocks the communication beetween the program and ground
174 *station. \n
175 * It must be called after changing datas or parameters exchanged between the
176 *program
177 * and the ground station.
178 *
179 */
180 void UnBlockCom(void);
181
182 /*!
183 * \brief Is connection lost?
184 *
185 * Once this method returns true, it will never return false back. \n
186 * Note that this method return false if no connection is defined (see
187 *SetupConnection).
188 *
189 * \return true if connection with ground station is lost
190 */
191 bool ConnectionLost(void) const;
192
193 /*!
194 * \brief Disable errors display
195 *
196 * Disable errors display, if you do not want to saturate console for exemple.
197 * By defaults errors disply is enabled.
198 *
199 * \param value true to disable errors display
200 */
201 void DisableErrorsDisplay(bool value);
202
203 /*!
204 * \brief Is displaying errors?
205 *
206 *
207 * \return true if errors display is enabled
208 */
209 bool IsDisplayingErrors(void) const;
210
211private:
212 class FrameworkManager_impl *pimpl_;
213};
214
215/*!
216* \brief get FrameworkManager
217*
218* \return the FrameworkManager
219*/
220FrameworkManager *getFrameworkManager(void);
221
222/*!
223* \brief is big endian?
224*
225* \return true if big endian, false if little endian
226*/
227bool IsBigEndian(void);
228
229} // end namespace core
230} // end namespace flair
231
232#endif // FRAMEWORKMANAGER_H
Note: See TracBrowser for help on using the repository browser.