Alexander Hansen | aa30064 | 2025-02-04 15:51:52 +0100 | [diff] [blame] | 1 | #include "example_device.hpp" |
| 2 | |
| 3 | #include <sdbusplus/async/context.hpp> |
| 4 | |
| 5 | using namespace phosphor::software::example_device; |
| 6 | |
Alexander Hansen | aa30064 | 2025-02-04 15:51:52 +0100 | [diff] [blame] | 7 | sdbusplus::async::task<void> init(ExampleCodeUpdater& updater) |
Alexander Hansen | aa30064 | 2025-02-04 15:51:52 +0100 | [diff] [blame] | 8 | { |
Alexander Hansen | 85aed22 | 2025-02-18 11:23:47 +0100 | [diff] [blame] | 9 | /* |
| 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 Hansen | aa30064 | 2025-02-04 15:51:52 +0100 | [diff] [blame] | 18 | co_await updater.initDevice("", "", ExampleDevice::defaultConfig); |
| 19 | |
| 20 | co_return; |
| 21 | } |
| 22 | |
| 23 | int main() |
| 24 | { |
| 25 | sdbusplus::async::context ctx; |
| 26 | |
| 27 | ExampleCodeUpdater updater(ctx); |
| 28 | |
Alexander Hansen | aa30064 | 2025-02-04 15:51:52 +0100 | [diff] [blame] | 29 | // 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 | } |