blob: fbd799472b6d300c590f6626e51786a21c623ada [file] [log] [blame]
Alexander Hansenaa300642025-02-04 15:51:52 +01001#include "example_device.hpp"
2
3#include <sdbusplus/async/context.hpp>
4
5using namespace phosphor::software::example_device;
6
7// NOLINTBEGIN(readability-static-accessed-through-instance)
8sdbusplus::async::task<void> init(ExampleCodeUpdater& updater)
9// NOLINTEND(readability-static-accessed-through-instance)
10{
Alexander Hansen85aed222025-02-18 11:23:47 +010011 /*
12 * In Concrete updaters, the initDevices() function needs to be called,
13 * which in turn invokes the virtual initDevice() function implemented here.
14 * However, in ExampleUpdater, the initDevice() function is called directly
15 * because there is no example configuration from EM to consume, which would
16 * otherwise cause the initDevices() API to throw an error. Therefore,
17 * calling initDevice() directly in this case.
18 */
19
Alexander Hansenaa300642025-02-04 15:51:52 +010020 co_await updater.initDevice("", "", ExampleDevice::defaultConfig);
21
22 co_return;
23}
24
25int main()
26{
27 sdbusplus::async::context ctx;
28
29 ExampleCodeUpdater updater(ctx);
30
Alexander Hansenaa300642025-02-04 15:51:52 +010031 // NOLINTNEXTLINE(clang-analyzer-core.uninitialized.Branch)
32 ctx.spawn(init(updater));
33
34 std::string busName = "xyz.openbmc_project.Software.ExampleDevice";
35 ctx.get_bus().request_name(busName.c_str());
36
37 ctx.run();
38
39 return 0;
40}