psu-ng: Add method to get PSU conf from D-Bus.
Add a getPSUProperties method that will get the power supply unit
configuration information from the D-Bus properties populated by
entity-manager. The IBM common form factor power supplies will have
these properties under the interface called
xyz.openbmc_project.Configuration.IBMCFFPSConnector. See
I45b724238cffe6fb7f1f8f9947fa1c2c9e9e8015 for changes to add the
necessary updates to entity-manager.
The D-Bus property for I2CAddress is a uint64_t type, while the JSON
configuration file had a string. Move the PowerSupply constructor to the
cpp file, updated to take in uint16_t for the i2caddr.
Update PSUManager::getJSONProperties() to convert Address from string to
uint16_t.
Add in a PSUManager constructor to use the getPSUProperties() function.
Add code to handle interfacesAdded from entity-manager prior to
getPSUProperties() or getSystemProperties().
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
Change-Id: I553e8982cf008828823cea2c0f017ff23c9070ab
diff --git a/phosphor-power-supply/psu_manager.hpp b/phosphor-power-supply/psu_manager.hpp
index 0f93279..b950869 100644
--- a/phosphor-power-supply/psu_manager.hpp
+++ b/phosphor-power-supply/psu_manager.hpp
@@ -37,7 +37,7 @@
PSUManager& operator=(PSUManager&&) = delete;
/**
- * Constructor
+ * Constructor to read configuration from JSON file.
*
* @param[in] bus - D-Bus bus object
* @param[in] e - event object
@@ -47,12 +47,34 @@
const std::string& configfile);
/**
+ * Constructor to read configuration from D-Bus.
+ *
+ * @param[in] bus - D-Bus bus object
+ * @param[in] e - event object
+ */
+ PSUManager(sdbusplus::bus::bus& bus, const sdeventplus::Event& e);
+
+ /**
* @brief Initialize the PowerSupply objects from the JSON config file.
* @param[in] path - Path to the JSON config file
*/
void getJSONProperties(const std::string& path);
/**
+ * Get PSU properties from D-Bus, use that to build a power supply
+ * object.
+ *
+ * @param[in] properties - A map of property names and values
+ *
+ */
+ void getPSUProperties(util::DbusPropertyMap& properties);
+
+ /**
+ * Get PSU configuration from D-Bus
+ */
+ void getPSUConfiguration();
+
+ /**
* @brief Initialize the system properties from the Supported Configuration
* D-Bus object provided by Entity Manager.
*/