1 #include <cstdlib> 2 #include <exception> 3 #include <sdbusplus/bus.hpp> 4 #include <phosphor-logging/log.hpp> 5 #include "config.h" 6 #include "bmc_version.hpp" 7 #include "watch.hpp" 8 #include "image_manager.hpp" 9 10 int main(int argc, char* argv[]) 11 { 12 auto bus = sdbusplus::bus::new_default(); 13 14 sd_event* loop = nullptr; 15 sd_event_default(&loop); 16 17 sdbusplus::server::manager::manager objManager(bus, 18 SOFTWARE_OBJPATH); 19 phosphor::software::manager::BMCVersion manager(bus, 20 SOFTWARE_OBJPATH); 21 bus.request_name(VERSION_BUSNAME); 22 23 try 24 { 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)); 31 bus.attach_event(loop, SD_EVENT_PRIORITY_NORMAL); 32 sd_event_loop(loop); 33 } 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 43 return 0; 44 } 45