summaryrefslogtreecommitdiffstats
path: root/dcmihandler.hpp
diff options
context:
space:
mode:
authorDeepak Kodihalli <dkodihal@in.ibm.com>2018-01-24 04:57:10 -0600
committerDeepak Kodihalli <dkodihal@in.ibm.com>2018-02-01 02:47:19 -0600
commitb1e8fba50af2310136c6f92ab8765bf27aa5cec2 (patch)
tree88214f05a4d760c52381fc68f430a5ad38672af6 /dcmihandler.hpp
parentee717d71a2f294a8de5d1e17c9106b65af59d310 (diff)
downloadphosphor-host-ipmid-b1e8fba50af2310136c6f92ab8765bf27aa5cec2.tar.gz
phosphor-host-ipmid-b1e8fba50af2310136c6f92ab8765bf27aa5cec2.zip
dcmi: get temperature readings: read temp sensors
This commit adds the code to read temperatures from various sensors. A JSON config file tells what D-Bus object(s) to look up for a specific temperature reading. Resolves openbmc/openbmc#2626 Change-Id: Ic357ec2a53ff250a2517d68defe5850ef353568a Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Diffstat (limited to 'dcmihandler.hpp')
-rw-r--r--dcmihandler.hpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/dcmihandler.hpp b/dcmihandler.hpp
index a7cfe8a..e23c8da 100644
--- a/dcmihandler.hpp
+++ b/dcmihandler.hpp
@@ -5,6 +5,7 @@
#include <string>
#include <vector>
#include <sdbusplus/bus.hpp>
+#include "nlohmann/json.hpp"
namespace dcmi
{
@@ -50,6 +51,8 @@ namespace temp_readings
static constexpr auto maxDataSets = 8;
static constexpr auto maxInstances = 255;
static constexpr auto maxTemp = 128; // degrees C
+ static constexpr auto configFile =
+ "/usr/share/ipmi-providers/dcmi_temp_readings.json";
/** @struct Response
*
@@ -70,6 +73,10 @@ namespace temp_readings
using ResponseList = std::vector<Response>;
using NumInstances = size_t;
+ using Value = uint8_t;
+ using Sign = bool;
+ using Temperature = std::tuple<Value, Sign>;
+ using Json = nlohmann::json;
}
static constexpr auto groupExtId = 0xDC;
@@ -375,6 +382,24 @@ struct GetTempReadingsResponseHdr
namespace temp_readings
{
+ /** @brief Read temperature from a d-bus object, scale it as per dcmi
+ * get temperature reading requirements.
+ *
+ * @param[in] dbusService - the D-Bus service
+ * @param[in] dbusPath - the D-Bus path
+ *
+ * @return A temperature reading
+ */
+ Temperature readTemp(const std::string& dbusService,
+ const std::string& dbusPath);
+
+ /** @brief Parse out JSON config file containing information
+ * related to temperature readings.
+ *
+ * @return A json object
+ */
+ Json parseConfig();
+
/** @brief Read temperatures and fill up DCMI response for the Get
* Temperature Readings command. This looks at a specific
* instance.
OpenPOWER on IntegriCloud