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

Last change on this file since 68 was 68, checked in by Sanahuja Guillaume, 3 years ago

maj for armv5te

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