#pragma once #include #include #include #include PHOSPHOR_LOG2_USING; template sdbusplus::async::task> dbusGetRequiredProperty( sdbusplus::async::context& ctx, const std::string& service, const std::string& path, const std::string& intf, const std::string& property) { auto client = sdbusplus::async::proxy().service(service).path(path).interface( "org.freedesktop.DBus.Properties"); std::optional opt = std::nullopt; try { std::variant result = co_await client.call>(ctx, "Get", intf, property); opt = std::get(result); } catch (std::exception& e) { error("Missing property {PROPERTY} on path {PATH}, interface {INTF}", "PROPERTY", property, "PATH", path, "INTF", intf); } co_return opt; }