sensorhandler: allow preconfigured unit and scale
Allow specifying the scale and unit for a sensor in the
YAML configuration. This can save clock time by no longer
requiring the daemon to reach out to the sensor owner for
the information.
Change-Id: I5f63286fc32fb9d64ebab7d86d1dbb7ff40591f4
Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/types.hpp b/types.hpp
index 0177c8f..a43c8c0 100644
--- a/types.hpp
+++ b/types.hpp
@@ -113,6 +113,8 @@
using OffsetB = uint16_t;
using Exponent = uint8_t;
using ScaledOffset = int64_t;
+using Scale = int16_t;
+using Unit = std::string;
enum class Mutability
{
@@ -142,6 +144,9 @@
OffsetB coefficientB;
Exponent exponentB;
ScaledOffset scaledOffset;
+ bool hasScale;
+ Scale scale;
+ Unit unit;
std::function<uint8_t(SetSensorReadingReq&, const Info&)> updateFunc;
std::function<GetSensorResponse(const Info&)> getFunc;
Mutability mutability;