From fef0295a8d87754e491dcf133ea927b5c4d56303 Mon Sep 17 00:00:00 2001 From: Brandon Wyman Date: Fri, 31 Mar 2017 18:13:21 -0500 Subject: Fill in shell functions/files for cooling type. Change-Id: I8d18d3141e955adeffdd8122ebb17549c88edd77 Signed-off-by: Brandon Wyman --- cooling-type/cooling_type.cpp | 59 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 cooling-type/cooling_type.cpp (limited to 'cooling-type/cooling_type.cpp') diff --git a/cooling-type/cooling_type.cpp b/cooling-type/cooling_type.cpp new file mode 100644 index 0000000..66d9ac9 --- /dev/null +++ b/cooling-type/cooling_type.cpp @@ -0,0 +1,59 @@ +#include +#include +#include +#include +#include "cooling_type.hpp" + +namespace phosphor +{ +namespace cooling +{ +namespace type +{ + +void CoolingType::setAirCooled() +{ + airCooled = true; +} + +void CoolingType::setWaterCooled() +{ + waterCooled = true; +} + +void CoolingType::setupGpio(const std::string& gpioPath) +{ + using namespace phosphor::logging; + + gpioFd = open(gpioPath.c_str(), O_RDONLY); + if (gpioFd.is_open()) + { + auto rc = 0;//libevdev_new_from_fd(gpiofd, &gpioDev);//FIXME + if (rc < 0) + { + throw std::runtime_error("Failed to get libevdev from " + + gpioPath + " rc = " + + std::to_string(rc)); + } + + //TODO - more to go here? + } + else + { + throw std::runtime_error("Failed to open GPIO file device"); + } + +} + +void CoolingType::updateInventory(const std::string& objpath) +{ + //TODO + // setProperty(bus, ..., "AirCooled"); + // setProperty(bus, ..., "WaterCooled"); +} + +} +} +} + +// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 -- cgit v1.2.1