1 #include "config.h" 2 3 #include "image_manager.hpp" 4 #include "watch.hpp" 5 6 #include <phosphor-logging/log.hpp> 7 #include <sdbusplus/bus.hpp> 8 9 #include <cstdlib> 10 #include <exception> 11 12 int main() 13 { 14 using namespace phosphor::software::manager; 15 auto bus = sdbusplus::bus::new_default(); 16 17 sd_event* loop = nullptr; 18 sd_event_default(&loop); 19 20 sdbusplus::server::manager::manager objManager(bus, 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( 27 loop, std::bind(std::mem_fn(&Manager::processImage), &imageManager, 28 std::placeholders::_1)); 29 bus.attach_event(loop, SD_EVENT_PRIORITY_NORMAL); 30 sd_event_loop(loop); 31 } 32 catch (std::exception& e) 33 { 34 using namespace phosphor::logging; 35 log<level::ERR>(e.what()); 36 return -1; 37 } 38 39 sd_event_unref(loop); 40 41 return 0; 42 } 43