Subversion Repositories Projects

Rev

Rev 715 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 715 Rev 750
1
/***************************************************************************
1
/***************************************************************************
2
 *   Copyright (C) 2009 by Manuel Schrape                                  *
2
 *   Copyright (C) 2009 by Manuel Schrape                                  *
3
 *   manuel.schrape@gmx.de                                                 *
3
 *   manuel.schrape@gmx.de                                                 *
4
 *                                                                         *
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
5
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   it under the terms of the GNU General Public License as published by  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation; either version 2 of the License.        *
7
 *   the Free Software Foundation; either version 2 of the License.        *
8
 *                                                                         *
8
 *                                                                         *
9
 *   This program is distributed in the hope that it will be useful,       *
9
 *   This program is distributed in the hope that it will be useful,       *
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12
 *   GNU General Public License for more details.                          *
12
 *   GNU General Public License for more details.                          *
13
 *                                                                         *
13
 *                                                                         *
14
 *   You should have received a copy of the GNU General Public License     *
14
 *   You should have received a copy of the GNU General Public License     *
15
 *   along with this program; if not, write to the                         *
15
 *   along with this program; if not, write to the                         *
16
 *   Free Software Foundation, Inc.,                                       *
16
 *   Free Software Foundation, Inc.,                                       *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 ***************************************************************************/
18
 ***************************************************************************/
19
#ifndef DLG_MAIN_H
19
#ifndef DLG_MAIN_H
20
#define DLG_MAIN_H
20
#define DLG_MAIN_H
21
 
21
 
22
#include <QtGui/QMainWindow>
22
#include <QtGui/QMainWindow>
23
#include <QTcpServer>
23
#include <QTcpServer>
24
#include <QTcpSocket>
24
#include <QTcpSocket>
25
#include <QProcess>
25
#include <QProcess>
26
#include <QDir>
26
#include <QDir>
27
 
27
 
28
#include "ui_dlg_Main.h"
28
#include "ui_dlg_Main.h"
29
 
29
 
30
#include "dlg_Preferences.h"
30
#include "dlg_Preferences.h"
31
#include "dlg_Terminal.h"
31
#include "dlg_Terminal.h"
32
 
32
 
33
#include "../Defines.h"
33
#include "../Defines.h"
34
#include "../TypeDefs.h"
34
#include "../TypeDefs.h"
35
 
35
 
36
#include "../Classes/cSettings.h"
36
#include "../Classes/cSettings.h"
37
 
37
 
38
#include "../../Global/Kopter.h"
38
#include "../../Global/Kopter.h"
39
#include "../../Global/Class_Input/Input.h"
39
#include "../../Global/Class_Input/Input.h"
40
#include "../../Global/Class_Input/Input_TTY.h"
40
#include "../../Global/Class_Input/Input_TTY.h"
41
#include "../../Global/Class_Input/Input_TCP.h"
41
#include "../../Global/Class_Input/Input_TCP.h"
42
#include "../../Global/Class_HandlerMK/HandlerMK.h"
42
#include "../../Global/Class_HandlerMK/HandlerMK.h"
43
#include "../../Global/Class_HandlerIP/HandlerIP.h"
43
#include "../../Global/Class_HandlerIP/HandlerIP.h"
44
#include "../../Global/Class_SerialPort/ManageSerialPort.h"
44
#include "../../Global/Class_SerialPort/ManageSerialPort.h"
45
 
45
 
