#pragma once #include #include #include namespace phosphor::power::regulators::control { constexpr auto busName = "xyz.openbmc_project.Power.Regulators"; constexpr auto objPath = "/xyz/openbmc_project/power/regulators/manager"; constexpr auto interface = "xyz.openbmc_project.Power.Regulators.Manager"; /** * @brief Call a dbus method * @param[in] method - Method name to call * @param[in] args - Any needed arguments to the method * * @return Response message from the method call */ template auto callMethod(const std::string& method, Args&&... args) { auto bus = sdbusplus::bus::new_default(); auto reqMsg = bus.new_method_call(busName, objPath, interface, method.c_str()); reqMsg.append(std::forward(args)...); // Set timeout to 6 minutes; some regulator methods take over 5 minutes using namespace std::chrono_literals; sdbusplus::SdBusDuration timeout{6min}; return bus.call(reqMsg, timeout); } } // namespace phosphor::power::regulators::control