summaryrefslogtreecommitdiffstats
path: root/cooling-type/cooling_type.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cooling-type/cooling_type.cpp')
-rw-r--r--cooling-type/cooling_type.cpp39
1 files changed, 36 insertions, 3 deletions
diff --git a/cooling-type/cooling_type.cpp b/cooling-type/cooling_type.cpp
index 66d9ac9..b80d72d 100644
--- a/cooling-type/cooling_type.cpp
+++ b/cooling-type/cooling_type.cpp
@@ -2,6 +2,7 @@
#include <fcntl.h>
#include <sdbusplus/bus.hpp>
#include <phosphor-logging/log.hpp>
+#include <utility.hpp>
#include "cooling_type.hpp"
namespace phosphor
@@ -45,11 +46,43 @@ void CoolingType::setupGpio(const std::string& gpioPath)
}
+CoolingType::ObjectMap CoolingType::getObjectMap(const std::string& objpath)
+{
+ ObjectMap invObj;
+ InterfaceMap invIntf;
+ PropertyMap invProp;
+
+ invProp.emplace("AirCooled", airCooled);
+ invProp.emplace("WaterCooled", waterCooled);
+ invIntf.emplace("xyz.openbmc_project.Inventory.Decorator.CoolingType",
+ std::move(invProp));
+ invObj.emplace(objpath, std::move(invIntf));
+
+ return invObj;
+}
+
void CoolingType::updateInventory(const std::string& objpath)
{
- //TODO
- // setProperty(bus, ..., "AirCooled");
- // setProperty(bus, ..., "WaterCooled");
+ using namespace phosphor::logging;
+
+ ObjectMap invObj = getObjectMap(objpath);
+
+ std::string invService;
+
+ invService = phosphor::fan::util::getInvService(bus);
+
+ // Update inventory
+ auto invMsg = bus.new_method_call(invService.c_str(),
+ INVENTORY_PATH,
+ INVENTORY_INTF,
+ "Notify");
+ invMsg.append(std::move(invObj));
+ auto invMgrResponseMsg = bus.call(invMsg);
+ if (invMgrResponseMsg.is_method_error())
+ {
+ throw std::runtime_error(
+ "Error in inventory manager call to update inventory");
+ }
}
}
OpenPOWER on IntegriCloud