diff options
author | Marri Devender Rao <devenrao@in.ibm.com> | 2018-01-18 10:48:37 -0600 |
---|---|---|
committer | Tom Joseph <tomjoseph@in.ibm.com> | 2018-02-06 05:21:43 +0000 |
commit | 66c5fda293759e993c18812cac4620a210387dba (patch) | |
tree | ce371fe2e4c24679e3a7e0abdfc303fea4ad28c7 /dcmihandler.hpp | |
parent | 138e01889a4fb60c80de9b67048a959e8e671516 (diff) | |
download | phosphor-host-ipmid-66c5fda293759e993c18812cac4620a210387dba.tar.gz phosphor-host-ipmid-66c5fda293759e993c18812cac4620a210387dba.zip |
DCMI: Read power value from the configured D-Bus object path
1) Parse the power_reading JSON configuration file to get
the D-Bus object path for the power reading.
2) Read the power reading value from the specified D-Bus object.
Change-Id: I4b9f0703318e8db2c86d0b337e524eee6da33d08
Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
Diffstat (limited to 'dcmihandler.hpp')
-rw-r--r-- | dcmihandler.hpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/dcmihandler.hpp b/dcmihandler.hpp index bd2c6e1..4e95eba 100644 --- a/dcmihandler.hpp +++ b/dcmihandler.hpp @@ -14,6 +14,7 @@ enum Commands { // Get capability bits GET_CAPABILITIES = 0x01, + GET_POWER_READING = 0x02, GET_POWER_LIMIT = 0x03, SET_POWER_LIMIT = 0x04, APPLY_POWER_LIMIT = 0x05, @@ -427,6 +428,47 @@ namespace temp_readings uint8_t instanceStart); } +/** @brief Read power reading from power reading sensor object + * + * @param[in] bus - dbus connection + * + * @return total power reading + */ +int64_t getPowerReading(sdbusplus::bus::bus& bus); + +/** @struct GetPowerReadingRequest + * + * DCMI Get Power Reading command request. + * Refer DCMI specification Version 1.1 Section 6.6.1 + */ +struct GetPowerReadingRequest +{ + uint8_t groupID; //!< Group extension identification. + uint8_t mode; //!< Mode + uint8_t modeAttribute; //!< Mode Attributes +} __attribute__((packed)); + +/** @struct GetPowerReadingResponse + * + * DCMI Get Power Reading command response. + * Refer DCMI specification Version 1.1 Section 6.6.1 + */ +struct GetPowerReadingResponse +{ + uint8_t groupID; //!< Group extension identification. + uint16_t currentPower; //!< Current power in watts + uint16_t minimumPower; //!< Minimum power over sampling duration + //!< in watts + uint16_t maximumPower; //!< Maximum power over sampling duration + //!< in watts + uint16_t averagePower; //!< Average power over sampling duration + //!< in watts + uint32_t timeStamp; //!< IPMI specification based time stamp + uint32_t timeFrame; //!< Statistics reporting time period in milli + //!< seconds. + uint8_t powerReadingState; //!< Power Reading State +} __attribute__((packed)); + } // namespace dcmi #endif |