diff options
author | Matt Spinler <spinler@us.ibm.com> | 2017-04-27 12:35:23 -0500 |
---|---|---|
committer | Matt Spinler <spinler@us.ibm.com> | 2017-05-11 13:52:49 -0500 |
commit | 35b156b79c1314de79e4728ef313f5164ae2ec32 (patch) | |
tree | 6603ba2412a514c138f6c728973fc3f2e55a1764 | |
parent | e567dd24a8d943b4655ed2db74ce3639b05652bc (diff) | |
download | phosphor-fan-presence-35b156b79c1314de79e4728ef313f5164ae2ec32.tar.gz phosphor-fan-presence-35b156b79c1314de79e4728ef313f5164ae2ec32.zip |
Fan monitor data
This commit contains the data that will be used by
the monitor code.
The generated.cpp file will later be generated during
the build by a python script.
Change-Id: I4dc4552ae8e58cd27478416888dd3363e7c2bf3f
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
-rw-r--r-- | monitor/Makefile.am | 1 | ||||
-rw-r--r-- | monitor/fan_defs.hpp | 6 | ||||
-rw-r--r-- | monitor/generated.cpp | 54 | ||||
-rw-r--r-- | monitor/types.hpp | 33 |
4 files changed, 94 insertions, 0 deletions
diff --git a/monitor/Makefile.am b/monitor/Makefile.am index 44458bd..ceec3dd 100644 --- a/monitor/Makefile.am +++ b/monitor/Makefile.am @@ -5,6 +5,7 @@ sbin_PROGRAMS = \ phosphor-fan-monitor phosphor_fan_monitor_SOURCES = \ + generated.cpp \ main.cpp phosphor_fan_monitor_LDADD = \ diff --git a/monitor/fan_defs.hpp b/monitor/fan_defs.hpp new file mode 100644 index 0000000..2cfd44a --- /dev/null +++ b/monitor/fan_defs.hpp @@ -0,0 +1,6 @@ +#pragma once + +#include "types.hpp" + +extern const std::vector<phosphor::fan::monitor::FanDefinition> +fanDefinitions; diff --git a/monitor/generated.cpp b/monitor/generated.cpp new file mode 100644 index 0000000..7578b92 --- /dev/null +++ b/monitor/generated.cpp @@ -0,0 +1,54 @@ +/** + * Copyright © 2017 IBM Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "fan_defs.hpp" +#include "types.hpp" + +//This file will be replaced by a generated version in a later commit + +using namespace phosphor::fan::monitor; + +const std::vector<FanDefinition> fanDefinitions +{ + + FanDefinition{"/system/chassis/motherboard/fan0", + 15, + 15, + 1, + std::vector<SensorDefinition>{ + SensorDefinition{"fan0", true} + }}, + FanDefinition{"/system/chassis/motherboard/fan1", + 15, + 15, + 1, + std::vector<SensorDefinition>{ + SensorDefinition{"fan1", true} + }}, + FanDefinition{"/system/chassis/motherboard/fan2", + 15, + 15, + 1, + std::vector<SensorDefinition>{ + SensorDefinition{"fan2", true} + }}, + FanDefinition{"/system/chassis/motherboard/fan3", + 15, + 15, + 1, + std::vector<SensorDefinition>{ + SensorDefinition{"fan3", true} + }} +}; diff --git a/monitor/types.hpp b/monitor/types.hpp new file mode 100644 index 0000000..dbdebd9 --- /dev/null +++ b/monitor/types.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include <string> +#include <tuple> +#include <vector> + +namespace phosphor +{ +namespace fan +{ +namespace monitor +{ + +constexpr auto sensorNameField = 0; +constexpr auto hasTargetField = 1; + +using SensorDefinition = std::tuple<std::string, bool>; + +constexpr auto fanNameField = 0; +constexpr auto timeoutField = 1; +constexpr auto fanDeviationField = 2; +constexpr auto numSensorFailsForNonfuncField = 3; +constexpr auto sensorListField = 4; + +using FanDefinition = std::tuple<std::string, + size_t, + size_t, + size_t, + std::vector<SensorDefinition>>; + +} +} +} |