Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
801 - 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 INPUT_TCP_H
20
#define INPUT_TCP_H
21
 
22
#include <QObject>
23
#include <QTcpServer>
24
#include <QTcpSocket>
25
#include <QTimer>
26
#include <QStringList>
27
 
28
#include "Input.h"
29
 
30
class Input_TCP : public Input
31
{
32
    Q_OBJECT
33
 
34
    public:
35
        void Init();
36
        bool Open(set_Input s_Input);
37
        bool IsOpen();
38
        bool Close();
39
        void send_Data(QString t_Data, int ID = 0);
40
        void send_RawData(char *t_Data);
41
        void stop_Resend(int ID);
42
        eMode Mode();
43
 
44
    private:
45
        // TCP Server und Socket.
46
        QTcpServer *TCP_Server;
47
        QTcpSocket *TCP_Socket;
48
        QTimer     *Timer;
49
        bool b_Open;
50
        s_Resend Confirm[MAX_Confirm];
51
        QString s_Buffer;
52
 
53
   private slots:
54
//        void slot_newDataReceived(const QByteArray &dataReceived);
55
        void slot_TCP_Connected();
56
        void slot_TCP_Disconnect();
57
        void slot_TCP_ReadLine();
58
        void slot_TCP_Error(QAbstractSocket::SocketError Error);
59
        void slot_Timer();
60
 
61
    signals:
62
        void sig_NewData(QString);
63
        void sig_Disconnected(int);
64
        void sig_Connected();
65
};
66
 
67
#endif // INPUT_TCP_H