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

Last change on this file since 13 was 13, checked in by Bayard Gildas, 5 years ago

formatting script + include reformatted

File size: 5.3 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 {
21namespace gui {
22class TabWidget;
23class 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  *
73  * \param address address of ground station
74  * \param port port of ground station
75  * \param rcv_buf_size receive buffer size
76  */
77  void SetupConnection(std::string address, uint16_t port,
78                       size_t rcv_buf_size = 10000);
79
80  /*!
81  * \brief Setup the user interface
82  *
83  * If this method is called after SetupConnection, Widgets will be displayed in
84  *the ground station.
85  * Otherwise, it will run headless, but default values of Widgets will be taken
86  *from the xml file.
87  *
88  * \param xml_file xml file for default values of Widgets
89  */
90  void SetupUserInterface(std::string xml_file);
91
92  /*!
93  * \brief Get TabWidget
94  *
95  * \return TabWidget
96  */
97  gui::TabWidget *GetTabWidget(void) const;
98
99  /*!
100  * \brief Logger setup
101  *
102  * Setup path of log files. \n
103  * No logging will be performed if this method is not called. \n
104  *
105  * \param log_path path to store logs
106  */
107  void SetupLogger(std::string log_path);
108
109  /*!
110  * \brief Add log element
111  *
112  * The added element will be automatically logged once
113  * logging started (see StartLog()). \n
114  * This element must define on its side the io_data
115  * to log, trough IODevice::SetDataToLog method.
116  *
117  * \param device IODevice to add
118  */
119  void AddDeviceToLog(IODevice *device);
120
121  /*!
122  * \brief Start logging
123  *
124  * All IODevice added through AddDeviceToLog() method
125  * will automatically be logged. \n
126  * SetupLogger() must have been called before.
127  */
128  void StartLog(void);
129
130  /*!
131  * \brief Stop logging
132  *
133  * Logs will automatically be sent to ground station.
134  */
135  void StopLog(void);
136
137  /*!
138  * \brief Is logging?
139  *
140  * \return true if is logging
141  */
142  bool IsLogging(void) const;
143
144  /*!
145  * \brief Notify that SendData's period has changed
146  *
147  * This funtion must be called when the period has changed. \n
148  * Normally, it occurs in the Widget::XmlEvent method. \n
149  * This method must be called with communication blocked (see BlockCom()).
150  *
151  * \param obj SendData which changed
152  */
153  void UpdateSendData(const gui::SendData *obj);
154
155  /*!
156  * \brief Block communication
157  *
158  * This funtion blocks the communication beetween the program and ground
159  *station. \n
160  * It must be called before changing datas or parameters exchanged between the
161  *program
162  * and the ground station.
163  *
164  */
165  void BlockCom(void);
166
167  /*!
168 * \brief Unblock communication
169 *
170 * This funtion unblocks the communication beetween the program and ground
171 *station. \n
172 * It must be called after changing datas or parameters exchanged between the
173 *program
174 * and the ground station.
175 *
176 */
177  void UnBlockCom(void);
178
179  /*!
180  * \brief Is connection lost?
181  *
182  * Once this method returns true, it will never return false back. \n
183  * Note that this method return false if no connection is defined (see
184  *SetupConnection).
185  *
186  * \return true if connection with ground station is lost
187  */
188  bool ConnectionLost(void) const;
189
190  /*!
191  * \brief Disable errors display
192  *
193  * Disable errors display, if you do not want to saturate console for exemple.
194  * By defaults errors disply is enabled.
195  *
196  * \param value true to disable errors display
197  */
198  void DisableErrorsDisplay(bool value);
199
200  /*!
201  * \brief Is displaying errors?
202  *
203  *
204  * \return true if errors display is enabled
205  */
206  bool IsDisplayingErrors(void) const;
207
208private:
209  class FrameworkManager_impl *pimpl_;
210};
211
212/*!
213* \brief get FrameworkManager
214*
215* \return the FrameworkManager
216*/
217FrameworkManager *getFrameworkManager(void);
218
219/*!
220* \brief is big endian?
221*
222* \return true if big endian, false if little endian
223*/
224bool IsBigEndian(void);
225
226} // end namespace core
227} // end namespace flair
228
229#endif // FRAMEWORKMANAGER_H
Note: See TracBrowser for help on using the repository browser.