Rev 1607 | Rev 1609 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1607 | Rev 1608 | ||
|---|---|---|---|
| Line 31... | Line 31... | ||
| 31 | logging::Logger Module::LOG("vm::plugin::module"); |
31 | logging::Logger Module::LOG("vm::plugin::module"); |
| 32 | 32 | ||
| 33 | Module::Module() |
33 | Module::Module() |
| 34 | { |
34 | { |
| 35 | this->name_ = "module"; |
35 | this->name_ = "module"; |
| 36 | - | ||
| 37 | this->ImportFunction("Module_OnChange"); |
- | |
| 38 | this->ImportFunction("Module_OnMessage"); |
- | |
| 39 | 36 | ||
| 40 | this->ExportFunction("Module_SendMessage", Module::Export_SendModuleMessage); |
37 | this->ExportFunction("Module_SendMessage", Module::Export_SendModuleMessage); |
| 41 | this->ExportFunction("Module_IsModuleAvailable", Module::Export_IsModuleAvailable); |
38 | this->ExportFunction("Module_IsModuleAvailable", Module::Export_IsModuleAvailable); |
| 42 | } |
39 | } |
| 43 | 40 | ||
| 44 | Module::~Module() |
41 | Module::~Module() |
| 45 | { |
42 | { |
| 46 | this->tracker_.reset(); |
43 | this->tracker_.reset(); |
| 47 | } |
44 | } |
| 48 | 45 | ||
| 49 | void Module::InitializeDone() |
46 | void Module::InitializeDone() |
| 50 | { |
47 | { |
| 51 | Plugin::InitializeDone(); |
48 | Plugin::InitializeDone(); |
| - | 49 | ||
| - | 50 | this->ImportFunction("Module_OnChange"); |
|
| - | 51 | this->ImportFunction("Module_OnMessage"); |
|
| 52 | 52 | ||
| 53 | can::Manager::Instance()->ConnectSlots(can::Manager::SignalOnModuleChange::slot_type(&Module::SlotOnModuleChange, this, _1, _2).track(this->tracker_), |
53 | can::Manager::Instance()->ConnectSlots(can::Manager::SignalOnModuleChange::slot_type(&Module::SlotOnModuleChange, this, _1, _2).track(this->tracker_), |
| 54 | can::Manager::SignalOnModuleMessage::slot_type(&Module::SlotOnModuleMessage, this, _1, _2, _3).track(this->tracker_)); |
54 | can::Manager::SignalOnModuleMessage::slot_type(&Module::SlotOnModuleMessage, this, _1, _2, _3).track(this->tracker_)); |
| 55 | } |
55 | } |
| 56 | 56 | ||
| Line 58... | Line 58... | ||
| 58 | { |
58 | { |
| 59 | ArgumentListPointer arguments = ArgumentListPointer(new ArgumentList); |
59 | ArgumentListPointer arguments = ArgumentListPointer(new ArgumentList); |
| 60 | arguments->push_back(v8::String::New(full_id.data())); |
60 | arguments->push_back(v8::String::New(full_id.data())); |
| 61 | arguments->push_back(v8::Boolean::New(available)); |
61 | arguments->push_back(v8::Boolean::New(available)); |
| 62 | 62 | ||
| 63 | this->Call("Module_OnChange", arguments); |
63 | this->Call(0, "Module_OnChange", arguments); |
| 64 | } |
64 | } |
| 65 | 65 | ||
| 66 | void Module::SlotOnModuleMessage(std::string full_id, std::string command, type::StringMap variables) |
66 | void Module::SlotOnModuleMessage(std::string full_id, std::string command, type::StringMap variables) |
| 67 | { |
67 | { |
| 68 | ArgumentListPointer arguments = ArgumentListPointer(new ArgumentList); |
68 | ArgumentListPointer arguments = ArgumentListPointer(new ArgumentList); |
| Line 75... | Line 75... | ||
| 75 | { |
75 | { |
| 76 | arguments->push_back(v8::String::New(it->first.data())); |
76 | arguments->push_back(v8::String::New(it->first.data())); |
| 77 | arguments->push_back(v8::String::New(it->second.data())); |
77 | arguments->push_back(v8::String::New(it->second.data())); |
| 78 | } |
78 | } |
| 79 | 79 | ||
| 80 | this->Call("Module_OnMessage", arguments); |
80 | this->Call(0, "Module_OnMessage", arguments); |
| 81 | } |
81 | } |
| 82 | 82 | ||
| 83 | Value Module::Export_SendModuleMessage(const v8::Arguments& args) |
83 | Value Module::Export_SendModuleMessage(const v8::Arguments& args) |
| 84 | { |
84 | { |
| 85 | LOG.Debug(std::string(__FUNCTION__) + " called!"); |
85 | LOG.Debug(std::string(__FUNCTION__) + " called!"); |