Subversion Repositories Projects

Rev

Rev 711 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 711 Rev 715
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
 
81
 
81
        //Liste alle IP-Verbindungen und deren Parameter.
82
        //Liste alle IP-Verbindungen und deren Parameter.
82
        int Connect_Count;
83
        int Connect_Count;
83
        sConnection Con_Server[DEV_IP_MAX];
84
        sConnection Con_Server[DEV_IP_MAX];
84
        sConnection Con_Output;
85
        sConnection Con_Output;
85
 
86
 
86
        QListWidgetItem *Item[DEV_IP_MAX];
87
        QListWidgetItem *Item[DEV_IP_MAX];
87
 
88
 
88
        s_Hardware VersionInfo;
89
        s_Hardware VersionInfo;
89
 
90
 
90
        char c_Data[150];
91
        char c_Data[150];
91
 
92
 
92
        // Programm-Initialisirungen
93
        // Programm-Initialisirungen
93
        void init_GUI();
94
        void init_GUI();
94
        void init_Connections();
95
        void init_Connections();
95
 
96
 
96
        // IP-Ports initialisieren
97
        // IP-Ports initialisieren
97
        bool init_TCP();
98
        bool init_TCP();
98
 
99
 
99
        // Einkommende Datenpackete zerlegen.
100
        // Einkommende Datenpackete zerlegen.
100
        void parse_Input_Data(QString t_Data);
101
        void parse_Input_Data(QString t_Data);
101
 
102
 
102
        // Einkommende Datenpackete weiterleiten
103
        // Einkommende Datenpackete weiterleiten
103
        void route_Input_Data(QString t_Data);
104
        void route_Input_Data(QString t_Data);
104
 
105
 
105
        void parse_TCP_Server_Data(QString t_Data, int t_ID);
106
        void parse_TCP_Server_Data(QString t_Data, int t_ID);
106
        void parse_TCP_Input_Data(QString t_Data);
107
        void parse_TCP_Input_Data(QString t_Data);
107
        void parse_TCP_Output_Data(QString t_Data);
108
        void parse_TCP_Output_Data(QString t_Data);
108
 
109
 
109
        // Freies IP-Socket ermitteln
110
        // Freies IP-Socket ermitteln
110
        int get_FreeSocket();
111
        int get_FreeSocket();
111
 
112
 
112
        // Daten aufs IP-Interface senden.
113
        // Daten aufs IP-Interface senden.
113
        void send_TCP(QTcpSocket *Socket, QString Data);
114
        void send_TCP(QTcpSocket *Socket, QString Data);
114
 
115
 
115
        void show_Terminal(int t_Typ, QString t_Data);
116
        void show_Terminal(int t_Typ, QString t_Data);
116
 
117
 
117
    private slots:
118
    private slots:
118
        void slot_ac_About();
119
        void slot_ac_About();
119
        void slot_ac_Server();
120
        void slot_ac_Server();
120
 
121
 
121
        // Connect-Button
122
        // Connect-Button
122
        void slot_btn_Connect();
123
        void slot_btn_Connect();
123
 
124
 
124
        void slot_btn_cScope();
125
        void slot_btn_cScope();
125
        void slot_btn_cSettings();
126
        void slot_btn_cSettings();
126
        void slot_btn_cMaps();
127
        void slot_btn_cMaps();
127
        void slot_btn_cVoice();
128
        void slot_btn_cVoice();
128
        void slot_btn_cLogger();
129
        void slot_btn_cLogger();
129
 
130
 
130
        void slot_btn_Terminal();
131
        void slot_btn_Terminal();
131
        void slot_btn_ConnectServer();
132
        void slot_btn_ConnectServer();
132
 
133
 
133
        // Einkommende Datenpackete.
134
        // Einkommende Datenpackete.
134
        void slot_Input_Data(QString t_Data);
135
        void slot_Input_Data(QString t_Data);
135
        void slot_Input_Disconnected(int Error);
136
        void slot_Input_Disconnected(int Error);
136
        void slot_Input_Connected();
137
        void slot_Input_Connected();
137
 
138
 
138
        void slot_TCP_NewConnection();
139
        void slot_TCP_NewConnection();
139
        void slot_TCP_Disconnect();
140
        void slot_TCP_Disconnect();
140
        void slot_TCP_Read();
141
        void slot_TCP_Read();
141
 
142
 
142
        void slot_Output_Data(QString t_Data);
143
        void slot_Output_Data(QString t_Data);
143
        void slot_Output_Disconnected(int Error);
144
        void slot_Output_Disconnected(int Error);
144
        void slot_Output_Connected();
145
        void slot_Output_Connected();
145
 
146
 
146
};
147
};
147
 
148
 
148
#endif // DLG_MAIN_H
149
#endif // DLG_MAIN_H
149
 
150