blob: 6a1d3bb7993eaf186d641cc8a0b029e4ef0a3985 [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
Alexander Hansenaa300642025-02-04 15:51:52 +01007sdbusplus::async::task<void> init(ExampleCodeUpdater& updater)
Alexander Hansenaa300642025-02-04 15:51:52 +01008{
Alexander Hansen85aed222025-02-18 11:23:47 +01009 /*
10 * In Concrete updaters, the initDevices() function needs to be called,
11 * which in turn invokes the virtual initDevice() function implemented here.
12 * However, in ExampleUpdater, the initDevice() function is called directly
13 * because there is no example configuration from EM to consume, which would
14 * otherwise cause the initDevices() API to throw an error. Therefore,
15 * calling initDevice() directly in this case.
16 */
17
Alexander Hansenaa300642025-02-04 15:51:52 +010018 co_await updater.initDevice("", "", ExampleDevice::defaultConfig);
19
20 co_return;
21}
22
23int main()
24{
25 sdbusplus::async::context ctx;
26
27 ExampleCodeUpdater updater(ctx);
28
Alexander Hansenaa300642025-02-04 15:51:52 +010029 // NOLINTNEXTLINE(clang-analyzer-core.uninitialized.Branch)
30 ctx.spawn(init(updater));
31
32 std::string busName = "xyz.openbmc_project.Software.ExampleDevice";
33 ctx.get_bus().request_name(busName.c_str());
34
35 ctx.run();
36
37 return 0;
38}