12f9c0cc2SLei YU #include "config.h" 2ab4cc6a5SGunnar Mills 396232827SLei YU #include "bmc_epoch.hpp" 4415b964fSLei YU #include "manager.hpp" 52f9c0cc2SLei YU 6ab4cc6a5SGunnar Mills #include <sdbusplus/bus.hpp> 7ab4cc6a5SGunnar Mills main()82f9c0cc2SLei YUint main() 92f9c0cc2SLei YU { 102f9c0cc2SLei YU auto bus = sdbusplus::bus::new_default(); 117b218796SLei YU sd_event* event = nullptr; 127b218796SLei YU 13261525d1SGeorge Liu auto eventDeleter = [](sd_event* e) { sd_event_unref(e); }; 147b218796SLei YU using SdEvent = std::unique_ptr<sd_event, decltype(eventDeleter)>; 157b218796SLei YU 167f25c53fSGunnar Mills // acquire a reference to the default event loop 177b218796SLei YU sd_event_default(&event); 187b218796SLei YU SdEvent sdEvent{event, eventDeleter}; 197b218796SLei YU event = nullptr; 207b218796SLei YU 217b218796SLei YU // attach bus to this event loop 227b218796SLei YU bus.attach_event(sdEvent.get(), SD_EVENT_PRIORITY_NORMAL); 23415b964fSLei YU 24415b964fSLei YU // Add sdbusplus ObjectManager 25*f90892d4SAmithash Prasasd sdbusplus::server::manager_t bmcEpochObjManager(bus, objmgrpath); 26415b964fSLei YU 270a70452aSGeorge Liu phosphor::time::Manager manager(bus); 28864e173eSPavithra Barithaya phosphor::time::BmcEpoch bmc(bus, objpathBmc, manager); 29415b964fSLei YU 30864e173eSPavithra Barithaya bus.request_name(busname); 312f9c0cc2SLei YU 327b218796SLei YU // Start event loop for all sd-bus events and timer event 337b218796SLei YU sd_event_loop(bus.get_event()); 347b218796SLei YU 357b218796SLei YU bus.detach_event(); 367b218796SLei YU 372f9c0cc2SLei YU return 0; 382f9c0cc2SLei YU } 39