1 #include "example_device.hpp" 2 3 #include <sdbusplus/async/context.hpp> 4 5 using namespace phosphor::software::example_device; 6 7 sdbusplus::async::task<void> init(ExampleCodeUpdater& updater) 8 { 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 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 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 } 39