Subversion Repositories Projects

Rev

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