Add the method to set Functional property based on Group state
When a particular LED Group asserted property is set to true, then the
functional state of that FRU is false and vice-versa. This commit adds
that behavior. Functional status is defined in
xyz.openbmc_project.State.Decorator.OperationalStatus interface.
Tested: When manually set the Asserted property to true by the D-Bus,
we can see that the Functional is updated to false.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I6fa7a4c41363263d345b6b5335056fad15efb78c
diff --git a/utils.hpp b/utils.hpp
index edb0315..68a616a 100644
--- a/utils.hpp
+++ b/utils.hpp
@@ -15,8 +15,10 @@
constexpr auto DBUS_PROPERTY_IFACE = "org.freedesktop.DBus.Properties";
// The value of the property(type: variant, contains some basic types)
-// Eg: uint8_t : dutyOn, uint16_t : Period, std::string : Name
-using PropertyValue = std::variant<uint8_t, uint16_t, std::string>;
+// Eg: uint8_t : dutyOn, uint16_t : Period, std::string : Name,
+// std::vector<std::string> : endpoints, bool : Functional
+using PropertyValue = std::variant<uint8_t, uint16_t, std::string,
+ std::vector<std::string>, bool>;
/**
* @class DBusHandler
@@ -47,6 +49,20 @@
const std::string getService(const std::string& path,
const std::string& interface) const;
+ /** @brief Get property(type: variant)
+ *
+ * @param[in] objectPath - D-Bus object path
+ * @param[in] interface - D-Bus interface
+ * @param[in] propertyName - D-Bus property name
+ *
+ * @return The value of the property(type: variant)
+ *
+ * @throw sdbusplus::exception::SdBusError when it fails
+ */
+ const PropertyValue getProperty(const std::string& objectPath,
+ const std::string& interface,
+ const std::string& propertyName) const;
+
/** @brief Set D-Bus property
*
* @param[in] objectPath - D-Bus object path