Carol Wang | dc05939 | 2020-03-13 17:39:17 +0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <sdbusplus/bus.hpp> |
Andrew Geissler | 9d4d0c9 | 2022-01-26 13:18:12 -0600 | [diff] [blame^] | 4 | #include <xyz/openbmc_project/Logging/Entry/server.hpp> |
Carol Wang | dc05939 | 2020-03-13 17:39:17 +0800 | [diff] [blame] | 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 Set the value of 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 set |
| 32 | * @param[in] value - The value of property |
| 33 | */ |
| 34 | void setProperty(sdbusplus::bus::bus& bus, const std::string& path, |
| 35 | const std::string& interface, const std::string& property, |
| 36 | const std::string& value); |
| 37 | |
Andrew Geissler | f8ae6a0 | 2022-01-21 17:00:20 -0600 | [diff] [blame] | 38 | /** @brief Return the value of the input GPIO |
| 39 | * |
| 40 | * @param[in] gpioName - The name of the GPIO to read |
| 41 | * |
| 42 | * * @return The value of the gpio (0 or 1) or -1 on error |
| 43 | */ |
| 44 | int getGpioValue(const std::string& gpioName); |
| 45 | |
Andrew Geissler | 9d4d0c9 | 2022-01-26 13:18:12 -0600 | [diff] [blame^] | 46 | /** @brief Create an error log |
| 47 | * |
| 48 | * @param[in] bus - The Dbus bus object |
| 49 | * @param[in] errorMsg - The error message |
| 50 | * @param[in] errLevel - The error level |
| 51 | */ |
| 52 | void createError( |
| 53 | sdbusplus::bus::bus& bus, const std::string& errorMsg, |
| 54 | sdbusplus::xyz::openbmc_project::Logging::server::Entry::Level errLevel); |
| 55 | |
Carol Wang | dc05939 | 2020-03-13 17:39:17 +0800 | [diff] [blame] | 56 | } // namespace utils |
| 57 | } // namespace manager |
| 58 | } // namespace state |
Andrew Geissler | f8ae6a0 | 2022-01-21 17:00:20 -0600 | [diff] [blame] | 59 | } // namespace phosphor |