Skip to content

Commit 04e3c60

Browse files
committed
Updated with code review comments.
1 parent 357bd1e commit 04e3c60

File tree

2 files changed

+34
-28
lines changed

2 files changed

+34
-28
lines changed

examples/energy-management-app/energy-management-common/energy-evse/include/EnergyEvseDelegateImpl.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -60,43 +60,43 @@ class EvseSession
6060
/**
6161
* @brief This function records the start time and provided energy meter values as part of the new session.
6262
*
63-
* @param aEndpointId - The endpoint to report the update on
63+
* @param endpointId - The endpoint to report the update on
6464
* @param chargingMeterValue - The current value of the energy meter (charging) in mWh
6565
* @param dischargingMeterValue - The current value of the energy meter (discharging) in mWh
6666
*/
67-
void StartSession(EndpointId aEndpointId, int64_t chargingMeterValue, int64_t dischargingMeterValue);
67+
void StartSession(EndpointId endpointId, int64_t chargingMeterValue, int64_t dischargingMeterValue);
6868

6969
/**
7070
* @brief This function updates the session information at the unplugged event
7171
*
72-
* @param aEndpointId - The endpoint to report the update on
72+
* @param endpointId - The endpoint to report the update on
7373
* @param chargingMeterValue - The current value of the energy meter (charging) in mWh
7474
* @param dischargingMeterValue - The current value of the energy meter (discharging) in mWh
7575
*/
76-
void StopSession(EndpointId aEndpointId, int64_t chargingMeterValue, int64_t dischargingMeterValue);
76+
void StopSession(EndpointId endpointId, int64_t chargingMeterValue, int64_t dischargingMeterValue);
7777

7878
/**
7979
* @brief This function updates the session Duration to allow read attributes to return latest values
8080
*
81-
* @param aEndpointId - The endpoint to report the update on
81+
* @param endpointId - The endpoint to report the update on
8282
*/
83-
void RecalculateSessionDuration(EndpointId aEndpointId);
83+
void RecalculateSessionDuration(EndpointId endpointId);
8484

8585
/**
8686
* @brief This function updates the EnergyCharged meter value
8787
*
88-
* @param aEndpointId - The endpoint to report the update on
88+
* @param endpointId - The endpoint to report the update on
8989
* @param chargingMeterValue - The value of the energy meter (charging) in mWh
9090
*/
91-
void UpdateEnergyCharged(EndpointId aEndpointId, int64_t chargingMeterValue);
91+
void UpdateEnergyCharged(EndpointId endpointId, int64_t chargingMeterValue);
9292

9393
/**
9494
* @brief This function updates the EnergyDischarged meter value
9595
*
96-
* @param aEndpointId - The endpoint to report the update on
96+
* @param endpointId - The endpoint to report the update on
9797
* @param dischargingMeterValue - The value of the energy meter (discharging) in mWh
9898
*/
99-
void UpdateEnergyDischarged(EndpointId aEndpointId, int64_t dischargingMeterValue);
99+
void UpdateEnergyDischarged(EndpointId endpointId, int64_t dischargingMeterValue);
100100

101101
/* Public members - represent attributes in the cluster */
102102
DataModel::Nullable<uint32_t> mSessionID;

examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseDelegateImpl.cpp

+24-18
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ Status EnergyEvseDelegate::HandleEVPluggedInEvent()
672672
if (mState == StateEnum::kNotPluggedIn)
673673
{
674674
/* EV was not plugged in - start a new session */
675-
// TODO get energy meter readings
675+
// TODO get energy meter readings - #35370
676676
mSession.StartSession(mEndpointId, 0, 0);
677677
SendEVConnectedEvent();
678678

@@ -694,7 +694,7 @@ Status EnergyEvseDelegate::HandleEVNotDetectedEvent()
694694
SendEnergyTransferStoppedEvent(EnergyTransferStoppedReasonEnum::kOther);
695695
}
696696

