Subversion Repositories Projects

Rev

Rev 711 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/***************************************************************************
 *   Copyright (C) 2009 by Manuel Schrape                                  *
 *   manuel.schrape@gmx.de                                                 *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License.        *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef DLG_MAIN_H
#define DLG_MAIN_H

#include <QtGui/QMainWindow>
#include <QTcpServer>
#include <QTcpSocket>
#include <QProcess>
#include <QDir>

#include "ui_dlg_Main.h"

#include "dlg_Preferences.h"
#include "dlg_Terminal.h"

#include "../Defines.h"
#include "../TypeDefs.h"

#include "../Classes/cSettings.h"

#include "../../Global/Kopter.h"
#include "../../Global/Class_Input/Input.h"
#include "../../Global/Class_Input/Input_TTY.h"
#include "../../Global/Class_HandlerMK/HandlerMK.h"
#include "../../Global/Class_HandlerIP/HandlerIP.h"
#include "../../Global/Class_SerialPort/ManageSerialPort.h"

class dlg_Main : public QMainWindow, public Ui::dlg_Main_UI
{
    Q_OBJECT

    public:
        dlg_Main();
        ~dlg_Main();
        void set_ARGV(char *Programm);

    private:
        QString QMK_Dir;

        // Input Device.
        Input *o_Input;
        set_Input s_Input;

        // Settings-Object
        cSettings *o_Settings;

        dlg_Terminal *f_Terminal;

        QProcess *o_cScope;
        QProcess *o_cSettings;
        QProcess *o_cMaps;
        QProcess *o_cVoice;
        QProcess *o_cLogger;

        // TCP Server und Socket.
        QTcpServer *TCP_Server;
        QTcpSocket *o_TCP[DEV_IP_MAX];

        //Liste alle IP-Verbindungen und deren Parameter.
        int Connect_Count;
        sConnection Connection[DEV_IP_MAX];

        QListWidgetItem *Item[DEV_IP_MAX][2];

        s_Hardware VersionInfo;

        char c_Data[150];

        // Programm-Initialisirungen
        void init_GUI();
        void init_Connections();

        // IP-Ports initialisieren
        bool init_TCP();

        // Einkommende Datenpackete zerlegen.
        void parse_Input_Data(QString t_Data);

        // Einkommende Datenpackete weiterleiten
        void route_Input_Data(QString t_Data);

        void parse_TCP_Data(QString t_Data, int t_ID);

        // Freies IP-Socket ermitteln
        int get_FreeSocket();

        // Daten aufs IP-Interface senden.
        void send_TCP(QTcpSocket *Socket, QString Data);

        void show_Terminal(int t_Typ, QString t_Data);

    private slots:
        void slot_ac_About();
        void slot_ac_Server();

        // Connect-Button
        void slot_btn_Connect();

        void slot_btn_cScope();
        void slot_btn_cSettings();
        void slot_btn_cMaps();
        void slot_btn_cVoice();
        void slot_btn_cLogger();

        void slot_btn_Terminal();

        // Einkommende Datenpackete.
        void slot_Input_Data(QString t_Data);

        void slot_TCP_NewConnection();
        void slot_TCP_Disconnect();
        void slot_TCP_Read();
};

#endif // DLG_MAIN_H