use ZoneInterface pointers where Dbus aspect not important

The implementation of the ZoneInterface used is the DbusPidZone, however
using the ZoneInterface when the Dbus aspect is unimportant provides for
trivial support of other implementations.

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I0ed87322904e7f87e5b5c8a50c01144f3d843a10
diff --git a/pid/zone_interface.hpp b/pid/zone_interface.hpp
index f701064..a024c0e 100644
--- a/pid/zone_interface.hpp
+++ b/pid/zone_interface.hpp
@@ -7,18 +7,79 @@
 namespace pid_control
 {
 
+/**
+ * In a Zone you have a set of PIDs which feed each other.  Fan PIDs are fed set
+ * points from Thermal PIDs.
+ */
 class ZoneInterface
 {
   public:
     virtual ~ZoneInterface() = default;
 
-    virtual double getCachedValue(const std::string& name) = 0;
-    virtual void addSetPoint(double setpoint) = 0;
-    virtual void addRPMCeiling(double ceiling) = 0;
-    virtual double getMaxSetPointRequest() const = 0;
-    virtual bool getFailSafeMode() const = 0;
-    virtual double getFailSafePercent() const = 0;
+    /** If the zone implementation supports logging, initialize the log. */
+    virtual void initializeLog(void) = 0;
+    /** If the zone implementation supports logging, write string to log. */
+    virtual void writeLog(const std::string& value) = 0;
+
+    /** Return a pointer to the sensor specified by name. */
     virtual Sensor* getSensor(const std::string& name) = 0;
+
+    /* updateFanTelemetry() and updateSensors() both clear the failsafe state
+     * for a sensor if it's no longer in that state.
+     */
+    /** For each fan input in the zone, read each to update the cachedValue and
+     * check if the fan is beyond its timeout to trigger a failsafe condition.
+     */
+    virtual void updateFanTelemetry(void) = 0;
+    /** For each thermal input in the zone, read each to update the cachedValue
+     * and check if the sensor is beyond its timeout to trigger a failsafe
+     * condition.
+     */
+    virtual void updateSensors(void) = 0;
+    /** For each fan and thermal input in the zone, set the cachedValue to 0 and
+     * set the input as failsafe - to default the zone to failsafe before it
+     * starts processing values to control fans.
+     */
+    virtual void initializeCache(void) = 0;
+    /** Return cached value for sensor by name. */
+    virtual double getCachedValue(const std::string& name) = 0;
+
+    /** Add a set point value for the Max Set Point computation. */
+    virtual void addSetPoint(double setpoint) = 0;
+    /** Clear all set points specified via addSetPoint */
+    virtual void clearSetPoints(void) = 0;
+
+    /** Add maximum RPM value to drive fan pids. */
+    virtual void addRPMCeiling(double ceiling) = 0;
+    /** Clear any RPM value set with addRPMCeiling. */
+    virtual void clearRPMCeilings(void) = 0;
+
+    /** Compute the value returned by getMaxSetPointRequest - called from the
+     * looping mechanism before triggering any Fan PIDs. The value computed is
+     * used by each fan PID.
+     */
+    virtual void determineMaxSetPointRequest(void) = 0;
+    /** Given the set points added via addSetPoint, return the maximum value -
+     * called from the PID loop that uses that value to drive the fans.
+     */
+    virtual double getMaxSetPointRequest() const = 0;
+
+    /** Return if the zone has any sensors in fail safe mode. */
+    virtual bool getFailSafeMode() const = 0;
+    /** Return the rpm or pwm percent value to drive fan pids when zone is in
+     * fail safe.
+     */
+    virtual double getFailSafePercent() const = 0;
+
+    /** Return if the zone is set to manual mode.  false equates to automatic
+     * mode (the default).
+     */
+    virtual bool getManualMode(void) const = 0;
+
+    /** For each fan pid, do processing. */
+    virtual void processFans(void) = 0;
+    /** For each thermal pid, do processing. */
+    virtual void processThermals(void) = 0;
 };
 
 } // namespace pid_control