1 #include <cstdlib> 2 #include <iostream> 3 #include <exception> 4 #include <sdbusplus/bus.hpp> 5 #include <experimental/filesystem> 6 #include "config.h" 7 #include "host_state_manager.hpp" 8 9 int main() 10 { 11 namespace fs = std::experimental::filesystem; 12 13 auto bus = sdbusplus::bus::new_default(); 14 15 // For now, we only have one instance of the host 16 auto objPathInst = std::string{HOST_OBJPATH} + '0'; 17 18 // Add sdbusplus ObjectManager. 19 sdbusplus::server::manager::manager objManager(bus, objPathInst.c_str()); 20 21 phosphor::state::manager::Host manager(bus, objPathInst.c_str()); 22 23 auto dir = fs::path(HOST_STATE_PERSIST_PATH).parent_path(); 24 fs::create_directories(dir); 25 26 bus.request_name(HOST_BUSNAME); 27 28 while (true) 29 { 30 bus.process_discard(); 31 bus.wait(); 32 } 33 return 0; 34 } 35