Rev 1604 | Rev 1609 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1604 | Rev 1608 | ||
|---|---|---|---|
| Line 37... | Line 37... | ||
| 37 | #include "vm/Manager.h" |
37 | #include "vm/Manager.h" |
| 38 | 38 | ||
| 39 | #include "vm/plugin/System.h" |
39 | #include "vm/plugin/System.h" |
| 40 | #include "vm/plugin/Timer.h" |
40 | #include "vm/plugin/Timer.h" |
| 41 | #include "vm/plugin/Module.h" |
41 | #include "vm/plugin/Module.h" |
| - | 42 | #include "vm/plugin/Console.h" |
|
| 42 | 43 | ||
| 43 | using namespace atom; |
44 | using namespace atom; |
| 44 | 45 | ||
| 45 | logging::Logger LOG("Main"); |
46 | logging::Logger LOG("Main"); |
| 46 | std::vector<broker::Subscriber::Pointer> subscribers; |
47 | std::vector<broker::Subscriber::Pointer> subscribers; |
| Line 50... | Line 51... | ||
| 50 | void Handler(int status); |
51 | void Handler(int status); |
| 51 | void CleanUp(); |
52 | void CleanUp(); |
| 52 | 53 | ||
| 53 | int main(int argc, char **argv) |
54 | int main(int argc, char **argv) |
| 54 | { |
55 | { |
| 55 | LOG.Info("Atom version 1.5.0 starting..."); |
56 | LOG.Info("Atom Daemon, version 1.5.0 starting..."); |
| 56 | LOG.Info("Written by Mattias Runge 2010."); |
57 | LOG.Info("Written by Mattias Runge 2010."); |
| 57 | LOG.Info("Released under GPL version 2."); |
58 | LOG.Info("Released under GPL version 2."); |
| 58 | 59 | ||
| 59 | signal(SIGTERM, Handler); |
60 | signal(SIGTERM, Handler); |
| 60 | signal(SIGINT, Handler); |
61 | signal(SIGINT, Handler); |
| Line 115... | Line 116... | ||
| 115 | 116 | ||
| 116 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::System())); |
117 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::System())); |
| 117 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::Timer())); |
118 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::Timer())); |
| 118 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::Module())); |
119 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::Module())); |
| 119 | 120 | ||
| - | 121 | if (config::Manager::Instance()->Exist("CommandPort")) |
|
| - | 122 | { |
|
| - | 123 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::Console(config::Manager::Instance()->GetAsInt("CommandPort")))); |
|
| - | 124 | } |
|
| - | 125 | ||
| 120 | if (config::Manager::Instance()->Exist("ScriptPath")) |
126 | if (config::Manager::Instance()->Exist("ScriptPath")) |
| 121 | { |
127 | { |
| 122 | vm::Manager::Instance()->Start(config::Manager::Instance()->GetAsString("ScriptPath")); |
128 | vm::Manager::Instance()->Start(config::Manager::Instance()->GetAsString("ScriptPath")); |
| 123 | } |
129 | } |
| 124 | 130 | ||
| 125 | if (config::Manager::Instance()->Exist("CanNet")) |
131 | if (config::Manager::Instance()->Exist("CanNet")) |
| 126 | { |
132 | { |
| 127 | type::StringList cannetworks = config::Manager::Instance()->GetAsStringVector("CanNet"); |
133 | type::StringList cannetworks = config::Manager::Instance()->GetAsStringVector("CanNet"); |
| 128 | 134 | ||
| 129 | for (int n = 0; n < cannetworks.size(); n++) |
135 | for (int n = 0; n < cannetworks.size(); n++) |
| 130 | { |
136 | { |
| 131 | subscribers.push_back(can::Network::Pointer(new can::Network(cannetworks[n]))); |
137 | subscribers.push_back(can::Network::Pointer(new can::Network(cannetworks[n]))); |
| 132 | } |
138 | } |
| 133 | } |
139 | } |
| 134 | - | ||
| 135 | LOG.Info("Initialization complete."); |
- | |
| 136 | 140 | ||
| 137 | boost::mutex::scoped_lock guard(guard_mutex); |
141 | boost::mutex::scoped_lock guard(guard_mutex); |
| 138 | on_message_condition.wait(guard); |
142 | on_message_condition.wait(guard); |
| 139 | 143 | ||
| 140 | LOG.Info("Cleaning up..."); |
144 | LOG.Info("Cleaning up..."); |