Changeset 15 in flair-src for trunk/lib/FlairCore/src/unexported/FrameworkManager_impl.h
- Timestamp:
- Apr 8, 2016, 3:40:57 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairCore/src/unexported/FrameworkManager_impl.h
r2 r15 24 24 #endif 25 25 26 namespace flair 27 { 28 namespace core 29 { 30 class FrameworkManager; 31 class IODevice; 32 class Watchdog; 33 } 34 namespace gui 35 { 36 class TabWidget; 37 class PushButton; 38 class Layout; 39 } 26 namespace flair { 27 namespace core { 28 class FrameworkManager; 29 class IODevice; 30 class Watchdog; 31 } 32 namespace gui { 33 class TabWidget; 34 class PushButton; 35 class Layout; 36 } 40 37 } 41 38 42 39 class ui_com; 43 40 44 class FrameworkManager_impl : public flair::core::Thread45 { 46 public:47 FrameworkManager_impl(flair::core::FrameworkManager *self,std::string name);48 ~FrameworkManager_impl();49 void SetupConnection(std::string address,uint16_t port,size_t rcv_buf_size=10000);50 51 52 53 54 55 char*GetBuffer(size_t sz);56 void ReleaseBuffer(char*buf);57 void WriteLog(const char* buf,size_t size);41 class FrameworkManager_impl : public flair::core::Thread { 42 public: 43 FrameworkManager_impl(flair::core::FrameworkManager *self, std::string name); 44 ~FrameworkManager_impl(); 45 void SetupConnection(std::string address, uint16_t port, 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); 58 55 59 60 61 62 63 64 56 /*! 57 * \brief Affiche le xml 58 * 59 * Pour debug. 60 */ 61 void PrintXml(void) const; 65 62 66 67 68 69 70 71 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; 72 69 73 flair::gui::TabWidget*tabwidget;74 flair::gui::PushButton *save_button;//,*load_button;70 flair::gui::TabWidget *tabwidget; 71 flair::gui::PushButton *save_button; //,*load_button; 75 72 76 73 xmlDocPtr file_doc; 77 74 78 79 const flair::core::IODevice*device;80 81 82 75 typedef struct { 76 const flair::core::IODevice *device; 77 size_t size; 78 flair::core::Time time; 79 } log_header_t; 83 80 84 85 86 UDTSOCKET file_sock,com_sock;87 UDTSOCKET GetSocket(std::string address,uint16_t port);88 89 void SendFile(std::string path,std::string name);90 91 std::string FileName(flair::core::IODevice*device);92 void SaveXmlChange(char*buf);93 94 95 81 private: 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; 96 93 #ifdef __XENO__ 97 int CreatePipe(RT_PIPE* fd,std::string name);98 int DeletePipe(RT_PIPE*fd);99 100 101 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; 102 99 #else 103 int CreatePipe(int (*fd)[2],std::string name);104 105 106 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]; 107 104 #endif 108 //logger109 bool continuer;//a enlever, avoir un seul bool pour toutes les taches110 static void* write_log_user(void *arg);111 112 113 114 115 flair::gui::Layout*top_layout;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; 116 113 117 118 flair::core::IODevice*device;119 120 121 122 114 typedef struct { 115 flair::core::IODevice *device; 116 size_t size; 117 hdfile_t *dbtFile; 118 bool running; 119 } log_desc_t; 123 120 124 125 126 flair::core::Watchdog*gcs_watchdog;127 121 std::vector<log_desc_t> logs; 122 std::vector<std::string> xml_changes; 123 flair::core::Watchdog *gcs_watchdog; 124 void ConnectionLost(void); 128 125 }; 129 126 130 namespace 131 { 132 inline ui_com* getUiCom(void) { 133 return FrameworkManager_impl::com; 134 } 127 namespace { 128 inline ui_com *getUiCom(void) { return FrameworkManager_impl::com; } 135 129 136 inline FrameworkManager_impl*getFrameworkManagerImpl(void) {137 138 130 inline FrameworkManager_impl *getFrameworkManagerImpl(void) { 131 return FrameworkManager_impl::_this; 132 } 139 133 } 140 134
Note:
See TracChangeset
for help on using the changeset viewer.