697-
// TODO get energy meter readings
697+
// TODO get energy meter readings - #35370
698698
mSession.StopSession(mEndpointId, 0, 0);
699699
SendEVNotDetectedEvent();
700700
SetState(StateEnum::kNotPluggedIn);
@@ -1627,10 +1627,11 @@ bool EnergyEvseDelegate::IsEvsePluggedIn()
16271627
/**
16281628
* @brief This function samples the start-time, and energy meter to hold the session info
16291629
*
1630+
* @param endpointId - The endpoint to report the update on
16301631
* @param chargingMeterValue - The current value of the energy meter (charging) in mWh
16311632
* @param dischargingMeterValue - The current value of the energy meter (discharging) in mWh
16321633
*/
1633-
void EvseSession::StartSession(EndpointId aEndpointId, int64_t chargingMeterValue, int64_t dischargingMeterValue)
1634+
void EvseSession::StartSession(EndpointId endpointId, int64_t chargingMeterValue, int64_t dischargingMeterValue)
16341635
{
16351636
/* Get Timestamp */
16361637
uint32_t chipEpoch = 0;
@@ -1662,13 +1663,13 @@ void EvseSession::StartSession(EndpointId aEndpointId, int64_t chargingMeterValu
16621663
mSessionEnergyCharged = MakeNullable(static_cast<int64_t>(0));
16631664
mSessionEnergyDischarged = MakeNullable(static_cast<int64_t>(0));
16641665

1665-
MatterReportingAttributeChangeCallback(aEndpointId, EnergyEvse::Id, SessionID::Id);
1666-
MatterReportingAttributeChangeCallback(aEndpointId, EnergyEvse::Id, SessionDuration::Id);
1667-
MatterReportingAttributeChangeCallback(aEndpointId, EnergyEvse::Id, SessionEnergyCharged::Id);
1668-
MatterReportingAttributeChangeCallback(aEndpointId, EnergyEvse::Id, SessionEnergyDischarged::Id);
1666+
MatterReportingAttributeChangeCallback(endpointId, EnergyEvse::Id, SessionID::Id);
1667+
MatterReportingAttributeChangeCallback(endpointId, EnergyEvse::Id, SessionDuration::Id);
1668+
MatterReportingAttributeChangeCallback(endpointId, EnergyEvse::Id, SessionEnergyCharged::Id);
1669+
MatterReportingAttributeChangeCallback(endpointId, EnergyEvse::Id, SessionEnergyDischarged::Id);
16691670

16701671
// Write values to persistent storage.
1671-
ConcreteAttributePath path = ConcreteAttributePath(aEndpointId, EnergyEvse::Id, SessionID::Id);
1672+
ConcreteAttributePath path = ConcreteAttributePath(endpointId, EnergyEvse::Id, SessionID::Id);
16721673
GetSafeAttributePersistenceProvider()->WriteScalarValue(path, mSessionID);
16731674

16741675
// TODO persist mStartTime
@@ -1679,22 +1680,25 @@ void EvseSession::StartSession(EndpointId aEndpointId, int64_t chargingMeterValu
16791680
/**
16801681
* @brief This function updates the session information at the unplugged event
16811682
*
1683+
* @param endpointId - The endpoint to report the update on
16821684
* @param chargingMeterValue - The current value of the energy meter (charging) in mWh
16831685
* @param dischargingMeterValue - The current value of the energy meter (discharging) in mWh
16841686
*/
1685-
void EvseSession::StopSession(EndpointId aEndpointId, int64_t chargingMeterValue, int64_t dischargingMeterValue)
1687+
void EvseSession::StopSession(EndpointId endpointId, int64_t chargingMeterValue, int64_t dischargingMeterValue)
16861688
{
1687-
RecalculateSessionDuration(aEndpointId);
1688-
UpdateEnergyCharged(aEndpointId, chargingMeterValue);
1689-
UpdateEnergyDischarged(aEndpointId, dischargingMeterValue);
1689+
RecalculateSessionDuration(endpointId);
1690+
UpdateEnergyCharged(endpointId, chargingMeterValue);
1691+
UpdateEnergyDischarged(endpointId, dischargingMeterValue);
16901692
}
16911693

16921694
/*---------------------- EvseSession functions --------------------------*/
16931695

16941696
/**
16951697
* @brief This function updates the session attrs to allow read attributes to return latest values
1698+
*
1699+
* @param endpointId - The endpoint to report the update on
16961700
*/
1697-
void EvseSession::RecalculateSessionDuration(EndpointId aEndpointId)
1701+
void EvseSession::RecalculateSessionDuration(EndpointId endpointId)
16981702
{
16991703
/* Get Timestamp */
17001704
uint32_t chipEpoch = 0;
@@ -1710,27 +1714,29 @@ void EvseSession::RecalculateSessionDuration(EndpointId aEndpointId)
17101714

17111715
uint32_t duration = chipEpoch - mStartTime;
17121716
mSessionDuration = MakeNullable(duration);
1713-
MatterReportingAttributeChangeCallback(aEndpointId, EnergyEvse::Id, SessionDuration::Id);
1717+
MatterReportingAttributeChangeCallback(endpointId, EnergyEvse::Id, SessionDuration::Id);
17141718
}
17151719

17161720
/**
17171721
* @brief This function updates the EnergyCharged meter value
17181722
*
1723+
* @param endpointId - The endpoint to report the update on
17191724
* @param chargingMeterValue - The value of the energy meter (charging) in mWh
17201725
*/
1721-
void EvseSession::UpdateEnergyCharged(EndpointId aEndpointId, int64_t chargingMeterValue)
1726+
void EvseSession::UpdateEnergyCharged(EndpointId endpointId, int64_t chargingMeterValue)
17221727
{
17231728
mSessionEnergyCharged = MakeNullable(chargingMeterValue - mSessionEnergyChargedAtStart);
1724-
MatterReportingAttributeChangeCallback(aEndpointId, EnergyEvse::Id, SessionEnergyCharged::Id);
1729+
MatterReportingAttributeChangeCallback(endpointId, EnergyEvse::Id, SessionEnergyCharged::Id);
17251730
}
17261731

17271732
/**
17281733
* @brief This function updates the EnergyDischarged meter value
17291734
*
1735+
* @param endpointId - The endpoint to report the update on
17301736
* @param dischargingMeterValue - The value of the energy meter (discharging) in mWh
17311737
*/
1732-
void EvseSession::UpdateEnergyDischarged(EndpointId aEndpointId, int64_t dischargingMeterValue)
1738+
void EvseSession::UpdateEnergyDischarged(EndpointId endpointId, int64_t dischargingMeterValue)
17331739
{
17341740
mSessionEnergyDischarged = MakeNullable(dischargingMeterValue - mSessionEnergyDischargedAtStart);
1735-
MatterReportingAttributeChangeCallback(aEndpointId, EnergyEvse::Id, SessionEnergyDischarged::Id);
1741+
MatterReportingAttributeChangeCallback(endpointId, EnergyEvse::Id, SessionEnergyDischarged::Id);
17361742
}

0 commit comments

Comments
 (0)