Subversion Repositories HomeAutomation

Rev

Rev 1651 | Rev 1959 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | SVN | RSS feed

Rev Author Line No. Line
1651 runge 1
/*
2
 *
3
 *  Copyright (C) 2010  Mattias Runge
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, or
8
 *  (at your option) any later version.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU General Public License along
16
 *  with this program; if not, write to the Free Software Foundation, Inc.,
17
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
 *
19
 */
20
 
21
#ifndef VM_PLUGIN_SOCKET_H
22
#define VM_PLUGIN_SOCKET_H
23
 
24
#include <set>
25
 
26
#include <boost/shared_ptr.hpp>
27
 
28
#include "vm/Plugin.h"
29
#include "logging/Logger.h"
30
#include "net/types.h"
31
#include "common/Byteset.h"
32
 
33
namespace atom {
34
namespace vm {
35
namespace plugin {
36
 
37
class Socket : public Plugin
38
{
39
public:
40
    typedef boost::shared_ptr<Socket> Pointer;
41
 
42
    Socket(boost::asio::io_service& io_service);
43
    virtual ~Socket();
44
 
45
    void InitializeDone();
46
    void CallOutput(unsigned int request_id, std::string output);
47
 
48
private:
49
    static logging::Logger LOG;
50
 
51
    void SlotOnNewState(net::ClientId client_id, net::ServerId server_id, net::ClientState client_state);
52
    void SlotOnNewData(net::ClientId client_id, net::ServerId server_id, common::Byteset data);
53
 
54
    void SlotOnNewStateHandler(net::ClientId client_id, net::ServerId server_id, net::ClientState client_state);
55
    void SlotOnNewDataHandler(net::ClientId client_id, net::ServerId server_id, common::Byteset data);
56
 
57
    static Value Export_Connect(const v8::Arguments& args);
58
    static Value Export_Disconnect(const v8::Arguments& args);
59
    static Value Export_Send(const v8::Arguments& args);
60
};
61
 
62
}; // namespace plugin
63
}; // namespace vm
64
}; // namespace atom
65
 
66
#endif // VM_PLUGIN_SOCKET_H
1940 runge 67