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

Last change on this file was 414, checked in by Sanahuja Guillaume, 10 months ago

added possibility to autodetect gcs ip when using autodetect as address parameter, see demos. This only works when ssh connected to a target (not in simulation)

File size: 3.3 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,
[186]46 size_t rcv_buf_size);
[15]47 void SetupUserInterface(std::string xml_file);
[213]48 void SetupLogger(std::string log_path,uint32_t stackSize);
[15]49 void AddDeviceToLog(flair::core::IODevice *device);
[122]50 bool IsDeviceLogged(const flair::core::IODevice *device) const;
[15]51 void StartLog();
52 void StopLog();
53 char *GetBuffer(size_t sz);
54 void ReleaseBuffer(char *buf);
55 void WriteLog(const char *buf, size_t size);
[2]56
[15]57 /*!
58 * \brief Affiche le xml
59 *
60 * Pour debug.
61 */
62 void PrintXml(void) const;
[2]63
[15]64 bool is_logging;
65 bool disable_errors;
66 bool connection_lost;
67 static ui_com *com;
68 static FrameworkManager_impl *_this;
69 std::string log_path;
[2]70
[15]71 flair::gui::TabWidget *tabwidget;
72 flair::gui::PushButton *save_button; //,*load_button;
[2]73
[15]74 xmlDocPtr file_doc;
[2]75
[15]76 typedef struct {
77 const flair::core::IODevice *device;
78 size_t size;
79 flair::core::Time time;
80 } log_header_t;
[2]81
[15]82private:
83 flair::core::FrameworkManager *self;
[234]84 UDTSOCKET com_sock;
85 UDTSOCKET GetSocket(void);
[15]86 void Run();
[234]87 void SendFile(UDTSOCKET socket,std::string path, std::string name);
88 void FinishSending(UDTSOCKET socket);
[15]89 std::string FileName(flair::core::IODevice *device);
90 void SaveXmlChange(char *buf);
91 void SaveXml(void);
[414]92 std::string AutoDetectGCS(void);
[15]93 size_t rcv_buf_size;
94 char *rcv_buf;
[234]95 std::string address;
96 uint16_t port;
[2]97#ifdef __XENO__
[15]98 int CreatePipe(RT_PIPE *fd, std::string name);
99 int DeletePipe(RT_PIPE *fd);
100 RT_PIPE cmd_pipe;
101 RT_PIPE data_pipe;
102 RT_HEAP log_heap;
[2]103#else
[15]104 int CreatePipe(int (*fd)[2], std::string name);
105 int DeletePipe(int (*fd)[2]);
106 int cmd_pipe[2];
107 int data_pipe[2];
[2]108#endif
[15]109 // logger
110 bool continuer; // a enlever, avoir un seul bool pour toutes les taches
111 static void *write_log_user(void *arg);
112 pthread_t log_th;
113 std::string xml_file;
114 bool logger_defined;
115 bool ui_defined;
116 flair::gui::Layout *top_layout;
[2]117
[15]118 typedef struct {
119 flair::core::IODevice *device;
120 size_t size;
121 hdfile_t *dbtFile;
122 bool running;
123 } log_desc_t;
[2]124
[15]125 std::vector<log_desc_t> logs;
126 std::vector<std::string> xml_changes;
127 flair::core::Watchdog *gcs_watchdog;
[254]128 void SetConnectionLost(void);
[2]129};
130
[15]131namespace {
132inline ui_com *getUiCom(void) { return FrameworkManager_impl::com; }
[2]133
[15]134inline FrameworkManager_impl *getFrameworkManagerImpl(void) {
135 return FrameworkManager_impl::_this;
[2]136}
[15]137}
[2]138
139#endif // FRAMEWORKMANAGER_IMPL_H
Note: See TracBrowser for help on using the repository browser.