blob: d0cac65808f15f20f5dbd8bd14ba5212a245e559 [file] [log] [blame]
Gunnar Mills01a323b2017-01-18 09:48:13 -06001#include <cstdlib>
2#include <exception>
3#include <sdbusplus/bus.hpp>
Deepak Kodihalli059e2332017-04-12 06:40:53 -05004#include <phosphor-logging/log.hpp>
Gunnar Mills01a323b2017-01-18 09:48:13 -06005#include "config.h"
Gunnar Mills9b7c0b62017-04-24 12:59:58 -05006#include "bmc_version.hpp"
Deepak Kodihalli059e2332017-04-12 06:40:53 -05007#include "watch.hpp"
Gunnar Mills3027bba2017-04-27 15:49:03 -05008#include "image_manager.hpp"
Gunnar Mills01a323b2017-01-18 09:48:13 -06009
10int main(int argc, char* argv[])
11{
12 auto bus = sdbusplus::bus::new_default();
13
Deepak Kodihalli059e2332017-04-12 06:40:53 -050014 sd_event* loop = nullptr;
15 sd_event_default(&loop);
16
Gunnar Mills01a323b2017-01-18 09:48:13 -060017 sdbusplus::server::manager::manager objManager(bus,
18 SOFTWARE_OBJPATH);
Gunnar Mills9b7c0b62017-04-24 12:59:58 -050019 phosphor::software::manager::BMCVersion manager(bus,
Gunnar Mills01a323b2017-01-18 09:48:13 -060020 SOFTWARE_OBJPATH);
Gunnar Mills01a323b2017-01-18 09:48:13 -060021 bus.request_name(VERSION_BUSNAME);
22
Deepak Kodihalli059e2332017-04-12 06:40:53 -050023 try
Gunnar Mills01a323b2017-01-18 09:48:13 -060024 {
Gunnar Mills3027bba2017-04-27 15:49:03 -050025 phosphor::software::manager::Manager imageManager(bus);
26 phosphor::software::manager::Watch watch(loop,
27 std::bind(
28 std::mem_fn(
29 &phosphor::software::manager::Manager::processImage),
30 &imageManager, std::placeholders::_1));
Deepak Kodihalli059e2332017-04-12 06:40:53 -050031 bus.attach_event(loop, SD_EVENT_PRIORITY_NORMAL);
32 sd_event_loop(loop);
Gunnar Mills01a323b2017-01-18 09:48:13 -060033 }
Deepak Kodihalli059e2332017-04-12 06:40:53 -050034 catch (std::exception& e)
35 {
36 using namespace phosphor::logging;
37 log<level::ERR>(e.what());
38 return -1;
39 }
40
41 sd_event_unref(loop);
42
Gunnar Mills01a323b2017-01-18 09:48:13 -060043 return 0;
44}