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/interfaces.hpp b/interfaces.hpp
index b4b236b..8ec474b 100644
--- a/interfaces.hpp
+++ b/interfaces.hpp
@@ -53,6 +53,18 @@
virtual void write(double value) = 0;
/*
+ * A wrapper around write(), with additional parameters.
+ * force = true to perform redundant write, even if raw value unchanged.
+ * written = non-null to be filled in with the actual raw value written.
+ */
+ virtual void write(double value, bool force, int64_t* written)
+ {
+ (void)force;
+ (void)written;
+ return write(value);
+ }
+
+ /*
* All WriteInterfaces have min/max available in case they want to error
* check.
*/