Subversion Repositories HomeAutomation

Rev

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

Rev Author Line No. Line
1608 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
 
1619 runge 21
#ifndef VM_PLUGIN_CONSOLE_H
22
#define VM_PLUGIN_CONSOLE_H
1608 runge 23
 
24
#include <boost/shared_ptr.hpp>
25
 
26
#include "logging/Logger.h"
27
#include "net/Subscriber.h"
28
#include "net/types.h"
1642 runge 29
#include "common/Byteset.h"
1608 runge 30
 
31
#include "vm/Plugin.h"
32
 
33
namespace atom {
34
namespace vm {
35
namespace plugin {
36
 
37
class Console : public Plugin
38
{
39
public:
40
    typedef boost::shared_ptr<Console> Pointer;
41
 
1625 runge 42
    Console(boost::asio::io_service& io_service, unsigned int port);
1608 runge 43
    virtual ~Console();
44
 
45
    void InitializeDone();
1647 runge 46
    void CallOutput(unsigned int request_id, std::string output);
1608 runge 47
 
48
private:
49
    net::ServerId server_id_;
1647 runge 50
    static net::ClientId current_client_id_;
1608 runge 51
 
52
    void SlotOnNewState(net::ClientId client_id, net::ServerId server_id, net::ClientState client_state);
1642 runge 53
    void SlotOnNewData(net::ClientId client_id, net::ServerId server_id, common::Byteset data);
1608 runge 54
 
1625 runge 55
    void SlotOnNewStateHandler(net::ClientId client_id, net::ServerId server_id, net::ClientState client_state);
1642 runge 56
    void SlotOnNewDataHandler(net::ClientId client_id, net::ServerId server_id, common::Byteset data);
1625 runge 57
 
1608 runge 58
    static logging::Logger LOG;
59
 
1647 runge 60
    static Value Export_PromptRequest(const v8::Arguments& args);
61
    static Value Export_AutoCompleteResponse(const v8::Arguments& args);
1657 runge 62
    static Value Export_LogToClient(const v8::Arguments& args);
1664 runge 63
    static Value Export_DisconnectClient(const v8::Arguments& args);
1608 runge 64
};
65
 
66
}; // namespace plugin
67
}; // namespace vm
68
}; // namespace atom
69
 
1619 runge 70
#endif // VM_PLUGIN_CONSOLE_H