Subversion Repositories Projects

Rev

Blame | 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 WGT_CONNECTION_H
#define WGT_CONNECTION_H

#include <QWidget>
#include <QTimer>

#include "ui_wgt_Connection.h"

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

struct set_SERVER
{
    int IP_MAX;
    int IP_ID;
    int Intervall;
    QString IP[10];
    QString Password;
};

class wgt_Connection : public QWidget, public Ui::wgt_Connection_ui
{
    Q_OBJECT

    public:
        wgt_Connection(QWidget *parent = 0);
        ~wgt_Connection();

        void send_Data(QString ps_Data, int pi_ID = 0);

        void set_Client(int li_ID, QString ls_Client, QString ls_Fields);
        void set_ButtonVisible(bool pi_Visible);
        void set_SelectVisible(bool pi_Visible);
        void set_IntervalVisible(bool pi_Visible);
        Input *o_Input;

    private:

        QTimer *o_AboTimer;

        // Verbindungs-Objekt
        char c_Data[200];

        bool gi_Interval[2];

        // Info über die Hardware
        s_Hardware VersionInfo;


        QString gs_Client;
        QString gs_Fields;
//        char gs_Interval;
        int gi_ID;

        set_SERVER    SERVER;

        void read_Settings();
        void write_Settings();

        void parse_IP_Data(QString t_Data);
        void parse_MK_Data(QString t_Data);

    public slots:
        void slot_btn_Connect();
        void slot_send_Data(QString ps_Data, int pi_ID = 0);

    private slots:
        void slot_sb_Intervall(int t_Intervall);

        void slot_Input_Data(QString t_Data);
        void slot_Input_Connected();
        void slot_Input_Disconnected(int Error);

        void slot_TimeOut_AboTimer();

    signals:
        void sig_Status(int);
        void sig_RawData(QString);
        void sig_MK_Version(s_Hardware);
        void sig_MK_Debug(s_MK_Debug);
        void sig_MK_DebugLabels(s_MK_DebugLabels);
        void sig_MK_NaviData(s_MK_NaviData);
        void sig_MK_WayPoint(int);
        void sig_MK_ReadSettings(s_MK_Settings);
        void sig_MK_WriteSettings(int);
        void sig_MK_ReadMotorMixer(s_MK_Mixer);
        void sig_MK_WriteMotorMixer(int);
        void sig_MK_PPMData(s_MK_PPM_Data);

};

#endif // WGT_CONNECTION_H