Add support for Previous State in Sensor events

Previously, the sensor events generated by the PLDM stack only
included the current state of the sensor without any reference
to the previous state.

This commit introduces a new feature to address this limitation
by caching the previous states of all sensors.

The enhancement ensures that platform event messages(sensor events)
now contain the correct previous state information alongside the
current state.

Behavior Model:
1. Upon the initial occurrence of a sensor event, both the current
   state and the previous state are identical, adhering to the
   specification.
2. Subsequently, when the PLDM stack sends out sensor events, it
   retrieves the previous state from its cache and populates it
   accordingly.

Testing:
1. Example: Change the value of a sensor, such as dimm8 identify, to
   false using busctl.
   Tx: 81 02 0a 01 00 00 4d 00 01 00 [ 01 01 ]
- Note: Initially, both the event state and the previous state are 01.

2. Change the value of dimm8 identify to true.
   Tx: 81 02 0a 01 00 00 4d 00 01 00 [ 02 01 ]
- Result: Event state: 02, Previous state: 01.

3. Change the value of dimm8 identify back to false.
   Tx: 81 02 0a 01 00 00 4d 00 01 00 [ 01 02 ]
- Result: Event state: 01, Previous state: 02.

4. Similar results can be obtained using the getStateSensorReadings
   command for the same sensor at respective times.

Change-Id: Ic93a55e61fd5128cecc698b3555a6639876882ed
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
diff --git a/libpldmresponder/platform.hpp b/libpldmresponder/platform.hpp
index 605c8ab..b50a1f4 100644
--- a/libpldmresponder/platform.hpp
+++ b/libpldmresponder/platform.hpp
@@ -464,6 +464,22 @@
         return fruHandler->getAssociateEntityMap();
     }
 
+    /** @brief update the sensor cache map
+     *  @param[in] sensorId - sensor id that needs an update
+     *  @param[in] sensorRearm - rearm value within the sensor
+     *  @param[in] value - value that needs to be cached
+     */
+
+    inline void updateSensorCache(pldm::pdr::SensorID sensorId,
+                                  size_t sensorRearm, uint8_t value)
+    {
+        if (dbusToPLDMEventHandler)
+        {
+            dbusToPLDMEventHandler->updateSensorCacheMaps(sensorId, sensorRearm,
+                                                          value);
+        }
+    }
+
     /** @brief process the actions that needs to be performed after a GetPDR
      *         call is received
      *  @param[in] source - sdeventplus event source