Gunnar Mills | 01a323b | 2017-01-18 09:48:13 -0600 | [diff] [blame] | 1 | #include <cstdlib> |
| 2 | #include <exception> |
| 3 | #include <sdbusplus/bus.hpp> |
Deepak Kodihalli | 059e233 | 2017-04-12 06:40:53 -0500 | [diff] [blame] | 4 | #include <phosphor-logging/log.hpp> |
Gunnar Mills | 01a323b | 2017-01-18 09:48:13 -0600 | [diff] [blame] | 5 | #include "config.h" |
Gunnar Mills | 9b7c0b6 | 2017-04-24 12:59:58 -0500 | [diff] [blame] | 6 | #include "bmc_version.hpp" |
Deepak Kodihalli | 059e233 | 2017-04-12 06:40:53 -0500 | [diff] [blame] | 7 | #include "watch.hpp" |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 8 | #include "image_manager.hpp" |
Gunnar Mills | 01a323b | 2017-01-18 09:48:13 -0600 | [diff] [blame] | 9 | |
| 10 | int main(int argc, char* argv[]) |
| 11 | { |
| 12 | auto bus = sdbusplus::bus::new_default(); |
| 13 | |
Deepak Kodihalli | 059e233 | 2017-04-12 06:40:53 -0500 | [diff] [blame] | 14 | sd_event* loop = nullptr; |
| 15 | sd_event_default(&loop); |
| 16 | |
Gunnar Mills | 01a323b | 2017-01-18 09:48:13 -0600 | [diff] [blame] | 17 | sdbusplus::server::manager::manager objManager(bus, |
| 18 | SOFTWARE_OBJPATH); |
Gunnar Mills | 9b7c0b6 | 2017-04-24 12:59:58 -0500 | [diff] [blame] | 19 | phosphor::software::manager::BMCVersion manager(bus, |
Gunnar Mills | 01a323b | 2017-01-18 09:48:13 -0600 | [diff] [blame] | 20 | SOFTWARE_OBJPATH); |
Gunnar Mills | 01a323b | 2017-01-18 09:48:13 -0600 | [diff] [blame] | 21 | bus.request_name(VERSION_BUSNAME); |
| 22 | |
Deepak Kodihalli | 059e233 | 2017-04-12 06:40:53 -0500 | [diff] [blame] | 23 | try |
Gunnar Mills | 01a323b | 2017-01-18 09:48:13 -0600 | [diff] [blame] | 24 | { |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 25 | phosphor::software::manager::Manager imageManager(bus); |
| 26 | phosphor::software::manager::Watch watch(loop, |
| 27 | std::bind( |
| 28 | std::mem_fn( |
| 29 | &phosphor::software::manager::Manager::processImage), |
| 30 | &imageManager, std::placeholders::_1)); |
Deepak Kodihalli | 059e233 | 2017-04-12 06:40:53 -0500 | [diff] [blame] | 31 | bus.attach_event(loop, SD_EVENT_PRIORITY_NORMAL); |
| 32 | sd_event_loop(loop); |
Gunnar Mills | 01a323b | 2017-01-18 09:48:13 -0600 | [diff] [blame] | 33 | } |
Deepak Kodihalli | 059e233 | 2017-04-12 06:40:53 -0500 | [diff] [blame] | 34 | catch (std::exception& e) |
| 35 | { |
| 36 | using namespace phosphor::logging; |
| 37 | log<level::ERR>(e.what()); |
| 38 | return -1; |
| 39 | } |
| 40 | |
| 41 | sd_event_unref(loop); |
| 42 | |
Gunnar Mills | 01a323b | 2017-01-18 09:48:13 -0600 | [diff] [blame] | 43 | return 0; |
| 44 | } |