1 #pragma once 2 3 #include <sdbusplus/bus.hpp> 4 5 namespace phosphor::power::regulators::control 6 { 7 8 constexpr auto busName = "xyz.openbmc_project.Power.Regulators"; 9 constexpr auto objPath = "/xyz/openbmc_project/power/regulators/manager"; 10 constexpr auto interface = "xyz.openbmc_project.Power.Regulators.Manager"; 11 12 /** 13 * @brief Call a dbus method 14 * @param[in] method - Method name to call 15 * @param[in] args - Any needed arguments to the method 16 * 17 * @return Response message from the method call 18 */ 19 template <typename... Args> 20 auto callMethod(const std::string& method, Args&&... args) 21 { 22 auto bus = sdbusplus::bus::new_default(); 23 auto reqMsg = 24 bus.new_method_call(busName, objPath, interface, method.c_str()); 25 reqMsg.append(std::forward<Args>(args)...); 26 27 return bus.call(reqMsg); 28 } 29 30 } // namespace phosphor::power::regulators::control 31