46
class dlg_Main : public QMainWindow, public Ui::dlg_Main_UI
46
class dlg_Main : public QMainWindow, public Ui::dlg_Main_UI
47
{
47
{
48
    Q_OBJECT
48
    Q_OBJECT
49
 
49
 
50
    public:
50
    public:
51
        dlg_Main();
51
        dlg_Main();
52
        ~dlg_Main();
52
        ~dlg_Main();
53
        void set_ARGV(char *Programm);
53
        void set_ARGV(char *Programm);
54
 
54
 
55
    private:
55
    private:
56
        QString QMK_Dir;
56
        QString QMK_Dir;
57
 
57
 
58
        // Input Device.
58
        // Input Device.
59
        Input *o_Input;
59
        Input *o_Input;
60
        Input *o_Output;
60
        Input *o_Output;
61
 
61
 
62
        set_Input s_Input;
62
        set_Input s_Input;
63
        set_Input s_Output;
63
        set_Input s_Output;
64
 
64
 
65
 
65
 
66
        // Settings-Object
66
        // Settings-Object
67
        cSettings *o_Settings;
67
        cSettings *o_Settings;
68
 
68
 
69
        dlg_Terminal *f_Terminal;
69
        dlg_Terminal *f_Terminal;
70
 
70
 
71
        QProcess *o_cScope;
71
        QProcess *o_cScope;
72
        QProcess *o_cSettings;
72
        QProcess *o_cSettings;
73
        QProcess *o_cMaps;
73
        QProcess *o_cMaps;
74
        QProcess *o_cVoice;
74
        QProcess *o_cVoice;
75
        QProcess *o_cLogger;
75
        QProcess *o_cLogger;
76
 
76
 
77
        // TCP Server und Socket.
77
        // TCP Server und Socket.
78
        QTcpServer *TCP_Server;
78
        QTcpServer *TCP_Server;
79
        QTcpSocket *o_TCP[DEV_IP_MAX];
79
        QTcpSocket *o_TCP[DEV_IP_MAX];
80
        QString s_Buffer;
80
        QString s_Buffer;
81
 
81
 
82
        //Liste alle IP-Verbindungen und deren Parameter.
82
        //Liste alle IP-Verbindungen und deren Parameter.
83
        int Connect_Count;
83
        int Connect_Count;
84
        sConnection Con_Server[DEV_IP_MAX];
84
        sConnection Con_Server[DEV_IP_MAX];
85
        sConnection Con_Output;
85
        sConnection Con_Output;
86
 
86
 
87
        QListWidgetItem *Item[DEV_IP_MAX];
87
        QListWidgetItem *Item[DEV_IP_MAX];
88
 
88
 
89
        s_Hardware VersionInfo;
89
        s_Hardware VersionInfo;
90
 
90
 
91
        char c_Data[150];
91
        char c_Data[150];
92
 
92
 
93
        // Programm-Initialisirungen
93
        // Programm-Initialisirungen
94
        void init_GUI();
94
        void init_GUI();
95
        void init_Connections();
95
        void init_Connections();
96
 
96
 
97
        // IP-Ports initialisieren
97
        // IP-Ports initialisieren
98
        bool init_TCP();
98
        bool init_TCP();
99
 
99
 
100
        // Einkommende Datenpackete zerlegen.
100
        // Einkommende Datenpackete zerlegen.
101
        void parse_Input_Data(QString t_Data);
101
        void parse_Input_Data(QString t_Data);
102
 
102
 
103
        // Einkommende Datenpackete weiterleiten
103
        // Einkommende Datenpackete weiterleiten
104
        void route_Input_Data(QString t_Data);
104
        void route_Input_Data(QString t_Data);
105
 
105
 
106
        void parse_TCP_Server_Data(QString t_Data, int t_ID);
106
        void parse_TCP_Server_Data(QString t_Data, int t_ID);
107
        void parse_TCP_Input_Data(QString t_Data);
107
        void parse_TCP_Input_Data(QString t_Data);
108
        void parse_TCP_Output_Data(QString t_Data);
108
        void parse_TCP_Output_Data(QString t_Data);
109
 
109
 
110
        // Freies IP-Socket ermitteln
110
        // Freies IP-Socket ermitteln
111
        int get_FreeSocket();
111
        int get_FreeSocket();
112
 
112
 
113
        // Daten aufs IP-Interface senden.
113
        // Daten aufs IP-Interface senden.
114
        void send_TCP(QTcpSocket *Socket, QString Data);
114
        void send_TCP(QTcpSocket *Socket, QString Data);
115
 
115
 
116
        void show_Terminal(int t_Typ, QString t_Data);
116
        void show_Terminal(int t_Typ, QString t_Data);
117
 
117
 
118
    private slots:
118
    private slots:
119
        void slot_ac_About();
119
        void slot_ac_About();
120
        void slot_ac_Server();
120
        void slot_ac_Server();
121
 
121
 
122
        // Connect-Button
122
        // Connect-Button
123
        void slot_btn_Connect();
123
        void slot_btn_Connect();
124
 
124
 
125
        void slot_btn_cScope();
125
        void slot_btn_cScope();
126
        void slot_btn_cSettings();
126
        void slot_btn_cSettings();
127
        void slot_btn_cMaps();
127
        void slot_btn_cMaps();
128
        void slot_btn_cVoice();
128
        void slot_btn_cVoice();
129
        void slot_btn_cLogger();
129
        void slot_btn_cLogger();
130
 
130
 
131
        void slot_btn_Terminal();
131
        void slot_btn_Terminal();
132
        void slot_btn_ConnectServer();
132
        void slot_btn_ConnectServer();
-
 
133
        void slot_btn_Debug();
-
 
134
 
-
 
135
        void slot_rb_Hardware();
133
 
136
 
134
        // Einkommende Datenpackete.
137
        // Einkommende Datenpackete.
135
        void slot_Input_Data(QString t_Data);
138
        void slot_Input_Data(QString t_Data);
136
        void slot_Input_Disconnected(int Error);
139
        void slot_Input_Disconnected(int Error);
137
        void slot_Input_Connected();
140
        void slot_Input_Connected();
138
 
141
 
139
        void slot_TCP_NewConnection();
142
        void slot_TCP_NewConnection();
140
        void slot_TCP_Disconnect();
143
        void slot_TCP_Disconnect();
141
        void slot_TCP_Read();
144
        void slot_TCP_Read();
142
 
145
 
143
        void slot_Output_Data(QString t_Data);
146
        void slot_Output_Data(QString t_Data);
144
        void slot_Output_Disconnected(int Error);
147
        void slot_Output_Disconnected(int Error);
145
        void slot_Output_Connected();
148
        void slot_Output_Connected();
146
 
149
 
147
};
150
};
148
 
151
 
149
#endif // DLG_MAIN_H
152
#endif // DLG_MAIN_H
150
 
153