Rev 1656 | Rev 1660 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1656 | Rev 1657 | ||
|---|---|---|---|
| Line 40... | Line 40... | ||
| 40 | #include "storage/Manager.h" |
40 | #include "storage/Manager.h" |
| 41 | 41 | ||
| 42 | #include "vm/plugin/System.h" |
42 | #include "vm/plugin/System.h" |
| 43 | #include "vm/plugin/Timer.h" |
43 | #include "vm/plugin/Timer.h" |
| 44 | #include "vm/plugin/Module.h" |
44 | #include "vm/plugin/Module.h" |
| - | 45 | #include "vm/plugin/Node.h" |
|
| 45 | #include "vm/plugin/Console.h" |
46 | #include "vm/plugin/Console.h" |
| 46 | #include "vm/plugin/Storage.h" |
47 | #include "vm/plugin/Storage.h" |
| 47 | - | ||
| 48 | #ifdef USE_PLUGIN_XORG |
- | |
| 49 | #include "vm/plugin/Xorg.h" |
48 | #include "vm/plugin/Xorg.h" |
| 50 | #endif // USE_PLUGIN_XORG |
- | |
| 51 | - | ||
| 52 | #include "vm/plugin/Socket.h" |
49 | #include "vm/plugin/Socket.h" |
| 53 | 50 | ||
| 54 | using namespace atom; |
51 | using namespace atom; |
| 55 | 52 | ||
| 56 | logging::Logger LOG("Main"); |
53 | logging::Logger LOG("Main"); |
| Line 61... | Line 58... | ||
| 61 | void Handler(int status); |
58 | void Handler(int status); |
| 62 | void CleanUp(); |
59 | void CleanUp(); |
| 63 | 60 | ||
| 64 | int main(int argc, char **argv) |
61 | int main(int argc, char **argv) |
| 65 | { |
62 | { |
| 66 | LOG.Info(" |
63 | LOG.Info("\033[29;1mAtom Daemon, version " + std::string(VERSION) + " starting...\033[0m"); |
| - | 64 | LOG.Info("\033[29;1mReleased under GPL version 2.\033[0m"); |
|
| 67 | LOG.Info("Written by Mattias Runge 2010."); |
65 | LOG.Info("Written by Mattias Runge 2010."); |
| 68 | LOG.Info("Released under GPL version 2."); |
- | |
| 69 | 66 | ||
| 70 | signal(SIGTERM, Handler); |
67 | signal(SIGTERM, Handler); |
| 71 | signal(SIGINT, Handler); |
68 | signal(SIGINT, Handler); |
| 72 | signal(SIGQUIT, Handler); |
69 | signal(SIGQUIT, Handler); |
| 73 | signal(SIGABRT, Handler); |
70 | signal(SIGABRT, Handler); |
| Line 110... | Line 107... | ||
| 110 | broker::Manager::Create(); |
107 | broker::Manager::Create(); |
| 111 | net::Manager::Create(); |
108 | net::Manager::Create(); |
| 112 | can::Protocol::Create(); |
109 | can::Protocol::Create(); |
| 113 | control::Manager::Create(); |
110 | control::Manager::Create(); |
| 114 | vm::Manager::Create(); |
111 | vm::Manager::Create(); |
| 115 | 112 | ||
| 116 | storage::Manager::Instance()->SetRootPath(config::Manager::Instance()->GetAsString("StoragePath")); |
113 | storage::Manager::Instance()->SetRootPath(config::Manager::Instance()->GetAsString("StoragePath")); |
| 117 | 114 | ||
| 118 | can::Protocol::Instance()->Load(config::Manager::Instance()->GetAsString("ProtocolFile")); |
115 | can::Protocol::Instance()->Load(config::Manager::Instance()->GetAsString("ProtocolFile")); |
| 119 | 116 | ||
| 120 | if (config::Manager::Instance()->Exist("MonitorPort")) |
117 | if (config::Manager::Instance()->Exist("MonitorPort")) |
| 121 | { |
118 | { |
| 122 | subscribers.push_back(can::Monitor::Pointer(new can::Monitor(config::Manager::Instance()->GetAsInt("MonitorPort")))); |
119 | subscribers.push_back(can::Monitor::Pointer(new can::Monitor(config::Manager::Instance()->GetAsInt("MonitorPort")))); |
| 123 | } |
120 | } |
| 124 | 121 | ||
| 125 | subscribers.push_back(control::Manager::Instance()); |
122 | subscribers.push_back(control::Manager::Instance()); |
| 126 | 123 | ||
| 127 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::System(vm::Manager::Instance()->GetIoService()))); |
124 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::System(vm::Manager::Instance()->GetIoService()))); |
| 128 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::Console(vm::Manager::Instance()->GetIoService(), config::Manager::Instance()->GetAsInt("CommandPort")))); |
125 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::Console(vm::Manager::Instance()->GetIoService(), config::Manager::Instance()->GetAsInt("CommandPort")))); |
| 129 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::Storage(vm::Manager::Instance()->GetIoService()))); |
126 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::Storage(vm::Manager::Instance()->GetIoService()))); |
| 130 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::Timer(vm::Manager::Instance()->GetIoService()))); |
127 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::Timer(vm::Manager::Instance()->GetIoService()))); |
| 131 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::Module(vm::Manager::Instance()->GetIoService()))); |
128 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::Module(vm::Manager::Instance()->GetIoService()))); |
| - | 129 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::Node(vm::Manager::Instance()->GetIoService()))); |
|
| - | 130 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::Socket(vm::Manager::Instance()->GetIoService()))); |
|
| 132 | 131 | ||
| 133 | #ifdef USE_PLUGIN_XORG |
132 | #ifdef USE_PLUGIN_XORG |
| 134 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::Xorg(vm::Manager::Instance()->GetIoService()))); |
133 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::Xorg(vm::Manager::Instance()->GetIoService()))); |
| 135 | #endif // USE_PLUGIN_XORG |
134 | #endif // USE_PLUGIN_XORG |
| 136 | - | ||
| 137 | vm::Manager::Instance()->AddPlugin(vm::Plugin::Pointer(new vm::plugin::Socket(vm::Manager::Instance()->GetIoService()))); |
- | |
| 138 | - | ||
| 139 | 135 | ||
| 140 | vm::Manager::Instance()->Start(config::Manager::Instance()->GetAsString("ScriptPath"), config::Manager::Instance()->GetAsString("UserScriptPath")); |
136 | vm::Manager::Instance()->Start(config::Manager::Instance()->GetAsString("ScriptPath"), config::Manager::Instance()->GetAsString("UserScriptPath")); |
| 141 | 137 | ||
| 142 | if (config::Manager::Instance()->Exist("CanNet")) |
138 | if (config::Manager::Instance()->Exist("CanNet")) |
| 143 | { |
139 | { |