Subversion Repositories HomeAutomation

Rev

Rev 1619 | Go to most recent revision | Details | 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
 
21
#ifndef CONSOLE_H
22
#define CONSOLE_H
23
 
24
#include <boost/shared_ptr.hpp>
25
 
26
#include "logging/Logger.h"
27
#include "net/Subscriber.h"
28
#include "net/types.h"
29
#include "type/Byteset.h"
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
 
42
    Console(unsigned int port);
43
    virtual ~Console();
44
 
45
    void ExecutionResult(std::string response, unsigned int request_id);
46
    void InitializeDone();
47
 
48
private:
49
    net::ServerId server_id_;
50
    static type::StringList commands_;
51
 
52
    void SlotOnNewState(net::ClientId client_id, net::ServerId server_id, net::ClientState client_state);
53
    void SlotOnNewData(net::ClientId client_id, net::ServerId server_id, type::Byteset data);
54
 
55
    static logging::Logger LOG;
56
 
57
    static Value Export_RegisterConsoleCommand(const v8::Arguments& args);
58
};
59
 
60
}; // namespace plugin
61
}; // namespace vm
62
}; // namespace atom
63
 
64
#endif // CONSOLE_H