source: flair-src/trunk/lib/FlairCore/src/unexported/FrameworkManager_impl.h@ 98

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

simu gps

File size: 3.2 KB
RevLine 
[2]1// %flair:license{
[15]2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
[2]4// %flair:license}
5/*!
6 * \file FrameworkManager.h
7 * \brief Classe de base de la librairie
8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
9 * \date 2011/08/31
10 * \version 4.0
11 */
12
13#ifndef FRAMEWORKMANAGER_IMPL_H
14#define FRAMEWORKMANAGER_IMPL_H
15
16#include "Thread.h"
17#include "ui_com.h"
18#include <io_hdfile.h>
19#include <libxml/xpath.h>
20
21#ifdef __XENO__
22#include <native/pipe.h>
23#include <native/heap.h>
24#endif
25
[15]26namespace flair {
27namespace core {
28class FrameworkManager;
29class IODevice;
30class Watchdog;
[2]31}
[15]32namespace gui {
33class TabWidget;
34class PushButton;
35class Layout;
36}
37}
[2]38
39class ui_com;
40
[15]41class FrameworkManager_impl : public flair::core::Thread {
42public:
43 FrameworkManager_impl(flair::core::FrameworkManager *self, std::string name);
44 ~FrameworkManager_impl();
[55]45 void SetupConnection(std::string address, uint16_t port,flair::core::Time watchdogTimeout,
[15]46 size_t rcv_buf_size = 10000);
47 void SetupUserInterface(std::string xml_file);
48 void SetupLogger(std::string log_path);
49 void AddDeviceToLog(flair::core::IODevice *device);
50 void StartLog();
51 void StopLog();
52 char *GetBuffer(size_t sz);
53 void ReleaseBuffer(char *buf);
54 void WriteLog(const char *buf, size_t size);
[2]55
[15]56 /*!
57 * \brief Affiche le xml
58 *
59 * Pour debug.
60 */
61 void PrintXml(void) const;
[2]62
[15]63 bool is_logging;
64 bool disable_errors;
65 bool connection_lost;
66 static ui_com *com;
67 static FrameworkManager_impl *_this;
68 std::string log_path;
[2]69
[15]70 flair::gui::TabWidget *tabwidget;
71 flair::gui::PushButton *save_button; //,*load_button;
[2]72
[15]73 xmlDocPtr file_doc;
[2]74
[15]75 typedef struct {
76 const flair::core::IODevice *device;
77 size_t size;
78 flair::core::Time time;
79 } log_header_t;
[2]80
[15]81private:
82 flair::core::FrameworkManager *self;
83 UDTSOCKET file_sock, com_sock;
84 UDTSOCKET GetSocket(std::string address, uint16_t port);
85 void Run();
86 void SendFile(std::string path, std::string name);
87 void FinishSending(void);
88 std::string FileName(flair::core::IODevice *device);
89 void SaveXmlChange(char *buf);
90 void SaveXml(void);
91 size_t rcv_buf_size;
92 char *rcv_buf;
[2]93#ifdef __XENO__
[15]94 int CreatePipe(RT_PIPE *fd, std::string name);
95 int DeletePipe(RT_PIPE *fd);
96 RT_PIPE cmd_pipe;
97 RT_PIPE data_pipe;
98 RT_HEAP log_heap;
[2]99#else
[15]100 int CreatePipe(int (*fd)[2], std::string name);
101 int DeletePipe(int (*fd)[2]);
102 int cmd_pipe[2];
103 int data_pipe[2];
[2]104#endif
[15]105 // logger
106 bool continuer; // a enlever, avoir un seul bool pour toutes les taches
107 static void *write_log_user(void *arg);
108 pthread_t log_th;
109 std::string xml_file;
110 bool logger_defined;
111 bool ui_defined;
112 flair::gui::Layout *top_layout;
[2]113
[15]114 typedef struct {
115 flair::core::IODevice *device;
116 size_t size;
117 hdfile_t *dbtFile;
118 bool running;
119 } log_desc_t;
[2]120
[15]121 std::vector<log_desc_t> logs;
122 std::vector<std::string> xml_changes;
123 flair::core::Watchdog *gcs_watchdog;
124 void ConnectionLost(void);
[2]125};
126
[15]127namespace {
128inline ui_com *getUiCom(void) { return FrameworkManager_impl::com; }
[2]129
[15]130inline FrameworkManager_impl *getFrameworkManagerImpl(void) {
131 return FrameworkManager_impl::_this;
[2]132}
[15]133}
[2]134
135#endif // FRAMEWORKMANAGER_IMPL_H
Note: See TracBrowser for help on using the repository browser.