blob: 12d5e9aa0281ce14ce1c410a591de26e02709d6c [file] [log] [blame]
Andrew Geissler36529022016-11-29 15:23:54 -06001#include <cstdlib>
2#include <iostream>
3#include <exception>
4#include <sdbusplus/bus.hpp>
Dhruvaraj Subhashchandran3f475242017-07-12 00:44:27 -05005#include <experimental/filesystem>
Andrew Geissler36529022016-11-29 15:23:54 -06006#include "config.h"
7#include "host_state_manager.hpp"
8
9int main(int argc, char *argv[])
10{
Dhruvaraj Subhashchandran3f475242017-07-12 00:44:27 -050011 namespace fs = std::experimental::filesystem;
12
Andrew Geissler36529022016-11-29 15:23:54 -060013 auto bus = sdbusplus::bus::new_default();
14
Andrew Geissler1cb8b702016-12-13 13:33:06 -060015 // For now, we only have one instance of the host
Andrew Geisslera90a31a2016-12-13 16:16:28 -060016 auto objPathInst = std::string{HOST_OBJPATH} + '0';
Andrew Geissler1cb8b702016-12-13 13:33:06 -060017
Andrew Geissler36529022016-11-29 15:23:54 -060018 // Add sdbusplus ObjectManager.
Andrew Geissler1cb8b702016-12-13 13:33:06 -060019 sdbusplus::server::manager::manager objManager(bus, objPathInst.c_str());
Andrew Geissler36529022016-11-29 15:23:54 -060020
Andrew Geisslera90a31a2016-12-13 16:16:28 -060021 phosphor::state::manager::Host manager(bus,
22 HOST_BUSNAME,
23 objPathInst.c_str());
24
Dhruvaraj Subhashchandran3f475242017-07-12 00:44:27 -050025 auto dir = fs::path(HOST_STATE_PERSIST_PATH).parent_path();
26 fs::create_directories(dir);
27
Andrew Geisslera90a31a2016-12-13 16:16:28 -060028 bus.request_name(HOST_BUSNAME);
Andrew Geissler36529022016-11-29 15:23:54 -060029
30 while(true)
31 {
32 bus.process_discard();
33 bus.wait();
34 }
35 return 0;
36}