diff options
author | Tom Joseph <tomjoseph@in.ibm.com> | 2017-09-07 00:09:46 +0530 |
---|---|---|
committer | Tom Joseph <tomjoseph@in.ibm.com> | 2017-09-14 18:48:12 +0530 |
commit | 295f17e5257774f11d6c05ed6e00e28cb4039dbf (patch) | |
tree | 2b5d0f00050896eddad757db1225526b5f5999e3 /sensorhandler.h | |
parent | e4014fca76e418e5d7d5c8ce8720913f998cd9de (diff) | |
download | phosphor-host-ipmid-295f17e5257774f11d6c05ed6e00e28cb4039dbf.tar.gz phosphor-host-ipmid-295f17e5257774f11d6c05ed6e00e28cb4039dbf.zip |
sensor: Add function to support sensor with readingAssertion type
readingAssertion is special type where the entire assert bitfield
serves as the value or reading.
Change-Id: Iaddbe846e04d2a53cff69d71670a96ccc66636a8
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
Diffstat (limited to 'sensorhandler.h')
-rw-r--r-- | sensorhandler.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sensorhandler.h b/sensorhandler.h index a078693..6ba5c34 100644 --- a/sensorhandler.h +++ b/sensorhandler.h @@ -510,6 +510,20 @@ inline void setReading(uint8_t value, ipmi::sensor::GetReadingResponse* resp) resp->reading = value; } +/** + * @brief Map the value to the assertion bytes. The assertion states are stored + * in 2 bytes. + * + * @param[in] value - value to mapped to the assertion byte. + * @param[in/out] resp - get sensor reading response. + */ +inline void setAssertionBytes(uint16_t value, + ipmi::sensor::GetReadingResponse* resp) +{ + resp->assertOffset0_7 = static_cast<uint8_t>(value & 0x00FF); + resp->assertOffset8_14 = static_cast<uint8_t>(value >> 8); +} + } // namespace sensor } // namespace ipmi |