Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EVSE add get set clear targets support #31407

Merged
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
403 commits
Select commit Hold shift + click to select a range
3aead8a
De-alphabetize list of files to avoid breaking GH action
hasty Jan 19, 2024
dbea267
Semi-realphabetize?
hasty Jan 19, 2024
1335b8a
Restore strangely dropped events
hasty Jan 19, 2024
58bfa09
Better BitMask handling
hasty Jan 19, 2024
519b0ac
Change min/max on electrical measurements to be decimal instead of hex
hasty Jan 22, 2024
9d79bba
Rename meas-and-sense to measurement-and-sensing.xml
hasty Jan 22, 2024
792b0e5
Remove seemingly superfluous attribute requirements on Descriptor clu…
hasty Jan 22, 2024
c7161de
Updates to electrical-power-measurement-server based on comments
hasty Jan 22, 2024
1ff7640
Remove defaults from MeasurementAccuracyRangeStruct to match spec update
hasty Jan 24, 2024
ab2ba44
Restore side="server" to events
hasty Jan 25, 2024
9117f30
Move common enums and bitmaps to detail:: instead of detail::Enums an…
hasty Jan 25, 2024
6b0b45c
Assign ID to Electrical Sensor device type
hasty Jan 25, 2024
adf13f6
Merge branch 'master' into granbery/electrical_measurement
hasty Jan 25, 2024
2064e85
Merge branch 'master' into 31258-13-the-implementation-of-the-electri…
jamesharrow Jan 25, 2024
6dcf82c
Removed EPM and EEM from Root Node Device
hasty Jan 25, 2024
d788995
Restyled formatting is different than clang-format
hasty Jan 25, 2024
a9f0afd
Re-add FeatureMap to attributeAccessInterfaceAttributes for EEM and EPM
hasty Jan 25, 2024
ab17650
Regen after merge
hasty Jan 25, 2024
e496350
Added electrical-energy-measurement-server to CMakelist to fix linker…
jamesharrow Jan 26, 2024
f854e11
Lock client on Electrical Sensor device type
hasty Jan 26, 2024
2d8fa4b
Remove unneeded using statement now that Enums are in detail::
hasty Jan 26, 2024
54b126f
Check for null iterators and error
hasty Jan 26, 2024
0fd361e
Switch to ResourceExhausted from CHIP_ERROR_INTERNAL
hasty Jan 26, 2024
27aaa23
Merge branch 'granbery/electrical_measurement' into granbery/electric…
jamesharrow Jan 26, 2024
bbc0533
Merge branch '31258-13-the-implementation-of-the-electrical-energy-me…
jamesharrow Jan 26, 2024
68084c1
Re-enabled EEM in energy management app and regen all after previous …
jamesharrow Jan 26, 2024
d392bd9
Some refactoring to add EPM Instance into the EVSEManufacturer class …
jamesharrow Jan 26, 2024
8782d9f
Missed one file.
jamesharrow Jan 26, 2024
0cd0549
Fixed crash due to unassigned dg pointer. Power/Voltage/Current fakin…
jamesharrow Jan 26, 2024
5636975
Touch file since restyled crashed
jamesharrow Jan 26, 2024
eeb4e71
Restyled by gn
restyled-commits Jan 26, 2024
013ae77
Restyled by isort
restyled-commits Jan 26, 2024
29d6f41
Add stub for EPM cluster
hasty Jan 26, 2024
4e401d2
Reverted whitespace change
jamesharrow Jan 26, 2024
cc4c144
Merge branch 'upstream-master' into granbery/electrical_measurement-A…
jamesharrow Jan 26, 2024
9978a08
Did regen_all after merge from master to resolve conflicts.
jamesharrow Jan 27, 2024
2d6e59a
Put back line of clusters which somehow got deleted accidentally.
jamesharrow Jan 27, 2024
f89a9a9
Merge branch 'upstream-master' into granbery/electrical_measurement-A…
jamesharrow Jan 27, 2024
fa610ef
Remerged ZAP file and regen all after resolving conflicts.
jamesharrow Jan 27, 2024
78c7658
Fixes for Python tests
hasty Jan 27, 2024
5677719
Merge branch 'master' into granbery/electrical_measurement
hasty Jan 27, 2024
887253a
Correct name for Ember init callback
hasty Jan 27, 2024
2e1d2c9
Formatting
hasty Jan 27, 2024
febcb9c
Merge branch 'master' into granbery/electrical_measurement
hasty Jan 27, 2024
8f1edea
Sync optional attributes list with .zap file for EPM
hasty Jan 27, 2024
3b4ad35
Add missing features to EPM stub
hasty Jan 27, 2024
1203545
Revert FeatureMap in attributeAccessInterfaceAttributes
hasty Jan 27, 2024
37e8fed
Allow FeatureMap in EEM constructor; add all-clusters-app EEM stub
hasty Jan 27, 2024
272ca37
Forgot zcl-with-test-extensions
hasty Jan 27, 2024
3fae3b4
Unregister EEM attribute access in destructor
hasty Jan 27, 2024
a951bf1
Remove redundant returns to keep clang-tidy happy
hasty Jan 28, 2024
39a3c04
Fix for issue mentioned in code review on EEM cluster limiting the nu…
jamesharrow Jan 28, 2024
72600fd
Refactoring to have a common EvseMain across all platforms to avoid m…
jamesharrow Jan 28, 2024
3276299
Merge remote-tracking branch 'hasty_epm/granbery/electrical_measureme…
jamesharrow Jan 28, 2024
ae00d9f
Added electrical-power-measurement-server to ESP32 CMakeLists.txt
jamesharrow Jan 28, 2024
9a9db14
Merge remote-tracking branch 'upstream/master' into granbery/electric…
jamesharrow Jan 29, 2024
60e60c4
Merge remote-tracking branch 'upstream/master' into granbery/electric…
jamesharrow Jan 30, 2024
82bbadf
Updated Matter device types to add EVSE
jamesharrow Jan 30, 2024
ae73d8d
Merge remote-tracking branch 'upstream/master' into granbery/electric…
jamesharrow Feb 4, 2024
38732a8
Open and saved energy-management-app.zap and regen_all
jamesharrow Feb 4, 2024
62fd3fa
Removed duplicate ElectricalEnergyMeasurment class which was accident…
jamesharrow Feb 4, 2024
626f976
Merge remote-tracking branch 'upstream/master' into granbery/electric…
jamesharrow Feb 4, 2024
821c07f
Added support for test event triggers and handling of reading events …
jamesharrow Feb 4, 2024
98cf8ae
Made TC_EEVSE_Utils.py use the matter_testing_support instead of its …
jamesharrow Feb 4, 2024
bfa7f0e
Restyled by isort
restyled-commits Feb 4, 2024
71b8c66
Cherry pick from Tweaks to EVSE Test plans (Issue #31460)
jamesharrow Feb 4, 2024
3775ade
Changed the random value generation to make the values +/- and handle…
jamesharrow Feb 5, 2024
bf7972b
Enabled cumulativeEnergyExported in Energy-management-app.
jamesharrow Feb 5, 2024
68af0a0
Added initial electrical power measurement 2.2 test case
jamesharrow Feb 5, 2024
f37e745
Changed copyright date
jamesharrow Feb 6, 2024
d35c70c
Code review comment fixes.
jamesharrow Feb 6, 2024
bb748c6
Changed to c++ style cast
jamesharrow Feb 6, 2024
90e01a7
Fixed trailing whitepace
jamesharrow Feb 6, 2024
00fb2d9
Merge branch 'upstream-master' into granbery/electrical_measurement-A…
jamesharrow Feb 6, 2024
db9bb17
Added support for testing read of EEM attributes and change of values
jamesharrow Feb 6, 2024
227516c
Corrected EPM references in TC_EEM_2_2. Added TC_EEM_2_3
jamesharrow Feb 6, 2024
1fc8759
Added periodic energy reporting, and new cumulativeEnergyReset attrib…
jamesharrow Feb 6, 2024
69d000e
Added periodic energy reading support and TC_EEM_2_3 to 2_5.
jamesharrow Feb 6, 2024
f40837d
Python removed unused logging and EventChangeCallback
jamesharrow Feb 6, 2024
35b446b
Updates to align to test plan PR #3949
jamesharrow Feb 7, 2024
ab55452
Added initial EEM_2_1 test script.
jamesharrow Feb 7, 2024
babf463
Added example of setting EEM Accuracy and EEM CumulativeEnergyReset s…
jamesharrow Feb 7, 2024
f536ffb
Restyled by whitespace
restyled-commits Feb 7, 2024
1757efa
Restyled
jamesharrow Feb 8, 2024
078af94
Removed extra spaces in TC_EEM_2_1.py
jamesharrow Feb 8, 2024
e85b3f0
Removed unused EnergyManagementManager.cpp/.h
jamesharrow Feb 8, 2024
d72ab68
Fixed PowerMode = kAc
jamesharrow Feb 8, 2024
ae08b31
Merge branch 'upstream-master' into granbery/electrical_measurement-A…
jamesharrow Feb 8, 2024
ad6505b
Initial TC_EPM_2_1.py script
jamesharrow Feb 8, 2024
689884f
Restyled by isort
restyled-commits Feb 8, 2024
c95b1ea
Merge branch 'upstream-master' into granbery/electrical_measurement-A…
jamesharrow Feb 8, 2024
b1f497d
Merged TC_EEVSE tests back in
jamesharrow Feb 8, 2024
9b3b7eb
Initialized NumberOfMeasurementTypes
jamesharrow Feb 8, 2024
ce708f8
Added EEM 2.1,2.2,2.3,2.4,2.5 and EPM 2.1,2.2 into CI workflow tests.…
jamesharrow Feb 8, 2024
d04127e
Interim state - partially refactored how Measurement Structs are enco…
jamesharrow Feb 9, 2024
f3d0efd
Merge remote-tracking branch 'upstream/master' into granbery/electric…
jamesharrow Feb 9, 2024
e6fab15
Removed SetNumberOfMeasurementTypes since this can be derived from th…
jamesharrow Feb 9, 2024
80bc590
Completed TC_EPM_2_1.py script
jamesharrow Feb 9, 2024
d19b1b9
Corrected test plan spec reference.
jamesharrow Feb 9, 2024
68a1890
Test EPM_2_1 now runs and passes. Allows checking that attributes are…
jamesharrow Feb 9, 2024
c068b61
Revert unintended change to tests.yaml
jamesharrow Feb 9, 2024
4efe496
Python test case code-review updates
jamesharrow Feb 9, 2024
2a16811
Removed old range iterator.
jamesharrow Feb 9, 2024
34e52cd
Fixed lint issues and adjusted timings to match the test plan pr.
jamesharrow Feb 9, 2024
88fa403
Fixed all-clusters electrical-power-measurement cluster by using the …
jamesharrow Feb 9, 2024
9ba5390
Implemented HarmonicCurrents and HarmonicStructs (to return empty lis…
jamesharrow Feb 9, 2024
7dcb37a
Merge remote-tracking branch 'upstream/master' into EVSE_Add_Get_Set_…
jamesharrow Feb 10, 2024
39db355
Merge branch 'granbery/electrical_measurement-AddElectricalPowerMeasu…
jamesharrow Feb 10, 2024
dee6c49
Updated TC_EEVSE_2_3.py from more up to date branch.
jamesharrow Feb 10, 2024
1a84734
Added basic set/get/clear targets framework based on earlier work. No…
jamesharrow Feb 10, 2024
766c903
Removed files that were recently deleted upstream
jamesharrow Feb 10, 2024
5b7be46
Corrected PICS in TC_EEVSE_2_3.py and copyright date
jamesharrow Feb 10, 2024
da24745
Interim checkin with GetTargets not working
jamesharrow Feb 11, 2024
17e6cc8
Initial GetTargets working with a constant static array to demonstrat…
jamesharrow Feb 11, 2024
94acbe7
Merge branch 'upstream-master' into EVSE_Add_Get_Set_Clear_Targets_Su…
jamesharrow Feb 12, 2024
d0c5492
Removed unused EnergyEvseManager.cpp, Added EnergyEvseTargetStore.cpp
jamesharrow Feb 13, 2024
a2a4e48
Added EVSETargets to DefaultStorageKeyAllocator.h
jamesharrow Feb 13, 2024
d3c84e6
Reverted incorrect removal of EnergyEvseManager.cpp
jamesharrow Feb 13, 2024
094d83b
Added override into EnergyEvseDelegate which resulted in strange erro…
jamesharrow Feb 13, 2024
a711eea
Added basic infrastructure for storing targets and reading them back.…
jamesharrow Feb 15, 2024
b210d84
Store working
jamesharrow Feb 15, 2024
1edf3db
Store and Load seem to work.
jamesharrow Feb 16, 2024
99412bb
Merge remote-tracking branch 'upstream/master' into EVSE_Add_Get_Set_…
jamesharrow Feb 16, 2024
5d261c2
Fixed Status change caused by upstream changes
jamesharrow Feb 16, 2024
ba9c738
Added helper function to compute day of week bitmap
jamesharrow Feb 16, 2024
afea1bb
Fix to evse-stub in all-clusters to add gEvseTargetsDelegate
jamesharrow Feb 16, 2024
6cdf7c4
Fixed build error on some platforms: cast of dayOfWeek to uint8_t
jamesharrow Feb 16, 2024
1be57ed
Refactoring of GetTargets command to build the response using dynamic…
jamesharrow Feb 16, 2024
2f16bdd
Updated evse-server.cpp/.h
jamesharrow Feb 16, 2024
546cb47
Tidy up of unused CommonIterator in electrical-power-measurement-serv…
jamesharrow Feb 16, 2024
904d839
Get Targets reading back from file working
jamesharrow Feb 16, 2024
53e1a7a
Starting to clean up - ran through Valgrind to check for memory leaks.
jamesharrow Feb 16, 2024
ff53867
More clean up
jamesharrow Feb 16, 2024
c341697
Added Clear Targets support and initial implementation of SetTargets
jamesharrow Feb 16, 2024
fe9588f
Fixed crash when erasing entries - test reported PASS!
jamesharrow Feb 17, 2024
6df923c
Attempt to fix Darwin complaint about unsigned int cast
jamesharrow Feb 17, 2024
9a3f010
Added logging of get targets response
jamesharrow Feb 17, 2024
d04e495
Fixed platform specific logging compilation issue
jamesharrow Feb 17, 2024
93e5101
Clean up of unused code
jamesharrow Feb 17, 2024
9128a10
More clean up
jamesharrow Feb 17, 2024
d5a8e43
Removed unused variable - Darwin check
jamesharrow Feb 17, 2024
7009a44
clang checker updates
jamesharrow Feb 17, 2024
e16d4ed
Refactored code to fix missing added energy since the TargetSoC could…
jamesharrow Feb 17, 2024
d2afd06
Added checking of GetTargetsResponse - PASSES
jamesharrow Feb 17, 2024
fe334a7
Almost working but need to resolve the Charging current and start tim…
jamesharrow Feb 26, 2024
6e91097
Merge branch 'upstream-master' into EVSE_Add_Get_Set_Clear_Targets_Su…
jamesharrow Mar 4, 2024
fc404b3
Merge remote-tracking branch 'upstream/master' into EVSE_Add_Get_Set_…
jamesharrow Mar 11, 2024
7df5c8f
Merge branch 'upstream-master' into EVSE_Add_Get_Set_Clear_Targets_Su…
jamesharrow May 14, 2024
c713e6a
Merge branch 'upstream-master' into EVSE_Add_Get_Set_Clear_Targets_Su…
jamesharrow May 23, 2024
c903bc7
Merge branch 'upstream-master' into EVSE_Add_Get_Set_Clear_Targets_Su…
jamesharrow May 28, 2024
b843cf5
Fixed PEP8 lint errors in TC_EVSE_2_3.py and TC_EEVSE_Utils.py taking…
jamesharrow May 28, 2024
d5dd9a7
Restyled by isort
restyled-commits May 28, 2024
11b5d9c
Fixed ChipLogDetail %d errors on some platforms with a static_cast
jamesharrow May 28, 2024
35745bb
Fixes in EVSE FindTargets to remove signed/unsigned comparison. Calcu…
jamesharrow May 29, 2024
10a1d35
Fixed TC_EEVSE_2_3.py to match test plan. Fixed EVSE FindNextTarget t…
jamesharrow May 29, 2024
069aef1
Fixed FindNextTarget to use epoch_s for NextChargeTargetTime and Next…
jamesharrow May 30, 2024
d9d039d
Fix: When EVSE is not plugged in, or not enabled for charge we should…
jamesharrow May 30, 2024
4644c71
Updated TC_EEM, TC_EPM, TC_EEVSE to take advantage of the new TestSte…
jamesharrow May 30, 2024
da39f54
Merge branch 'upstream-master' into EVSE_Add_Get_Set_Clear_Targets_Su…
jamesharrow Jun 4, 2024
e941112
Address comments from Boris Zbarsky
PeterC1965 Jun 10, 2024
7a60876
Fix lint error by adding entry for src/app/clusters/energy-evse-serve…
PeterC1965 Jun 10, 2024
fb7e5e8
Merge branch 'master' into EVSE_Add_Get_Set_Clear_Targets_Support
PeterC1965 Jun 10, 2024
d6a646f
Revert "Fix lint error by adding entry for src/app/clusters/energy-ev…
PeterC1965 Jun 10, 2024
666bf59
Merge branch 'master' into EVSE_Add_Get_Set_Clear_Targets_Support
PeterC1965 Jun 11, 2024
d9cc735
Rework HandleGetTargets following https://github.com/project-chip/con…
PeterC1965 Jun 11, 2024
608a4bf
Address comments from Boris Zbarsky
PeterC1965 Jun 11, 2024
039f5e3
Update TC_EEVSE_2_3 to align with latest test spec
PeterC1965 Jun 11, 2024
7024e62
Remove the use of vector
PeterC1965 Jun 13, 2024
171b3e4
Get all targets building again
PeterC1965 Jun 13, 2024
3ce6896
Merge branch 'master' into EVSE_Add_Get_Set_Clear_Targets_Support
PeterC1965 Jun 13, 2024
25d28a5
Catch up from master + fix some lint and build errors
PeterC1965 Jun 13, 2024
bea10af
Restyled by whitespace
restyled-commits Jun 13, 2024
8dd3aee
Restyled by clang-format
restyled-commits Jun 13, 2024
6e29a6d
Restyled by autopep8
restyled-commits Jun 13, 2024
3c8f8ee
Restyled by isort
restyled-commits Jun 13, 2024
71fe1bd
Fixing regession-build error
PeterC1965 Jun 13, 2024
57bf96d
Restyled by clang-format
restyled-commits Jun 13, 2024
4f610f0
Fixing regession-build error
PeterC1965 Jun 13, 2024
bb7b849
Changed logic to not return NextChargeRequiredEnergy if not plugged i…
jamesharrow Jun 17, 2024
ef9727c
Removed max 80A current limit which aligns to the spec. Who knows how…
jamesharrow Jun 19, 2024
74c9173
Bug fix - When disabling the mMaximumChargingCurrentLimitFromCommand …
jamesharrow Jun 19, 2024
1c03d3d
Being into line with latest EVSE test spec although TODOs around the …
PeterC1965 Jun 19, 2024
88d1b22
Load the targets in EnergyEvseInit()
PeterC1965 Jun 20, 2024
8735c45
Merge branch 'master' into EVSE_Add_Get_Set_Clear_Targets_Support
jamesharrow Jul 8, 2024
9431b24
Made EvseTargetsEntryType -> evseTargetsEntryType (since it is a vari…
jamesharrow Jul 8, 2024
de07e57
Reformatting and correcting the cluster PICS to be EEVSE not DEM.
jamesharrow Jul 8, 2024
50481d2
Reverted changes to python test cases which don't belong in this PR -…
jamesharrow Jul 9, 2024
ae681d6
Address review comments from James Harrow
PeterC1965 Jul 9, 2024
2e7149e
Address review comments from James Harrow
PeterC1965 Jul 9, 2024
8c84741
Add energy unit tests
PeterC1965 Jul 10, 2024
ee17867
Fix test case to align with PR10027
PeterC1965 Jul 11, 2024
2b09b00
Move the EVSE targets key to be a private member of EnergyEvseTargets…
PeterC1965 Jul 11, 2024
b756509
Merge branch 'master' into EVSE_Add_Get_Set_Clear_Targets_Support
PeterC1965 Jul 11, 2024
db8fcc3
Move EvseTargetStore test harness to examples/energy-management-app/e…
PeterC1965 Jul 12, 2024
f7f8fcf
Move example tests to examples/BUILD.gn
PeterC1965 Jul 12, 2024
e4f5698
Restyled by clang-format
restyled-commits Jul 12, 2024
2ce4b81
Restyled by gn
restyled-commits Jul 12, 2024
df253f1
Add a mechanism to enable the targets persistent data to be delete wh…
PeterC1965 Jul 13, 2024
eaf35bb
Fix unused variable compilation issues
PeterC1965 Jul 13, 2024
9bfd838
Restyled by whitespace
restyled-commits Jul 13, 2024
054d7c1
Restyled by clang-format
restyled-commits Jul 13, 2024
5764c91
Adde TC_EEVSE_2_3.py to CI testing.
jamesharrow Jul 15, 2024
95aad2a
Merge branch 'master' into EVSE_Add_Get_Set_Clear_Targets_Support
jamesharrow Jul 15, 2024
07b0a2b
Added new test-runner info to top of Python TC_EEVSE_2_3.py
jamesharrow Jul 15, 2024
a0f93a8
Remove assert from BUILD.gn so test harness can build
PeterC1965 Jul 16, 2024
f1e312d
Merge branch 'master' into EVSE_Add_Get_Set_Clear_Targets_Support
PeterC1965 Jul 16, 2024
0810f4f
Put BEGIN CI TEST ARGUMENTS around runner test arguments
PeterC1965 Jul 16, 2024
f138bc5
Fix compilation problem in unit test
PeterC1965 Jul 16, 2024
e495d37
Merge branch 'master' into EVSE_Add_Get_Set_Clear_Targets_Support
PeterC1965 Jul 16, 2024
bce6d22
Try and fix the zephyr build problems
PeterC1965 Jul 17, 2024
dc6b6dd
Restyled by gn
restyled-commits Jul 17, 2024
0778dbf
Try and fix the zephyr build problems
PeterC1965 Jul 17, 2024
a672a2b
Try and fix the zephyr build problems
PeterC1965 Jul 17, 2024
d127cd4
Try and fix the zephyr build problems
PeterC1965 Jul 18, 2024
2f4e93c
Restyled by gn
restyled-commits Jul 18, 2024
0a83d17
Merge branch 'master' into EVSE_Add_Get_Set_Clear_Targets_Support
PeterC1965 Jul 18, 2024
5d530ea
Start addressing comments from Andrei
PeterC1965 Jul 18, 2024
43406b1
Continuing addressing comments from Andrei
PeterC1965 Jul 19, 2024
36518b3
Continuing addressing comments from Andrei
PeterC1965 Jul 19, 2024
7ef59ba
Restyled by clang-format
restyled-commits Jul 19, 2024
7cf13f0
Fix a problem with the return code spotted by Boris
PeterC1965 Jul 19, 2024
c19779c
Update examples/energy-management-app/energy-management-common/src/Ch…
PeterC1965 Jul 19, 2024
303c7bf
Update examples/energy-management-app/energy-management-common/src/Ch…
PeterC1965 Jul 19, 2024
646dd41
Update examples/energy-management-app/energy-management-common/src/EV…
PeterC1965 Jul 19, 2024
9127191
Update with further review comments from Andrei
PeterC1965 Jul 20, 2024
31672a9
Update with further review comments from Andrei
PeterC1965 Jul 20, 2024
0e072bb
Update with further review comments from Andrei
PeterC1965 Jul 20, 2024
07ae8c6
Merge branch 'master' into EVSE_Add_Get_Set_Clear_Targets_Support
PeterC1965 Jul 20, 2024
81bd079
Get all targets building
PeterC1965 Jul 20, 2024
a899a88
Restyled by whitespace
restyled-commits Jul 20, 2024
33e71c6
Restyled by clang-format
restyled-commits Jul 20, 2024
a807c47
Update with further review comments from Andrei
PeterC1965 Jul 20, 2024
70b5dc8
Merge branch 'master' into EVSE_Add_Get_Set_Clear_Targets_Support
PeterC1965 Jul 22, 2024
04fdb4c
Address further review comments from Andrei
PeterC1965 Jul 22, 2024
1d4cb58
Restyled by clang-format
restyled-commits Jul 22, 2024
10f5ea0
Complete rename of Reset to ChargingTargetsMemMgr::PrepareDaySchedule
PeterC1965 Jul 22, 2024
e5f3790
Fix potential memory leak
PeterC1965 Jul 22, 2024
6013407
Add check in ChargingTargetsMemMgr::PrepareDaySchedule against a bad …
PeterC1965 Jul 23, 2024
c317ccf
Restyled by clang-format
restyled-commits Jul 23, 2024
d013648
Merge branch 'master' into EVSE_Add_Get_Set_Clear_Targets_Support
PeterC1965 Jul 24, 2024
915db4f
Merge branch 'master' into EVSE_Add_Get_Set_Clear_Targets_Support
PeterC1965 Jul 24, 2024
6dc3eaf
Address final comments from Andrei
PeterC1965 Jul 25, 2024
a643aa4
Merge branch 'master' into EVSE_Add_Get_Set_Clear_Targets_Support
PeterC1965 Jul 25, 2024
af6486e
Merge branch 'master' into EVSE_Add_Get_Set_Clear_Targets_Support
PeterC1965 Jul 25, 2024
86d7d98
Merge branch 'master' into EVSE_Add_Get_Set_Clear_Targets_Support
jamesharrow Jul 25, 2024
dd02e91
Merge branch 'upstream-master' into EVSE_Add_Get_Set_Clear_Targets_Su…
jamesharrow Jul 26, 2024
85ef217
Restyled by gn
restyled-commits Jul 26, 2024
d2b398a
Removed whitespace in openiotsdk/CMakelists.txt
jamesharrow Jul 26, 2024
2809f51
Fix merge issue
PeterC1965 Jul 26, 2024
3f3da3e
Fix CI build issue
PeterC1965 Jul 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,24 @@ using namespace chip::app::Clusters;
using namespace chip::app::Clusters::EnergyEvse;

static std::unique_ptr<EnergyEvseDelegate> gDelegate;
static std::unique_ptr<EvseTargetsDelegate> gEvseTargetsDelegate;
static std::unique_ptr<EnergyEvseManager> gInstance;

void emberAfEnergyEvseClusterInitCallback(chip::EndpointId endpointId)
{
VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
jamesharrow marked this conversation as resolved.
Show resolved Hide resolved
VerifyOrDie(!gDelegate);
VerifyOrDie(!gEvseTargetsDelegate);
VerifyOrDie(!gInstance);

gDelegate = std::make_unique<EnergyEvseDelegate>();
gEvseTargetsDelegate = std::make_unique<EvseTargetsDelegate>();
if (!gEvseTargetsDelegate)
{
ChipLogError(AppServer, "Failed to allocate memory for EvseTargetsDelegate");
return;
}

gDelegate = std::make_unique<EnergyEvseDelegate>(*gEvseTargetsDelegate);
if (gDelegate)
{
gInstance = std::make_unique<EnergyEvseManager>(
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ list(
${chip_dir}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp
${chip_dir}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
${chip_dir}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp
${chip_dir}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp

${chip_dir}/examples/platform/ameba/route_hook/ameba_route_hook.c
${chip_dir}/examples/platform/ameba/route_hook/ameba_route_table.c
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/asr/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ asr_executable("clusters_app") {
"${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp",
"${examples_plat_dir}/ButtonHandler.cpp",
"${examples_plat_dir}/CHIPDeviceManager.cpp",
"${examples_plat_dir}/LEDWidget.cpp",
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ ti_simplelink_executable("all-clusters-app") {
"${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp",
"${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp",
"${project_dir}/main/AppTask.cpp",
"${project_dir}/main/ClusterManager.cpp",
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/cc13x4_26x4/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ ti_simplelink_executable("all-clusters-app") {
"${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp",
"${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp",
"${project_dir}/main/AppTask.cpp",
"${project_dir}/main/ClusterManager.cpp",
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/infineon/psoc6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ psoc6_executable("clusters_app") {
"${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp",
"${examples_plat_dir}/LEDWidget.cpp",
"${examples_plat_dir}/init_psoc6Platform.cpp",
"src/AppTask.cpp",
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ source_set("chip-all-clusters-common") {
"${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/device-energy-management-mode.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/energy-evse-mode.cpp",
"AllClustersCommandDelegate.cpp",
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ target_sources(${APP_TARGET} PRIVATE
${ENERGY_MANAGEMENT_COMMON}/src/ElectricalPowerMeasurementDelegate.cpp
${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseDelegateImpl.cpp
${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseManager.cpp
${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseTargetsStore.cpp
${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementDelegateImpl.cpp
${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementManager.cpp

Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ target_sources(app PRIVATE
${ENERGY_MANAGEMENT_COMMON_DIR}/src/ElectricalPowerMeasurementDelegate.cpp
${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseDelegateImpl.cpp
${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseManager.cpp
${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseTargetsStore.cpp
${NRFCONNECT_COMMON}/util/LEDWidget.cpp)

chip_configure_data_model(app
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/nxp/mw320/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ mw320_executable("shell_mw320") {
"${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp",
jamesharrow marked this conversation as resolved.
Show resolved Hide resolved
"${chip_root}/src/lib/shell/streamer_mw320.cpp",
"binding-handler.cpp",
"include/CHIPProjectConfig.h",
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ rt_executable("all_cluster_app") {
sources += [
"${chip_root}/examples/${app_common_folder}/src/EnergyEvseDelegateImpl.cpp",
"${chip_root}/examples/${app_common_folder}/src/EnergyEvseManager.cpp",
"${chip_root}/examples/${app_common_folder}/src/EnergyEvseTargetStore.cpp",
"${chip_root}/examples/${app_common_folder}/src/bridged-actions-stub.cpp",
"${chip_root}/examples/${app_common_folder}/src/energy-evse-stub.cpp",
"${chip_root}/examples/${app_common_folder}/src/smco-stub.cpp",
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/openiotsdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ target_sources(${APP_TARGET}
${ENERGY_MANAGEMENT_COMMON}/src/ElectricalPowerMeasurementDelegate.cpp
${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseDelegateImpl.cpp
${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseManager.cpp
${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseTargetsStore.cpp
${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementDelegateImpl.cpp
${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementManager.cpp
)
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/telink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ target_sources(app PRIVATE
${ENERGY_MANAGEMENT_COMMON_DIR}/src/ElectricalPowerMeasurementDelegate.cpp
${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseDelegateImpl.cpp
${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseManager.cpp
${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseTargetsStore.cpp
${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementDelegateImpl.cpp
${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementManager.cpp
${TELINK_COMMON}/common/src/mainCommon.cpp
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/tizen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ source_set("chip-all-clusters-common") {
"${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp",
]

deps = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "app/clusters/energy-evse-server/energy-evse-server.h"
#include <EVSECallbacks.h>
#include <EnergyEvseTargetsStore.h>

#include <app/util/af.h>
#include <app/util/config.h>
Expand Down Expand Up @@ -108,6 +109,7 @@ class EvseSession
class EnergyEvseDelegate : public EnergyEvse::Delegate
{
public:
EnergyEvseDelegate(EvseTargetsDelegate & aDelegate) : EnergyEvse::Delegate() { mEvseTargetsDelegate = &aDelegate; }
~EnergyEvseDelegate();

/**
Expand Down Expand Up @@ -139,6 +141,46 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
*/
Status StartDiagnostics() override;

/**
* @brief Called when EVSE cluster receives the SetTargets command
*/
Status SetTargets(
const DataModel::DecodableList<Structs::ChargingTargetScheduleStruct::DecodableType> & chargingTargetSchedules) override;

EvseTargetsDelegate * GetEvseTargetsDelegate() { return mEvseTargetsDelegate; }

/**
* @brief Delegate should implement a handler to PrepareGetTargets
*
* This needs to load any stored targets into memory and hold it until the GetTargetsFinished is
* called by the cluster server.
*
* @param Reference to EvseTargetIterator class that implements the ability
jamesharrow marked this conversation as resolved.
Show resolved Hide resolved
* for the cluster server to iterate through the target entries
*/
CHIP_ERROR PrepareGetTargets(EvseTargetIterator ** iterator) override;

/**
* @brief Delegate should implement a handler to GetTargetsFinished
*
* This is used by the cluster server to indicate it has finished preparing
* the GetTargetsResponse using the iterator and that the memory in the delegate can
* freed
*/
CHIP_ERROR GetTargetsFinished() override;

/**
* @brief Called when EVSE cluster receives ClearTargets command
*/
Status ClearTargets() override;

/* Helper functions for managing targets*/
jamesharrow marked this conversation as resolved.
Show resolved Hide resolved
Status
ValidateTargets(const DataModel::DecodableList<Structs::ChargingTargetScheduleStruct::DecodableType> & chargingTargetSchedules);

Status
SaveTargets(const DataModel::DecodableList<Structs::ChargingTargetScheduleStruct::DecodableType> & chargingTargetSchedules);

/**
* @brief Called by EVSE Hardware to register a single callback handler
*/
Expand Down Expand Up @@ -317,6 +359,9 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate

/* Helper variable to hold meter val since last EnergyTransferStarted event */
int64_t mMeterValueAtEnergyTransferStart;

/* Targets Delegate */
EvseTargetsDelegate * mEvseTargetsDelegate = nullptr;
};

} // namespace EnergyEvse
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/*
*
* Copyright (c) 2024 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#include <app/clusters/energy-evse-server/energy-evse-server.h>
#include <lib/core/CHIPError.h>
#include <lib/core/CHIPPersistentStorageDelegate.h>
#include <lib/support/CodeUtils.h>
#include <lib/support/CommonIterator.h>
#include <lib/support/Pool.h>

#include <app-common/zap-generated/cluster-objects.h>
#include <vector>

namespace chip {
namespace app {
namespace Clusters {
namespace EnergyEvse {

class EvseTargetIteratorImpl;
class EvseTargetsDelegate
{
public:
using EvseTargetIterator = CommonIterator<EvseTargetEntry>;

~EvseTargetsDelegate();

CHIP_ERROR Init(PersistentStorageDelegate * targetStore);
EvseTargetIteratorImpl * GetEvseTargetsIterator();
CHIP_ERROR Load(std::vector<EvseTargetEntry> & targetEntryVector, size_t & targetsSize);

CHIP_ERROR IncreaseEntryCount();
CHIP_ERROR DecreaseEntryCount();
CHIP_ERROR UpdateEntryCount(bool increase);
CHIP_ERROR LoadCounter(size_t & count, size_t & targetsSize);
CHIP_ERROR SerializeToTlv(TLV::TLVWriter & writer, const std::vector<EvseTargetEntry> & targetEntryVector);

/**
* @brief Copies a ChargingTargetSchedule into our store
*
* @param [in] an entry from the SetTargets list containing:
* dayOfWeekForSequence and chargingTargets (list)
*
* This routine scans the existing mTargets to see if we have a day of week
* set that matches the new target dayOfWeek bits. If there is an existing
* matching day then it replaces the days existing targets with the new entry
*/
CHIP_ERROR
CopyTarget(const Structs::ChargingTargetScheduleStruct::DecodableType &);

/**
* @brief This deletes all targets and resets the list to empty
*/
CHIP_ERROR ClearTargets();

static constexpr size_t MaxTargetEntryCounterSize()
{
// All the fields added together
return TLV::EstimateStructOverhead(sizeof(size_t), sizeof(size_t));
}

static constexpr size_t MaxTargetEntrySize()
{
// All the fields added together
return TLV::EstimateStructOverhead(sizeof(chip::BitMask<TargetDayOfWeekBitmap>)) +
kEvseTargetsMaxNumberOfDays *
TLV::EstimateStructOverhead(sizeof(uint16_t), sizeof(Optional<chip::Percent>), sizeof(Optional<int64_t>));
}

protected:
enum class TargetEntryTag : uint8_t
{
kTargetEntry = 1,
kDayOfWeek = 2,
kChargingTargetsList = 3,
kChargingTargetsStruct = 4,
kTargetTime = 5,
kTargetSoC = 6,
kAddedEnergy = 7,
};

enum class CounterTag : uint8_t
{
kCount = 1,
kSize = 2,
};

private:
// The array itself has a control byte and an end-of-array marker.
static constexpr size_t kArrayOverHead = 2;

EvseTargetIteratorImpl * mEvseTargetsIterator = nullptr;
PersistentStorageDelegate * mpTargetStore = nullptr;
jamesharrow marked this conversation as resolved.
Show resolved Hide resolved
};

using EvseTargetIterator = CommonIterator<EvseTargetEntry>;
class EvseTargetIteratorImpl : public EvseTargetIterator
{
public:
EvseTargetIteratorImpl(EvseTargetsDelegate & aDelegate) : mDelegate(aDelegate)
{
mTargetEntryIndex = 0;
mTargetEntryVector.clear();
}
size_t Count() override;
bool Next(EvseTargetEntry & entry) override;
void Release() override;
CHIP_ERROR Load();

private:
EvseTargetsDelegate & mDelegate;
size_t mTargetEntryIndex = 0;
std::vector<EvseTargetEntry> mTargetEntryVector;
};

} // namespace EnergyEvse
} // namespace Clusters
} // namespace app
} // namespace chip
Loading
Loading