EtherCAT Graphical User Interface Code 0.0.1
EtherCAT GUI that uses different communication protocols with EtherCAT Master server.
Loading...
Searching...
No Matches
ec_gui_net.h
1#ifndef EC_GUI_NET_H
2#define EC_GUI_NET_H
3
4#include <QtUiTools>
5#include <QWidget>
6
7#include "ec_gui_terminal.h"
8
9class EcGuiNet : public QWidget
10{
11 Q_OBJECT
12public:
13
15 std::string protocol;
16 std::string host_name;
17 uint32_t host_port;
18 };
19
20 typedef std::shared_ptr<EcGuiNet> Ptr;
21
22 explicit EcGuiNet(QWidget *parent = nullptr);
23
24 ~EcGuiNet();
25
26 bool start_network();
27 bool stop_network();
28 void copy_files_network(const QStringList &files_list);
29 void open_firmware_config();
30 void start_firmware_update();
31 void stop_firmware_update();
32 void set_repl_config(const QString& repl_bin);
33 void set_protocol_enabled(bool enable);
34 void set_net_enabled(bool enable);
35 ec_net_info_t get_net_setup();
36
37private slots:
38 void ec_master_processFinished(int, QProcess::ExitStatus);
39 void server_processFinished(int, QProcess::ExitStatus);
40 void OnMouseClicked(QTreeWidgetItem* item, int column);
41 void OnPasswordEntered();
42 void OnPasswordChanged();
43 void OnProtocolChanged();
44 void stopping_network(bool force_stop=false);
45 void connect_to_network();
46
47protected:
48 bool eventFilter( QObject* o, QEvent* e );
49
50private:
51
52 QTreeWidget * _net_tree_wid;
53 QTreeWidgetItem* _net_item;
54 QLineEdit *_password;
55 int _net_column;
56 bool _net_enabled;
57
58 QProcess *_ec_master_process,*_server_process;
59 QStringList _ssh_command;
60 QString _ec_master_stdout,_server_stdout;
61 QString _ec_master_file_path,_server_file_path,_gui_file_path;
62 QFile *_ec_master_file=nullptr,*_server_file=nullptr;
63 QTextStream *_ec_master_stream,*_server_stream;
64 QString _server_username,_server_hostname,_server_port,_server_protocol,_server_pwd;
65 QString _real_server_username;
66 QString _master_terminal_pid="",_server_terminal_pid="",_gui_terminal_pid="";
67 QString _repl_config;
68 QAction *_connect_action;
69
70 QComboBox * _protocol_combobox;
71 bool _open_config_file=false;
72
73 bool create_ssh_cmd(QProcess *process,QString& stdout);
74 QString find_running_process(QProcess * process,QString bin_name,QString& stdout);
75 QString find_process(QProcess * process,QString bin_name,QString& stdout);
76 void start_process(QProcess *process,QString bin_file_path,QString option);
77 void kill_process(QProcess *process,QString bin_name,QString& stdout);
78
79 void kill_view_process(QString &terminal_pid);
80 void view_process(const QString &file_path,QString &terminal_pid);
81 bool start_master_process(const QString &bin_file_name,
82 const QString &option,
83 QString &error);
84 void ec_master_readyStdO();
85 void view_master_process();
86 void server_readyStdO();
87 void view_server_process();
88 void set_ec_network();
89 void view_gui_process();
90 bool copy_config_file();
91 void save_config_file();
92 void close_net_setup();
93};
94#endif // EC_GUI_NET_H
Definition ec_gui_net.h:10
Definition ec_gui_net.h:14