summaryrefslogtreecommitdiffstats
path: root/sensordatahandler.hpp
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-10-12 17:18:14 -0700
committerWilliam A. Kennington III <wak@google.com>2018-10-18 15:08:55 -0700
commit4c0080287f2bb19ecfbe5cdd4a334f8769e7d0cd (patch)
treef2edadbb00b55c212c280c90f0cb35d96702bf4e /sensordatahandler.hpp
parent1181af741589db873676f177ed85d6bc04884aa1 (diff)
downloadphosphor-host-ipmid-4c0080287f2bb19ecfbe5cdd4a334f8769e7d0cd.tar.gz
phosphor-host-ipmid-4c0080287f2bb19ecfbe5cdd4a334f8769e7d0cd.zip
Convert variant usage to std interface
This is just a refactoring to use the c++17 std::variant interfaces instead of the mapbox::variant specific ones. We should be able to use mapbox::variant and std::variant interchangeably now. Tested: Built against sdbusplus with mapbox::variant and sbusplus using std::variant. Both variant compile and test out. Change-Id: I6fbaad3d12dd34968db6a10f3d74a65e07d0f0cc Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'sensordatahandler.hpp')
-rw-r--r--sensordatahandler.hpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/sensordatahandler.hpp b/sensordatahandler.hpp
index bcb55ff..d56aea8 100644
--- a/sensordatahandler.hpp
+++ b/sensordatahandler.hpp
@@ -7,12 +7,15 @@
#include <host-ipmid/ipmid-api.h>
#include <cmath>
+#include <sdbusplus/message/types.hpp>
namespace ipmi
{
namespace sensor
{
+namespace variant_ns = sdbusplus::message::variant_ns;
+
using Assertion = uint16_t;
using Deassertion = uint16_t;
using AssertionSet = std::pair<Assertion, Deassertion>;
@@ -164,7 +167,8 @@ GetSensorResponse readingAssertion(const Info& sensorInfo)
sensorInfo.propertyInterfaces.begin()->first,
sensorInfo.propertyInterfaces.begin()->second.begin()->first);
- setAssertionBytes(static_cast<uint16_t>(propValue.get<T>()), responseData);
+ setAssertionBytes(static_cast<uint16_t>(variant_ns::get<T>(propValue)),
+ responseData);
return response;
}
@@ -194,7 +198,7 @@ GetSensorResponse readingData(const Info& sensorInfo)
sensorInfo.propertyInterfaces.begin()->first,
sensorInfo.propertyInterfaces.begin()->second.begin()->first);
- double value = propValue.get<T>() *
+ double value = variant_ns::get<T>(propValue) *
std::pow(10, sensorInfo.scale - sensorInfo.exponentR);
auto rawData = static_cast<uint8_t>((value - sensorInfo.scaledOffset) /
OpenPOWER on IntegriCloud