summaryrefslogtreecommitdiffstats
path: root/host_state_manager_main.cpp
blob: 4844a029697fe8a075049ce0504fea52f4bb171c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <cstdlib>
#include <iostream>
#include <exception>
#include <sdbusplus/bus.hpp>
#include <experimental/filesystem>
#include "config.h"
#include "host_state_manager.hpp"

int main(int argc, char *argv[])
{
    namespace fs = std::experimental::filesystem;

    auto bus = sdbusplus::bus::new_default();

    // For now, we only have one instance of the host
    auto objPathInst = std::string{HOST_OBJPATH} + '0';

    // Add sdbusplus ObjectManager.
    sdbusplus::server::manager::manager objManager(bus, objPathInst.c_str());

    phosphor::state::manager::Host manager(bus, HOST_BUSNAME,
                                           objPathInst.c_str());

    auto dir = fs::path(HOST_STATE_PERSIST_PATH).parent_path();
    fs::create_directories(dir);

    bus.request_name(HOST_BUSNAME);

    while (true)
    {
        bus.process_discard();
        bus.wait();
    }
    return 0;
}
OpenPOWER on IntegriCloud