Subversion Repositories HomeAutomation

Rev

Rev 1024 | Details | Compare with Previous | Last modification | View Log | SVN | RSS feed

Rev Author Line No. Line
984 runge 1
/***************************************************************************
2
 *   Copyright (C) December 30, 2008 by Mattias Runge                             *
3
 *   mattias@runge.se                                                      *
4
 *   socketevent.h                                            *
5
 *                                                                         *
6
 *   This program is free software; you can redistribute it and/or modify  *
7
 *   it under the terms of the GNU General Public License as published by  *
8
 *   the Free Software Foundation; either version 2 of the License, or     *
9
 *   (at your option) any later version.                                   *
10
 *                                                                         *
11
 *   This program is distributed in the hope that it will be useful,       *
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14
 *   GNU General Public License for more details.                          *
15
 *                                                                         *
16
 *   You should have received a copy of the GNU General Public License     *
17
 *   along with this program; if not, write to the                         *
18
 *   Free Software Foundation, Inc.,                                       *
19
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
20
 ***************************************************************************/
21
 
22
#ifndef _SOCKETEVENT_H
23
#define _SOCKETEVENT_H
24
 
25
using namespace std;
26
 
27
#include <string>
28
 
29
class SocketEvent
30
{
31
public:
32
    SocketEvent(unsigned int type, string data)
33
    {
34
        myType = type;
35
        myData = data;
36
    }
37
 
38
    SocketEvent(const SocketEvent& socketEvent)
39
    {
40
        myType = socketEvent.myType;
41
        myData = socketEvent.myData;
42
    }
43
 
44
    unsigned int getType() { return myType; };
45
    string getData() { return myData; };
46
 
47
    static const unsigned int TYPE_NONE                 = 0;
48
    static const unsigned int TYPE_DATA                 = 1;
49
    static const unsigned int TYPE_INACTIVITY           = 2;
50
 
51
    static const unsigned int TYPE_CONNECTING           = 3;
52
    static const unsigned int TYPE_CONNECTED            = 4;
53
    static const unsigned int TYPE_WAITING_RECONNECT    = 5;
54
    static const unsigned int TYPE_CONNECTION_CLOSED    = 6;
55
    static const unsigned int TYPE_CONNECTION_RESET     = 7;
56
    static const unsigned int TYPE_CONNECTION_DIED      = 8;
57
    static const unsigned int TYPE_CONNECTION_FAILED    = 9;
58
 
59
private:
60
    unsigned int myType;
61
    string myData;
62
};
63
 
64
#endif  /* _SOCKETEVENT_H */
65