blob: b801ba734bcba31dfa76b85503b47dae3e72ceaa [file] [log] [blame]
Adriana Kobylakb072d1b2018-04-24 11:37:21 -05001#include <exception>
2#include <phosphor-logging/log.hpp>
Adriana Kobylak7e8d76b2018-04-20 10:03:01 -05003#include <sdbusplus/bus.hpp>
4#include <sdbusplus/server/manager.hpp>
Adriana Kobylakb072d1b2018-04-24 11:37:21 -05005#include <systemd/sd-event.h>
Adriana Kobylak7e8d76b2018-04-20 10:03:01 -05006#include "config.h"
7#include "sync_manager.hpp"
Adriana Kobylakb072d1b2018-04-24 11:37:21 -05008#include "sync_watch.hpp"
Adriana Kobylak7e8d76b2018-04-20 10:03:01 -05009
10int main(int argc, char* argv[])
11{
12 auto bus = sdbusplus::bus::new_default();
13
Adriana Kobylakb072d1b2018-04-24 11:37:21 -050014 sd_event* loop = nullptr;
15 sd_event_default(&loop);
16
Adriana Kobylak7e8d76b2018-04-20 10:03:01 -050017 sdbusplus::server::manager::manager objManager(bus, SOFTWARE_OBJPATH);
Adriana Kobylakb072d1b2018-04-24 11:37:21 -050018
19 try
20 {
21 phosphor::software::manager::Sync syncManager;
Adriana Kobylakb072d1b2018-04-24 11:37:21 -050022
23 using namespace phosphor::software::manager;
24 phosphor::software::manager::SyncWatch watch(
Adriana Kobylaka9074342018-05-08 11:52:44 -050025 *loop, std::bind(std::mem_fn(&Sync::processEntry), &syncManager,
26 std::placeholders::_1, std::placeholders::_2));
Adriana Kobylakb072d1b2018-04-24 11:37:21 -050027 bus.attach_event(loop, SD_EVENT_PRIORITY_NORMAL);
28 sd_event_loop(loop);
29 }
30 catch (std::exception& e)
31 {
32 using namespace phosphor::logging;
33 log<level::ERR>(e.what());
34 sd_event_unref(loop);
35 return -1;
36 }
37
38 sd_event_unref(loop);
Adriana Kobylak7e8d76b2018-04-20 10:03:01 -050039
40 return 0;
41}