diff options
author | Brandon Wyman <bjwyman@gmail.com> | 2017-04-06 15:05:18 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-05-19 16:19:06 +0000 |
commit | 59ae877171ef9a7df66c465c45fa89f2d1d89d38 (patch) | |
tree | bc1bb1f3367fc146247664fc41ba9b9044e85d45 /cooling-type/cooling_type.hpp | |
parent | fef0295a8d87754e491dcf133ea927b5c4d56303 (diff) | |
download | phosphor-fan-presence-59ae877171ef9a7df66c465c45fa89f2d1d89d38.tar.gz phosphor-fan-presence-59ae877171ef9a7df66c465c45fa89f2d1d89d38.zip |
Implement updating the inventory properties
Implement code needed to update the chassis AirCooled and
WaterCooled properties.
Change-Id: I9a67d1129e99f841200241e2daae08fb6119d9d3
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
Diffstat (limited to 'cooling-type/cooling_type.hpp')
-rw-r--r-- | cooling-type/cooling_type.hpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/cooling-type/cooling_type.hpp b/cooling-type/cooling_type.hpp index e0240bd..8775a42 100644 --- a/cooling-type/cooling_type.hpp +++ b/cooling-type/cooling_type.hpp @@ -13,6 +13,17 @@ constexpr auto INVENTORY_INTF = "xyz.openbmc_project.Inventory.Manager"; class CoolingType { + using Property = std::string; + using Value = sdbusplus::message::variant<bool>; + // Association between property and its value + using PropertyMap = std::map<Property, Value>; + using Interface = std::string; + // Association between interface and the dbus property + using InterfaceMap = std::map<Interface, PropertyMap>; + using Object = sdbusplus::message::object_path; + // Association between object and the interface + using ObjectMap = std::map<Object, InterfaceMap>; + public: CoolingType() = delete; ~CoolingType() = default; @@ -26,7 +37,7 @@ class CoolingType * * @param[in] bus - Dbus bus object */ - CoolingType(sdbusplus::bus::bus& bus) + CoolingType(sdbusplus::bus::bus& bus) : bus(bus) { } @@ -47,15 +58,27 @@ class CoolingType /** * @brief Setup the GPIO device for reading cooling type. * - * @param[in] std::string - Path to the GPIO device file to read + * @param[in] - Path to object to update */ void setupGpio(const std::string&); private: + /** @brief Connection for sdbusplus bus */ + sdbusplus::bus::bus& bus; // File descriptor for the GPIO file we are going to read. phosphor::fan::util::FileDescriptor gpioFd = -1; bool airCooled = false; bool waterCooled = false; + + /** + * @brief Construct the inventory object map for CoolingType. + * + * @param[in] - Path to object to update + * + * @return The inventory object map to update inventory + */ + ObjectMap getObjectMap(const std::string&); + }; } |