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