1 #pragma once 2 3 #include <sdbusplus/bus.hpp> 4 #include <xyz/openbmc_project/Logging/Entry/server.hpp> 5 6 namespace phosphor 7 { 8 namespace state 9 { 10 namespace manager 11 { 12 namespace utils 13 { 14 15 /** @brief Get service name from object path and interface 16 * 17 * @param[in] bus - The Dbus bus object 18 * @param[in] path - The Dbus object path 19 * @param[in] interface - The Dbus interface 20 * 21 * @return The name of the service 22 */ 23 std::string getService(sdbusplus::bus::bus& bus, std::string path, 24 std::string interface); 25 26 /** @brief Get the value of input property 27 * 28 * @param[in] bus - The Dbus bus object 29 * @param[in] path - The Dbus object path 30 * @param[in] interface - The Dbus interface 31 * @param[in] property - The property name to get 32 * 33 * @return The value of the property 34 */ 35 std::string getProperty(sdbusplus::bus::bus& bus, const std::string& path, 36 const std::string& interface, 37 const std::string& propertyName); 38 39 /** @brief Set the value of property 40 * 41 * @param[in] bus - The Dbus bus object 42 * @param[in] path - The Dbus object path 43 * @param[in] interface - The Dbus interface 44 * @param[in] property - The property name to set 45 * @param[in] value - The value of property 46 */ 47 void setProperty(sdbusplus::bus::bus& bus, const std::string& path, 48 const std::string& interface, const std::string& property, 49 const std::string& value); 50 51 /** @brief Return the value of the input GPIO 52 * 53 * @param[in] gpioName - The name of the GPIO to read 54 * 55 * * @return The value of the gpio (0 or 1) or -1 on error 56 */ 57 int getGpioValue(const std::string& gpioName); 58 59 /** @brief Create an error log 60 * 61 * @param[in] bus - The Dbus bus object 62 * @param[in] errorMsg - The error message 63 * @param[in] errLevel - The error level 64 */ 65 void createError( 66 sdbusplus::bus::bus& bus, const std::string& errorMsg, 67 sdbusplus::xyz::openbmc_project::Logging::server::Entry::Level errLevel); 68 69 } // namespace utils 70 } // namespace manager 71 } // namespace state 72 } // namespace phosphor 73