EVSE - Update FakeReadings when a MaxChargeCurrent change occurs (#35346)

* Updated FakeReadings when a MaxChargeCurrent change is made so that the readings are more representative of a real EV.

* Restyled by whitespace

* Removed using namespace from header file and added chip:: back into the type defintion since build fails.

* Apply suggestions from code review

Co-authored-by: Andrei Litvin <andy314@gmail.com>

* Apply suggestions from code review

* Restyled by clang-format

---------

Co-authored-by: Restyled.io <commits@restyled.io>
Co-authored-by: Andrei Litvin <andy314@gmail.com>
diff --git a/examples/energy-management-app/energy-management-common/energy-evse/include/EVSEManufacturerImpl.h b/examples/energy-management-app/energy-management-common/energy-evse/include/EVSEManufacturerImpl.h
index b94220d..17d2c86 100644
--- a/examples/energy-management-app/energy-management-common/energy-evse/include/EVSEManufacturerImpl.h
+++ b/examples/energy-management-app/energy-management-common/energy-evse/include/EVSEManufacturerImpl.h
@@ -213,6 +213,13 @@
      */
     static void FakeReadingsTimerExpiry(System::Layer * systemLayer, void * manufacturer);
 
+    /*
+     * @brief   Updates the parameters used to generate fake power and energy readings
+     *
+     * @param   maximumChargeCurrent   Maximum Charge current in mA
+     */
+    void UpdateEVFakeReadings(const Amperage_mA maximumChargeCurrent);
+
 private:
     EnergyEvseManager * mEvseInstance;
     ElectricalPowerMeasurement::ElectricalPowerMeasurementInstance * mEPMInstance;
diff --git a/examples/energy-management-app/energy-management-common/energy-evse/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/energy-evse/src/EVSEManufacturerImpl.cpp
index 359e7c8..4f28c32 100644
--- a/examples/energy-management-app/energy-management-common/energy-evse/src/EVSEManufacturerImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/energy-evse/src/EVSEManufacturerImpl.cpp
@@ -24,6 +24,7 @@
 #include <EnergyTimeUtils.h>
 
 #include <EnergyTimeUtils.h>
+#include <FakeReadings.h>
 #include <app/clusters/device-energy-management-server/DeviceEnergyManagementTestEventTriggerHandler.h>
 #include <app/clusters/electrical-energy-measurement-server/EnergyReportingTestEventTriggerHandler.h>
 #include <app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.h>
@@ -551,6 +552,13 @@
     return CHIP_NO_ERROR;
 }
 
+void EVSEManufacturer::UpdateEVFakeReadings(const Amperage_mA maximumChargeCurrent)
+{
+    FakeReadings::GetInstance().SetCurrent(maximumChargeCurrent);
+    // Note we have to divide by 1000 to make ma * mv = mW
+    FakeReadings::GetInstance().SetPower((FakeReadings::GetInstance().GetVoltage() * maximumChargeCurrent) / 1000);
+}
+
 /**
  * @brief    Main Callback handler - to be implemented by Manufacturer
  *
@@ -573,6 +581,7 @@
         ChipLogProgress(AppServer, "EVSE callback - maxChargeCurrent changed to %ld",
                         static_cast<long>(cb->ChargingCurrent.maximumChargeCurrent));
         pClass->ComputeChargingSchedule();
+        pClass->UpdateEVFakeReadings(cb->ChargingCurrent.maximumChargeCurrent);
         break;
     case EVSECallbackType::EnergyMeterReadingRequested:
         ChipLogProgress(AppServer, "EVSE callback - EnergyMeterReadingRequested");
diff --git a/examples/energy-management-app/energy-management-common/energy-reporting/include/FakeReadings.h b/examples/energy-management-app/energy-management-common/energy-reporting/include/FakeReadings.h
index f8334ba..4d8415a 100644
--- a/examples/energy-management-app/energy-management-common/energy-reporting/include/FakeReadings.h
+++ b/examples/energy-management-app/energy-management-common/energy-reporting/include/FakeReadings.h
@@ -18,6 +18,7 @@
 
 #pragma once
 
+#include <app/util/basic-types.h>
 #include <lib/core/DataModelTypes.h>
 #include <system/SystemLayer.h>
 
@@ -58,6 +59,15 @@
      */
     void FakeReadingsUpdate();
 
+    void SetPower(chip::Power_mW power_mW);
+    chip::Power_mW GetPower();
+
+    void SetVoltage(chip::Voltage_mV voltage_mV);
+    chip::Voltage_mV GetVoltage();
+
+    void SetCurrent(chip::Amperage_mA current_mA);
+    chip::Amperage_mA GetCurrent();
+
     /**
      * @brief   Timer expiry callback to handle fake load
      */
diff --git a/examples/energy-management-app/energy-management-common/energy-reporting/src/FakeReadings.cpp b/examples/energy-management-app/energy-management-common/energy-reporting/src/FakeReadings.cpp
index c887357..7879597 100644
--- a/examples/energy-management-app/energy-management-common/energy-reporting/src/FakeReadings.cpp
+++ b/examples/energy-management-app/energy-management-common/energy-reporting/src/FakeReadings.cpp
@@ -180,3 +180,28 @@
 
     mn->FakeReadingsUpdate();
 }
+
+void FakeReadings::SetPower(Power_mW aPower_mW)
+{
+    mPower_mW = aPower_mW;
+}
+Power_mW FakeReadings::GetPower()
+{
+    return mPower_mW;
+};
+void FakeReadings::SetVoltage(Voltage_mV aVoltage_mV)
+{
+    mVoltage_mV = aVoltage_mV;
+}
+Voltage_mV FakeReadings::GetVoltage()
+{
+    return mVoltage_mV;
+};
+void FakeReadings::SetCurrent(Amperage_mA aCurrent_mA)
+{
+    mCurrent_mA = aCurrent_mA;
+}
+Amperage_mA FakeReadings::GetCurrent()
+{
+    return mCurrent_mA;
+}