dbuswrite: Add another write() form to WriteInterface
Adding another form of the write() call,
which takes 3 arguments instead of 1,
providing an alternate interface for caller to use.
A compatibility function is provided,
which simply calls write(), so no API breakage.
The additional arguments to write() allow caller
to force the write to happen even if old value same,
and/or to learn the actual raw value written.
Adding boilerplate to Sensor and PluggableSensor,
to also pass the 3-argument write() through.
Signed-off-by: Josh Lehan <krellan@google.com>
Change-Id: Iaf35f674ef9ce38b56017f6cb0f821df6c789649
diff --git a/sensors/sensor.hpp b/sensors/sensor.hpp
index 8258b7b..f5f01c2 100644
--- a/sensors/sensor.hpp
+++ b/sensors/sensor.hpp
@@ -36,6 +36,14 @@
virtual ReadReturn read(void) = 0;
virtual void write(double value) = 0;
+
+ virtual void write(double value, bool force, int64_t* written)
+ {
+ (void)force;
+ (void)written;
+ return write(value);
+ }
+
virtual bool getFailed(void)
{
return false;