summaryrefslogtreecommitdiffstats
path: root/cooling-type/cooling_type.cpp
blob: 66d9ac9523a1e88211530272e322adc52fffa214 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <unistd.h>
#include <fcntl.h>
#include <sdbusplus/bus.hpp>
#include <phosphor-logging/log.hpp>
#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
OpenPOWER on IntegriCloud