Update OperationalStatus interface according to the Present property value
When the Present property value changes, the corresponding OperationalStatus
interface needs to be updated at the same time.
Refer to:
https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/xyz/
openbmc_project/State/Decorator/OperationalStatus.interface.yaml
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I9eee9196125cf82605b20009b49a3ed7f65be53a
diff --git a/phosphor-power-supply/power_supply.cpp b/phosphor-power-supply/power_supply.cpp
index 9735b6d..271009b 100644
--- a/phosphor-power-supply/power_supply.cpp
+++ b/phosphor-power-supply/power_supply.cpp
@@ -197,8 +197,10 @@
std::string header;
std::string sn;
using PropertyMap =
- std::map<std::string, std::variant<std::string, std::vector<uint8_t>>>;
+ std::map<std::string,
+ std::variant<std::string, std::vector<uint8_t>, bool>>;
PropertyMap assetProps;
+ PropertyMap operProps;
PropertyMap versionProps;
PropertyMap ipzvpdDINFProps;
PropertyMap ipzvpdVINIProps;
@@ -302,6 +304,10 @@
interfaces.emplace(DINF_IFACE, std::move(ipzvpdDINFProps));
interfaces.emplace(VINI_IFACE, std::move(ipzvpdVINIProps));
+ // Update the Functional
+ operProps.emplace(FUNCTIONAL_PROP, present);
+ interfaces.emplace(OPERATIONAL_STATE_IFACE, std::move(operProps));
+
auto path = inventoryPath.substr(strlen(INVENTORY_OBJ_PATH));
object.emplace(path, std::move(interfaces));