Subversion Repositories Projects

Rev

Rev 674 | 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 INPUT_TCP_H
20
#define INPUT_TCP_H
21
 
22
#include <QObject>
23
#include <QTcpServer>
24
#include <QTcpSocket>
25
#include <QTimer>
711 KeyOz 26
#include <QStringList>
674 KeyOz 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
 
52
   private slots:
53
//        void slot_newDataReceived(const QByteArray &dataReceived);
54
        void slot_TCP_Connected();
55
        void slot_TCP_Disconnect();
56
        void slot_TCP_ReadLine();
57
        void slot_TCP_Error(QAbstractSocket::SocketError Error);
58
        void slot_Timer();
59
 
60
    signals:
61
        void sig_NewData(QString);
62
        void sig_Disconnected(int);
63
        void sig_Connected();
64
};
65
 
66
#endif // INPUT_TCP_H