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