presence: Add sensor to redundancy policy api

Include a reference to the sensor changing state when sensor
implementations ping the policy object.

This allows policy logic based on multiple sensors, simultaneously.

Change-Id: I44cf00c7ecd220d0cc99e51ca6093bac6da7343c
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/presence/fallback.cpp b/presence/fallback.cpp
index 625d74a..7550c34 100644
--- a/presence/fallback.cpp
+++ b/presence/fallback.cpp
@@ -26,7 +26,7 @@
 namespace presence
 {
 
-void Fallback::stateChanged(bool present)
+void Fallback::stateChanged(bool present, PresenceSensor& sensor)
 {
     if (!present)
     {
diff --git a/presence/fallback.hpp b/presence/fallback.hpp
index a1a5b29..280ef1c 100644
--- a/presence/fallback.hpp
+++ b/presence/fallback.hpp
@@ -55,8 +55,9 @@
          *
          * @param[in] present - The new presence state according
          *             to the active sensor.
+         * @param[in] sensor - The sensor that changed state.
          */
-        void stateChanged(bool present) override;
+        void stateChanged(bool present, PresenceSensor& sensor) override;
 
         /**
          * @brief monitor
diff --git a/presence/gpio.cpp b/presence/gpio.cpp
index dfd72db..28db46e 100644
--- a/presence/gpio.cpp
+++ b/presence/gpio.cpp
@@ -89,7 +89,7 @@
 
     if (currentState != newState)
     {
-        getPolicy().stateChanged(newState);
+        getPolicy().stateChanged(newState, *this);
         currentState = newState;
     }
 }
diff --git a/presence/rpolicy.hpp b/presence/rpolicy.hpp
index 34beb77..8f7db3e 100644
--- a/presence/rpolicy.hpp
+++ b/presence/rpolicy.hpp
@@ -9,6 +9,8 @@
 namespace presence
 {
 
+class PresenceSensor;
+
 /**
  * @class RedundancyPolicy
  * @brief Redundancy policy interface.
@@ -44,8 +46,9 @@
          * the inventory and execute their policy logic.
          *
          * @param[in] present - The new state of the sensor.
+         * @param[in] sensor - The sensor that changed state.
          */
-        virtual void stateChanged(bool present) = 0;
+        virtual void stateChanged(bool present, PresenceSensor& sensor) = 0;
 
         /**
          * @brief monitor
diff --git a/presence/tach.cpp b/presence/tach.cpp
index deed040..0d96ce5 100644
--- a/presence/tach.cpp
+++ b/presence/tach.cpp
@@ -137,7 +137,7 @@
 
         if (currentState != newState)
         {
-            getPolicy().stateChanged(newState);
+            getPolicy().stateChanged(newState, *this);
             currentState = newState;
         }
     }