1 #include "example_device.hpp" 2 3 #include <sdbusplus/async/context.hpp> 4 5 using namespace phosphor::software::example_device; 6 7 // NOLINTBEGIN(readability-static-accessed-through-instance) 8 sdbusplus::async::task<void> init(ExampleCodeUpdater& updater) 9 // NOLINTEND(readability-static-accessed-through-instance) 10 { 11 /* 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 20 co_await updater.initDevice("", "", ExampleDevice::defaultConfig); 21 22 co_return; 23 } 24 25 int main() 26 { 27 sdbusplus::async::context ctx; 28 29 ExampleCodeUpdater updater(ctx); 30 31 // 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 } 41