Rev 674 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 674 | Rev 711 | ||
---|---|---|---|
1 | /*************************************************************************** |
1 | /*************************************************************************** |
2 | * Copyright (C) 2009 by Manuel Schrape * |
2 | * Copyright (C) 2009 by Manuel Schrape * |
3 | * manuel.schrape@gmx.de * |
3 | * manuel.schrape@gmx.de * |
4 | * * |
4 | * * |
5 | * This program is free software; you can redistribute it and/or modify * |
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 * |
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. * |
7 | * the Free Software Foundation; either version 2 of the License. * |
8 | * * |
8 | * * |
9 | * This program is distributed in the hope that it will be useful, * |
9 | * This program is distributed in the hope that it will be useful, * |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
12 | * GNU General Public License for more details. * |
12 | * GNU General Public License for more details. * |
13 | * * |
13 | * * |
14 | * You should have received a copy of the GNU General Public License * |
14 | * You should have received a copy of the GNU General Public License * |
15 | * along with this program; if not, write to the * |
15 | * along with this program; if not, write to the * |
16 | * Free Software Foundation, Inc., * |
16 | * Free Software Foundation, Inc., * |
17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
18 | ***************************************************************************/ |
18 | ***************************************************************************/ |
19 | #ifndef INPUT_TCP_H |
19 | #ifndef INPUT_TCP_H |
20 | #define INPUT_TCP_H |
20 | #define INPUT_TCP_H |
21 | 21 | ||
22 | #include <QObject> |
22 | #include <QObject> |
23 | #include <QTcpServer> |
23 | #include <QTcpServer> |
24 | #include <QTcpSocket> |
24 | #include <QTcpSocket> |
25 | #include <QTimer> |
25 | #include <QTimer> |
- | 26 | #include <QStringList> |
|
26 | 27 | ||
27 | #include "Input.h" |
28 | #include "Input.h" |
28 | 29 | ||
29 | class Input_TCP : public Input |
30 | class Input_TCP : public Input |
30 | { |
31 | { |
31 | Q_OBJECT |
32 | Q_OBJECT |
32 | 33 | ||
33 | public: |
34 | public: |
34 | void Init(); |
35 | void Init(); |
35 | bool Open(set_Input s_Input); |
36 | bool Open(set_Input s_Input); |
36 | bool IsOpen(); |
37 | bool IsOpen(); |
37 | bool Close(); |
38 | bool Close(); |
38 | void send_Data(QString t_Data, int ID = 0); |
39 | void send_Data(QString t_Data, int ID = 0); |
39 | void send_RawData(char *t_Data); |
40 | void send_RawData(char *t_Data); |
40 | void stop_Resend(int ID); |
41 | void stop_Resend(int ID); |
41 | eMode Mode(); |
42 | eMode Mode(); |
42 | 43 | ||
43 | private: |
44 | private: |
44 | // TCP Server und Socket. |
45 | // TCP Server und Socket. |
45 | QTcpServer *TCP_Server; |
46 | QTcpServer *TCP_Server; |
46 | QTcpSocket *TCP_Socket; |
47 | QTcpSocket *TCP_Socket; |
47 | QTimer *Timer; |
48 | QTimer *Timer; |
48 | bool b_Open; |
49 | bool b_Open; |
49 | s_Resend Confirm[MAX_Confirm]; |
50 | s_Resend Confirm[MAX_Confirm]; |
50 | 51 | ||
51 | private slots: |
52 | private slots: |
52 | // void slot_newDataReceived(const QByteArray &dataReceived); |
53 | // void slot_newDataReceived(const QByteArray &dataReceived); |
53 | void slot_TCP_Connected(); |
54 | void slot_TCP_Connected(); |
54 | void slot_TCP_Disconnect(); |
55 | void slot_TCP_Disconnect(); |
55 | void slot_TCP_ReadLine(); |
56 | void slot_TCP_ReadLine(); |
56 | void slot_TCP_Error(QAbstractSocket::SocketError Error); |
57 | void slot_TCP_Error(QAbstractSocket::SocketError Error); |
57 | void slot_Timer(); |
58 | void slot_Timer(); |
58 | 59 | ||
59 | signals: |
60 | signals: |
60 | void sig_NewData(QString); |
61 | void sig_NewData(QString); |
61 | void sig_Disconnected(int); |
62 | void sig_Disconnected(int); |
62 | void sig_Connected(); |
63 | void sig_Connected(); |
63 | }; |
64 | }; |
64 | 65 | ||
65 | #endif // INPUT_TCP_H |
66 | #endif // INPUT_TCP_H |
66 | 67 |