Subversion Repositories HomeAutomation

Rev

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

Rev 1740 Rev 1741
Line 72... Line 72...
72
 
72
 
73
void Module::SlotOnModuleChangeHandler(std::string full_id, bool available)
73
void Module::SlotOnModuleChangeHandler(std::string full_id, bool available)
74
{
74
{
75
    v8::Locker lock;
75
    v8::Locker lock;
76
    v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext());
76
    v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext());
-
 
77
    v8::HandleScope handle_scope;
77
   
78
   
78
    //LOG.Debug(std::string(__FUNCTION__) + " called!");
79
    //LOG.Debug(std::string(__FUNCTION__) + " called!");
79
   
80
   
80
    ArgumentListPointer arguments = ArgumentListPointer(new ArgumentList);
81
    ArgumentListPointer arguments = ArgumentListPointer(new ArgumentList);
81
    arguments->push_back(v8::String::New(full_id.data()));
82
    arguments->push_back(v8::String::New(full_id.data()));
Line 86... Line 87...
86
 
87
 
87
void Module::SlotOnModuleMessageHandler(std::string full_id, std::string command, common::StringMap variables)
88
void Module::SlotOnModuleMessageHandler(std::string full_id, std::string command, common::StringMap variables)
88
{
89
{
89
    v8::Locker lock;
90
    v8::Locker lock;
90
    v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext());
91
    v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext());
-
 
92
    v8::HandleScope handle_scope;
91
   
93
   
92
    //LOG.Debug(std::string(__FUNCTION__) + " called!");
94
    //LOG.Debug(std::string(__FUNCTION__) + " called!");
93
   
95
   
94
    ArgumentListPointer arguments = ArgumentListPointer(new ArgumentList);
96
    ArgumentListPointer arguments = ArgumentListPointer(new ArgumentList);
95
   
97
   
Line 110... Line 112...
110
 
112
 
111
Value Module::Export_SendModuleMessage(const v8::Arguments& args)
113
Value Module::Export_SendModuleMessage(const v8::Arguments& args)
112
{
114
{
113
    v8::Locker lock;
115
    v8::Locker lock;
114
    v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext());
116
    v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext());
-
 
117
    v8::HandleScope handle_scope;
115
   
118
   
116
    //LOG.Debug(std::string(__FUNCTION__) + " called!");
119
    //LOG.Debug(std::string(__FUNCTION__) + " called!");
117
   
120
   
118
    if (args.Length() < 3)
121
    if (args.Length() < 3)
119
    {
122
    {
120
        LOG.Error(std::string(__FUNCTION__) + ": To few arguments.");
123
        LOG.Error(std::string(__FUNCTION__) + ": To few arguments.");
121
        return v8::Boolean::New(false);
124
        return handle_scope.Close(v8::Boolean::New(false));
122
    }
125
    }
123
   
126
   
124
    common::StringMap variables;
127
    common::StringMap variables;
125
   
128
   
126
    v8::String::AsciiValue full_id(args[0]);
129
    v8::String::AsciiValue full_id(args[0]);
Line 137... Line 140...
137
        variables[std::string(*name)] = std::string(*value);
140
        variables[std::string(*name)] = std::string(*value);
138
    }
141
    }
139
   
142
   
140
    control::Manager::Instance()->SendMessage(std::string(*full_id), std::string(*command), variables);
143
    control::Manager::Instance()->SendMessage(std::string(*full_id), std::string(*command), variables);
141
   
144
   
142
    return v8::Boolean::New(true);
145
    return handle_scope.Close(v8::Boolean::New(true));
143
}
146
}
144
 
147
 
145
Value Module::Export_GetAvailableModules(const v8::Arguments& args)
148
Value Module::Export_GetAvailableModules(const v8::Arguments& args)
146
{
149
{
147
    v8::Locker lock;
150
    v8::Locker lock;
148
    v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext());
151
    v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext());
-
 
152
    v8::HandleScope handle_scope;
149
   
153
   
150
    //LOG.Debug(std::string(__FUNCTION__) + " called!");
154
    //LOG.Debug(std::string(__FUNCTION__) + " called!");
151
   
155
   
152
    common::StringList available_modules = control::Manager::Instance()->GetAvailableModules();
156
    common::StringList available_modules = control::Manager::Instance()->GetAvailableModules();
153
   
157
   
Line 156... Line 160...
156
    for (unsigned int n = 0; n < available_modules.size(); n++)
160
    for (unsigned int n = 0; n < available_modules.size(); n++)
157
    {
161
    {
158
        result->Set(n, v8::String::New(available_modules[n].data()));
162
        result->Set(n, v8::String::New(available_modules[n].data()));
159
    }
163
    }
160
   
164
   
161
    return result;
165
    return handle_scope.Close(result);
162
}
166
}
163
 
167
 
164
}; // namespace plugin
168
}; // namespace plugin
165
}; // namespace vm
169
}; // namespace vm
166
}; // namespace atom
170
}; // namespace atom