forked from openbmc/phosphor-bmc-code-mgmt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimage_manager_main.cpp
More file actions
41 lines (32 loc) · 985 Bytes
/
Copy pathimage_manager_main.cpp
File metadata and controls
41 lines (32 loc) · 985 Bytes
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
36
37
38
39
40
41
#include "config.h"
#include "image_manager.hpp"
#include "watch.hpp"
#include <phosphor-logging/lg2.hpp>
#include <sdbusplus/bus.hpp>
#include <cstdlib>
#include <exception>
int main()
{
using namespace phosphor::software::manager;
auto bus = sdbusplus::bus::new_default();
sd_event* loop = nullptr;
sd_event_default(&loop);
sdbusplus::server::manager_t objManager(bus, SOFTWARE_OBJPATH);
bus.request_name(VERSION_BUSNAME);
try
{
phosphor::software::manager::Manager imageManager(bus);
phosphor::software::manager::Watch watch(
loop, std::bind(std::mem_fn(&Manager::processImage), &imageManager,
std::placeholders::_1));
bus.attach_event(loop, SD_EVENT_PRIORITY_NORMAL);
sd_event_loop(loop);
}
catch (const std::exception& e)
{
lg2::error("Error in event loop: {ERROR}", "ERROR", e);
return -1;
}
sd_event_unref(loop);
return 0;
}