Subversion Repositories Projects

Rev

Rev 674 | Rev 715 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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