source: flair-dev/trunk/include/FlairCore/FrameworkManager.h@ 62

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

vision filter

File size: 6.1 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 Get log path
114 *
115 * get the path defined by SetupLogger
116 *
117 * \return log path
118 */
119 std::string GetLogPath(void) const;
120
121 /*!
122 * \brief Add log element
123 *
124 * The added element will be automatically logged once
125 * logging started (see StartLog()). \n
126 * This element must define on its side the io_data
127 * to log, trough IODevice::SetDataToLog method.
128 *
129 * \param device IODevice to add
130 */
131 void AddDeviceToLog(IODevice *device);
132
133 /*!
134 * \brief Is device logged
135 *
136 * Check if AddDeviceToLog was called for an IODevice
137 *
138 * \param device IODevice to check
139 * \return true if AddDeviceToLog was called for this IODevice
140 */
141 bool IsDeviceLogged(const IODevice *device) const;
142
143 /*!
144 * \brief Start logging
145 *
146 * All IODevice added through AddDeviceToLog() method
147 * will automatically be logged. \n
148 * SetupLogger() must have been called before.
149 */
150 void StartLog(void);
151
152 /*!
153 * \brief Stop logging
154 *
155 * Logs will automatically be sent to ground station.
156 */
157 void StopLog(void);
158
159 /*!
160 * \brief Is logging?
161 *
162 * \return true if is logging
163 */
164 bool IsLogging(void) const;
165
166 /*!
167 * \brief Notify that SendData's period has changed
168 *
169 * This funtion must be called when the period has changed. \n
170 * Normally, it occurs in the Widget::XmlEvent method. \n
171 * This method must be called with communication blocked (see BlockCom()).
172 *
173 * \param obj SendData which changed
174 */
175 void UpdateSendData(const gui::SendData *obj);
176
177 /*!
178 * \brief Block communication
179 *
180 * This funtion blocks the communication beetween the program and ground
181 *station. \n
182 * It must be called before changing datas or parameters exchanged between the
183 *program
184 * and the ground station.
185 *
186 */
187 void BlockCom(void);
188
189 /*!
190 * \brief Unblock communication
191 *
192 * This funtion unblocks the communication beetween the program and ground
193 *station. \n
194 * It must be called after changing datas or parameters exchanged between the
195 *program
196 * and the ground station.
197 *
198 */
199 void UnBlockCom(void);
200
201 /*!
202 * \brief Is connection lost?
203 *
204 * Once this method returns true, it will never return false back. \n
205 * Note that this method return false if no connection is defined (see
206 *SetupConnection).
207 *
208 * \return true if connection with ground station is lost
209 */
210 bool ConnectionLost(void) const;
211
212 /*!
213 * \brief Disable errors display
214 *
215 * Disable errors display, if you do not want to saturate console for exemple.
216 * By defaults errors disply is enabled.
217 *
218 * \param value true to disable errors display
219 */
220 void DisableErrorsDisplay(bool value);
221
222 /*!
223 * \brief Is displaying errors?
224 *
225 *
226 * \return true if errors display is enabled
227 */
228 bool IsDisplayingErrors(void) const;
229
230private:
231 class FrameworkManager_impl *pimpl_;
232};
233
234/*!
235* \brief get FrameworkManager
236*
237* \return the FrameworkManager
238*/
239FrameworkManager *getFrameworkManager(void);
240
241/*!
242* \brief is big endian?
243*
244* \return true if big endian, false if little endian
245*/
246bool IsBigEndian(void);
247
248} // end namespace core
249} // end namespace flair
250
251#endif // FRAMEWORKMANAGER_H
Note: See TracBrowser for help on using the repository browser.