Subversion Repositories HomeAutomation

Rev

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

Rev 1614 Rev 1619
Line 21... Line 21...
21
#include "Module.h"
21
#include "Module.h"
22
 
22
 
23
#include <boost/lexical_cast.hpp>
23
#include <boost/lexical_cast.hpp>
24
 
24
 
25
#include "can/Manager.h"
25
#include "can/Manager.h"
-
 
26
#include "vm/Manager.h"
26
 
27
 
27
namespace atom {
28
namespace atom {
28
namespace vm {
29
namespace vm {
29
namespace plugin {
30
namespace plugin {
30
 
31
 
Line 69... Line 70...
69
    this->Call(0, "Module_OnChange", arguments);
70
    this->Call(0, "Module_OnChange", arguments);
70
}
71
}
71
 
72
 
72
void Module::SlotOnModuleMessage(std::string full_id, std::string command, type::StringMap variables)
73
void Module::SlotOnModuleMessage(std::string full_id, std::string command, type::StringMap variables)
73
{
74
{
-
 
75
    v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext());
-
 
76
   
74
    //LOG.Debug(std::string(__FUNCTION__) + " called!");
77
    //LOG.Debug(std::string(__FUNCTION__) + " called!");
75
   
78
   
76
    ArgumentListPointer arguments = ArgumentListPointer(new ArgumentList);
79
    ArgumentListPointer arguments = ArgumentListPointer(new ArgumentList);
77
   
80
   
78
    arguments->push_back(v8::String::New(full_id.data()));
81
    arguments->push_back(v8::String::New(full_id.data()));
79
    arguments->push_back(v8::String::New(command.data()));
82
    arguments->push_back(v8::String::New(command.data()));
-
 
83
   
80
    arguments->push_back(v8::Uint32::New(variables.size()));
84
    v8::Local<v8::Array> vars = v8::Array::New(variables.size());
81
   
85
   
82
    for (type::StringMap::iterator it = variables.begin(); it != variables.end(); it++)
86
    for (type::StringMap::iterator it = variables.begin(); it != variables.end(); it++)
83
    {
87
    {
84
        arguments->push_back(v8::String::New(it->first.data()));
-
 
85
        arguments->push_back(v8::String::New(it->second.data()));
88
        vars->Set(v8::String::New(it->first.data()), v8::String::New(it->second.data()));
86
    }
89
    }
-
 
90
   
-
 
91
    arguments->push_back(vars);
87
   
92
   
88
    this->Call(0, "Module_OnMessage", arguments);
93
    this->Call(0, "Module_OnMessage", arguments);
89
}
94
}
90
 
95
 
91
Value Module::Export_SendModuleMessage(const v8::Arguments& args)
96
Value Module::Export_SendModuleMessage(const v8::Arguments& args)