Subversion Repositories Projects

Rev

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

Rev 674 Rev 711
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_HandlerMK/HandlerMK.h"
42
#include "../../Global/Class_HandlerMK/HandlerMK.h"
42
#include "../../Global/Class_HandlerIP/HandlerIP.h"
43
#include "../../Global/Class_HandlerIP/HandlerIP.h"
43
#include "../../Global/Class_SerialPort/ManageSerialPort.h"
44
#include "../../Global/Class_SerialPort/ManageSerialPort.h"
44
 
45
 
45
class dlg_Main : public QMainWindow, public Ui::dlg_Main_UI
46
class dlg_Main : public QMainWindow, public Ui::dlg_Main_UI
46
{
47
{
47
    Q_OBJECT
48
    Q_OBJECT
48
 
49
 
49
    public:
50
    public:
50
        dlg_Main();
51
        dlg_Main();
51
        ~dlg_Main();
52
        ~dlg_Main();
52
        void set_ARGV(char *Programm);
53
        void set_ARGV(char *Programm);
53
 
54
 
54
    private:
55
    private:
55
        QString QMK_Dir;
56
        QString QMK_Dir;
56
 
57
 
57
        // Input Device.
58
        // Input Device.
58
        Input *o_Input;
59
        Input *o_Input;
-
 
60
        Input *o_Output;
-
 
61
 
59
        set_Input s_Input;
62
        set_Input s_Input;
-
 
63
        set_Input s_Output;
-
 
64
 
60
 
65
 
61
        // Settings-Object
66
        // Settings-Object
62
        cSettings *o_Settings;
67
        cSettings *o_Settings;
63
 
68
 
64
        dlg_Terminal *f_Terminal;
69
        dlg_Terminal *f_Terminal;
65
 
70
 
66
        QProcess *o_cScope;
71
        QProcess *o_cScope;
67
        QProcess *o_cSettings;
72
        QProcess *o_cSettings;
68
        QProcess *o_cMaps;
73
        QProcess *o_cMaps;
69
        QProcess *o_cVoice;
74
        QProcess *o_cVoice;
70
        QProcess *o_cLogger;
75
        QProcess *o_cLogger;
71
 
76
 
72
        // TCP Server und Socket.
77
        // TCP Server und Socket.
73
        QTcpServer *TCP_Server;
78
        QTcpServer *TCP_Server;
74
        QTcpSocket *o_TCP[DEV_IP_MAX];
79
        QTcpSocket *o_TCP[DEV_IP_MAX];
75
 
80
 
76
        //Liste alle IP-Verbindungen und deren Parameter.
81
        //Liste alle IP-Verbindungen und deren Parameter.
77
        int Connect_Count;
82
        int Connect_Count;
78
        sConnection Connection[DEV_IP_MAX];
83
        sConnection Con_Server[DEV_IP_MAX];
-
 
84
        sConnection Con_Output;
79
 
85
 
80
        QListWidgetItem *Item[DEV_IP_MAX][2];
86
        QListWidgetItem *Item[DEV_IP_MAX];
81
 
87
 
82
        s_Hardware VersionInfo;
88
        s_Hardware VersionInfo;
83
 
89
 
84
        char c_Data[150];
90
        char c_Data[150];
85
 
91
 
86
        // Programm-Initialisirungen
92
        // Programm-Initialisirungen
87
        void init_GUI();
93
        void init_GUI();
88
        void init_Connections();
94
        void init_Connections();
89
 
95
 
90
        // IP-Ports initialisieren
96
        // IP-Ports initialisieren
91
        bool init_TCP();
97
        bool init_TCP();
92
 
98
 
93
        // Einkommende Datenpackete zerlegen.
99
        // Einkommende Datenpackete zerlegen.
94
        void parse_Input_Data(QString t_Data);
100
        void parse_Input_Data(QString t_Data);
95
 
101
 
96
        // Einkommende Datenpackete weiterleiten
102
        // Einkommende Datenpackete weiterleiten
97
        void route_Input_Data(QString t_Data);
103
        void route_Input_Data(QString t_Data);
98
 
104
 
-
 
105
        void parse_TCP_Server_Data(QString t_Data, int t_ID);
-
 
106
        void parse_TCP_Input_Data(QString t_Data);
99
        void parse_TCP_Data(QString t_Data, int t_ID);
107
        void parse_TCP_Output_Data(QString t_Data);
100
 
108
 
101
        // Freies IP-Socket ermitteln
109
        // Freies IP-Socket ermitteln
102
        int get_FreeSocket();
110
        int get_FreeSocket();
103
 
111
 
104
        // Daten aufs IP-Interface senden.
112
        // Daten aufs IP-Interface senden.
105
        void send_TCP(QTcpSocket *Socket, QString Data);
113
        void send_TCP(QTcpSocket *Socket, QString Data);
106
 
114
 
107
        void show_Terminal(int t_Typ, QString t_Data);
115
        void show_Terminal(int t_Typ, QString t_Data);
108
 
116
 
109
    private slots:
117
    private slots:
110
        void slot_ac_About();
118
        void slot_ac_About();
111
        void slot_ac_Server();
119
        void slot_ac_Server();
112
 
120
 
113
        // Connect-Button
121
        // Connect-Button
114
        void slot_btn_Connect();
122
        void slot_btn_Connect();
115
 
123
 
116
        void slot_btn_cScope();
124
        void slot_btn_cScope();
117
        void slot_btn_cSettings();
125
        void slot_btn_cSettings();
118
        void slot_btn_cMaps();
126
        void slot_btn_cMaps();
119
        void slot_btn_cVoice();
127
        void slot_btn_cVoice();
120
        void slot_btn_cLogger();
128
        void slot_btn_cLogger();
121
 
129
 
122
        void slot_btn_Terminal();
130
        void slot_btn_Terminal();
-
 
131
        void slot_btn_ConnectServer();
123
 
132
 
124
        // Einkommende Datenpackete.
133
        // Einkommende Datenpackete.
125
        void slot_Input_Data(QString t_Data);
134
        void slot_Input_Data(QString t_Data);
-
 
135
        void slot_Input_Disconnected(int Error);
-
 
136
        void slot_Input_Connected();
126
 
137
 
127
        void slot_TCP_NewConnection();
138
        void slot_TCP_NewConnection();
128
        void slot_TCP_Disconnect();
139
        void slot_TCP_Disconnect();
129
        void slot_TCP_Read();
140
        void slot_TCP_Read();
-
 
141
 
-
 
142
        void slot_Output_Data(QString t_Data);
-
 
143
        void slot_Output_Disconnected(int Error);
-
 
144
        void slot_Output_Connected();
-
 
145
 
130
};
146
};
131
 
147
 
132
#endif // DLG_MAIN_H
148
#endif // DLG_MAIN_H
133
 
149