Subversion Repositories HomeAutomation

Rev

Rev 1604 | Rev 1619 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1604 Rev 1608
Line 27... Line 27...
27
#include <boost/shared_ptr.hpp>
27
#include <boost/shared_ptr.hpp>
28
#include <v8-debug.h>
28
#include <v8-debug.h>
29
 
29
 
30
#include "logging/Logger.h"
30
#include "logging/Logger.h"
31
#include "common/IoService.h"
31
#include "common/IoService.h"
-
 
32
 
-
 
33
#include "net/types.h"
32
 
34
 
33
#include "Plugin.h"
35
#include "Plugin.h"
34
#include "types.h"
36
#include "types.h"
35
 
37
 
36
namespace atom {
38
namespace atom {
Line 46... Line 48...
46
    static Pointer Instance();
48
    static Pointer Instance();
47
    static void Create();
49
    static void Create();
48
    static void Delete();
50
    static void Delete();
49
   
51
   
50
    void AddPlugin(Plugin::Pointer plugin);
52
    void AddPlugin(Plugin::Pointer plugin);
51
   
-
 
52
    void Start(std::string script_path);
53
    void Start(std::string script_path);
-
 
54
   
53
    void Call(std::string name, ArgumentListPointer arguments);
55
    void Call(std::string plugin_name, unsigned int request_id, std::string name, ArgumentListPointer arguments);
-
 
56
    void Execute(std::string plugin_name, unsigned int request_id, std::string code);
-
 
57
   
54
    bool LoadScript(std::string scriptname);
58
    bool LoadScript(std::string scriptname);
55
    bool LoadScriptHandler(std::string scriptname);
59
    bool ImportFunction(std::string functionname);
56
   
60
   
57
private:
61
private:
58
    typedef std::vector<Plugin::Pointer> PluginList;
62
    typedef std::vector<Plugin::Pointer> PluginList;
59
   
63
   
60
    static Pointer instance_;
64
    static Pointer instance_;
61
   
65
   
62
    std::string script_path_;
66
    std::string script_path_;
63
   
67
   
64
    v8::Persistent<v8::Context> context_;
68
    v8::Persistent<v8::Context> context_;
Line 69... Line 73...
69
    ImportFunctionList functions_;
73
    ImportFunctionList functions_;
70
   
74
   
71
    Manager();
75
    Manager();
72
   
76
   
73
    void StartHandler();
77
    void StartHandler();
-
 
78
   
74
    void CallHandler(std::string name, ArgumentListPointer arguments);
79
    void CallHandler(std::string plugin_name, unsigned int request_id, std::string name, ArgumentListPointer arguments);
-
 
80
    void ExecuteHandler(std::string plugin_name, unsigned int request_id, std::string code);
-
 
81
   
-
 
82
    void SendResponse(std::string plugin_name, unsigned int request_id, std::string response);
75
   
83
   
76
    std::string FormatException(v8::TryCatch& try_catch);
84
    std::string FormatException(v8::TryCatch& try_catch);
77
   
85
   
78
    logging::Logger LOG;
86
    logging::Logger LOG;
79
};
87
};