Subversion Repositories Projects

Rev

Rev 250 | Rev 313 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 250 Rev 263
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 CCONNECTION_H
19
#ifndef CCONNECTION_H
20
#define CCONNECTION_H
20
#define CCONNECTION_H
21
 
21
 
22
#include <QObject>
22
#include <QObject>
-
 
23
#include <QTcpSocket>
-
 
24
 
23
#include "ToolBox.h"
25
#include "ToolBox.h"
24
#include "../global.h"
26
#include "../global.h"
25
#include "../SerialPort/ManageSerialPort.h"
27
#include "../SerialPort/ManageSerialPort.h"
-
 
28
 
-
 
29
#define C_TTY 1
-
 
30
#define C_IP 2
26
 
31
 
27
class cConnection : public QObject
32
class cConnection : public QObject
28
{
33
{
29
    Q_OBJECT
34
    Q_OBJECT
30
 
35
 
31
    public:
36
    public:
32
        cConnection();
37
        cConnection();
33
        bool isOpen();
38
        bool isOpen();
34
        bool Open(QString Address);
39
        bool Open(int Typ, QString Address);
35
        bool Close();
40
        bool Close();
36
        bool send_Cmd(char CMD, int Address, char Data[150],unsigned int Length, bool Resend = true);
41
        bool send_Cmd(char CMD, int Address, char Data[150],unsigned int Length, bool Resend = true);
37
 
42
 
38
    private:
43
    private:
39
        ManageSerialPort *TTY;
44
        ManageSerialPort *TTY;
-
 
45
        QTcpSocket *TcpSocket;
40
        bool b_isOpen;
46
        bool b_isOpen;
-
 
47
        int  i_Type;
41
        sRxData RxData;
48
        sRxData RxData;
-
 
49
 
-
 
50
        void new_Data(QString Data);
42
 
51
 
43
    private slots:
52
    private slots:
-
 
53
        void slot_newDataReceived(const QByteArray &dataReceived);
-
 
54
        void slot_IP_Connected();
-
 
55
        void slot_IP_Disconnect();
-
 
56
        void slot_IP_ReadLine();
44
        void slot_newDataReceived(const QByteArray &dataReceived);
57
//        void slot_Error(QAbstractSocket::SocketError Error);
45
 
58
 
46
    signals:
59
    signals:
47
        void newData(sRxData RxData);
60
        void newData(sRxData RxData);
48
        void showTerminal(int Typ, QString Text);
61
        void showTerminal(int Typ, QString Text);
49
};
62
};
50
 
63
 
51
#endif // CCONNECTION_H
64
#endif // CCONNECTION_H
52
 
65