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/power-supply/power_supply.cpp b/power-supply/power_supply.cpp
index 9543afb..195e750 100644
--- a/power-supply/power_supply.cpp
+++ b/power-supply/power_supply.cpp
@@ -611,10 +611,11 @@
using namespace sdbusplus::message;
// Build the object map and send it to the inventory
- using Properties = std::map<std::string, std::variant<std::string>>;
+ using Properties = std::map<std::string, std::variant<std::string, bool>>;
using Interfaces = std::map<std::string, Properties>;
using Object = std::map<object_path, Interfaces>;
Properties assetProps;
+ Properties operProps;
Interfaces interfaces;
Object object;
@@ -642,7 +643,9 @@
}
}
+ operProps.emplace(FUNCTIONAL_PROP, present);
interfaces.emplace(ASSET_IFACE, std::move(assetProps));
+ interfaces.emplace(OPERATIONAL_STATE_IFACE, std::move(operProps));
// For Notify(), just send the relative path of the inventory
// object so remove the INVENTORY_OBJ_PATH prefix