blob: a808702b21569d95007e2f3591b8c64651f19800 [file] [log] [blame]
Gunnar Millsb0ce9962018-09-07 13:39:10 -05001#include "config.h"
2
3#include "sync_manager.hpp"
4#include "sync_watch.hpp"
5
6#include <systemd/sd-event.h>
7
Adriana Kobylakb072d1b2018-04-24 11:37:21 -05008#include <exception>
9#include <phosphor-logging/log.hpp>
Adriana Kobylak7e8d76b2018-04-20 10:03:01 -050010#include <sdbusplus/bus.hpp>
11#include <sdbusplus/server/manager.hpp>
Adriana Kobylak7e8d76b2018-04-20 10:03:01 -050012
Adriana Kobylak292159f2020-05-05 09:25:55 -050013int main()
Adriana Kobylak7e8d76b2018-04-20 10:03:01 -050014{
15 auto bus = sdbusplus::bus::new_default();
16
Adriana Kobylakb072d1b2018-04-24 11:37:21 -050017 sd_event* loop = nullptr;
18 sd_event_default(&loop);
19
Adriana Kobylak7e8d76b2018-04-20 10:03:01 -050020 sdbusplus::server::manager::manager objManager(bus, SOFTWARE_OBJPATH);
Adriana Kobylakb072d1b2018-04-24 11:37:21 -050021
22 try
23 {
24 phosphor::software::manager::Sync syncManager;
Adriana Kobylakb072d1b2018-04-24 11:37:21 -050025
26 using namespace phosphor::software::manager;
27 phosphor::software::manager::SyncWatch watch(
Adriana Kobylaka9074342018-05-08 11:52:44 -050028 *loop, std::bind(std::mem_fn(&Sync::processEntry), &syncManager,
29 std::placeholders::_1, std::placeholders::_2));
Adriana Kobylakb072d1b2018-04-24 11:37:21 -050030 bus.attach_event(loop, SD_EVENT_PRIORITY_NORMAL);
31 sd_event_loop(loop);
32 }
33 catch (std::exception& e)
34 {
35 using namespace phosphor::logging;
36 log<level::ERR>(e.what());
37 sd_event_unref(loop);
38 return -1;
39 }
40
41 sd_event_unref(loop);
Adriana Kobylak7e8d76b2018-04-20 10:03:01 -050042
43 return 0;
44}