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

Add Resource Monitoring Cluster Implementation #27798

Merged
merged 159 commits into from
Jul 20, 2023
Merged

Add Resource Monitoring Cluster Implementation #27798

merged 159 commits into from
Jul 20, 2023

Conversation

tobiasgraf
Copy link
Contributor

@tobiasgraf tobiasgraf commented Jul 7, 2023

📖 Description

This adds server implementation for the aliased resource-monitoring-cluster HepaFilterMonitoring and ActivatedCarbonFilterMonitoring.

❗This depends on these PRs and should be merged after them ✅

🔎 Details

This uses the alias concept, I tried to stay as close as possible to the mode-base implementation #27504 .

🧪 How Has This Been Tested

  • All-cluster app compiled and run,
  • chip-tool compiled and run
  • run test cases using chip-tool against all-cluster-app and resource-monitoring-example-app

🔗 Links/References

Closes #27216
Closes #27986

tobiasgraf and others added 30 commits June 5, 2023 16:03
…eMonitoring defines

- using `using`
- and adding by hand
Add cluster-objects.h / cpp instead of defining it inside the server.h / cpp
- have External Attribute Storage inside Instances
- implement getters and Setters for Attributes
- also clean up some namespaces
Also add basic OnResetCondition implementation.
…e to take the required attribute information directly rather than as a EmberAfAttributeMetadata structure.
…nation

# Conflicts:
#	src/app/zap-templates/zcl/zcl-with-test-extensions.json
#	src/app/zap-templates/zcl/zcl.json
#	zzz_generated/app-common/app-common/zap-generated/callback.h
…r-definition' into add-replaceable-monitoring-cluster-implemenation

# Conflicts:
#	zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp
#	zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h
@github-actions github-actions bot removed the scripts label Jul 19, 2023
tobiasgraf and others added 5 commits July 19, 2023 19:19
…itoring-cluster-implemenation

# Conflicts:
#	src/app/tests/suites/certification/Test_TC_CFREMON_1_1.yaml
#	src/app/tests/suites/certification/Test_TC_CFREMON_2_1.yaml
#	src/app/tests/suites/certification/Test_TC_ESFREMON_1_1.yaml
#	src/app/tests/suites/certification/Test_TC_ESFREMON_2_1.yaml
#	src/app/tests/suites/certification/Test_TC_FTREMON_1_1.yaml
#	src/app/tests/suites/certification/Test_TC_FTREMON_2_1.yaml
#	src/app/tests/suites/certification/Test_TC_INKCREMON_1_1.yaml
#	src/app/tests/suites/certification/Test_TC_INKCREMON_2_1.yaml
#	src/app/tests/suites/certification/Test_TC_IONFREMON_1_1.yaml
#	src/app/tests/suites/certification/Test_TC_IONFREMON_2_1.yaml
#	src/app/tests/suites/certification/Test_TC_OZFREMON_1_1.yaml
#	src/app/tests/suites/certification/Test_TC_OZFREMON_2_1.yaml
#	src/app/tests/suites/certification/Test_TC_TCREMON_1_1.yaml
#	src/app/tests/suites/certification/Test_TC_TCREMON_2_1.yaml
#	src/app/tests/suites/certification/Test_TC_UVFREMON_1_1.yaml
#	src/app/tests/suites/certification/Test_TC_UVFREMON_2_1.yaml
#	src/app/tests/suites/certification/Test_TC_WTREMON_1_1.yaml
#	src/app/tests/suites/certification/Test_TC_WTREMON_2_1.yaml
#	src/app/tests/suites/certification/Test_TC_ZEOFREMON_1_1.yaml
#	src/app/tests/suites/certification/Test_TC_ZEOFREMON_2_1.yaml
#	zzz_generated/chip-tool/zap-generated/test/Commands.h
…itoring-cluster-implemenation

# Conflicts:
#	examples/all-clusters-app/all-clusters-common/all-clusters-app.matter
#	examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
#	zzz_generated/app-common/app-common/zap-generated/callback.h
@mergify mergify bot merged commit 78c62b0 into project-chip:master Jul 20, 2023
@tobiasgraf tobiasgraf deleted the add-replaceable-monitoring-cluster-implemenation branch July 20, 2023 22:58
erwinpan1 pushed a commit to erwinpan1/connectedhomeip that referenced this pull request Jul 21, 2023
* Add Basic Resource Monitoring Server Implementation

* Add Basic Working Resource Monitoring Example App

* Improve log output

* Replace some HepafilterMonitoring specifics with more general ResourceMonitoring defines

- using `using`
- and adding by hand

* Apply clang-format

* More Hepa to ResourceMonitoring replacement

* Add ActivatedCarbonFilterMonitoring Cluster

* Rename ActivatedCarbonFilterMonitoring.cpp to ActivatedCarbonFilterMonitoringDelegate.cpp

* Split delegate definitions into separate files

* Cleanup some Headers

* Rename member variables

* Refactoring: Rename Delegate to Instance

Add cluster-objects.h / cpp instead of defining it inside the server.h / cpp

* Refactoring: Implement Read and Write function

- have External Attribute Storage inside Instances
- implement getters and Setters for Attributes

* Refactoring: reorder methods to math the order in the .h file

* Run Clang-Format

* Add Getter for DegradationDirection Attribute

- also clean up some namespaces

* Add Construction Option To Set OnResetCondition To Supported

Also add basic OnResetCondition implementation.

* Add Default Values

* Modified the AttributePersistenceProvider ReadValue function signiture to take the required attribute information directly rather than as a EmberAfAttributeMetadata structure.

* Force External Storage for All Resource Monitoring Clusters

* Force External Storage for All Resource Monitoring Clusters

Regenerated Code

* Expanded AttributePersistanceProvider API to include reading and wirting of uint8 and nullable uint8

* Add LastChangedTime to Attributes For ResourceMonitoring Clusters

* Add LastChangedTime to Attributes For ResourceMonitoring Clusters

Regenerated Code

* Add `LastChangedTime` to Forced External Storage List For Resource Monitoring

* Add LastChangedTime To Resource-Monitoring Server Implementation

* Templated the AttributePersistanceProvider read and wiret function to work for all uint types.

* Fixed AttributePersistanceProvider accepted types. Added read helper for type bool.

* Restyled by clang-format

* Formatting and some comments

* Make OnResetCondition Pure Virtual

And remove implementation from resource-monitor-server.cpp.
It's not allowed to use the resource-monitoring-server::instance without deriving it yourself.

* Set LastChangedTime In the OnResetCondition Handler

* Fixed mismatched size return error of DefaultAttributePersistenceProvider

* Add All Missing Aliased Clusters

- CeramicFilterMonitoring
- ElectrostaticFilterMonitoring
- FuelTankMonitoring
- InkCartridgeMonitoring
- IonizingFilterMonitoring
- OzoneFilterMonitoring
- TonerCartridgeMonitoring
- UvFilterMonitoring
- WaterTankMonitoring
- ZeoliteFilterMonitoring

* Started work on tests for the AttributePersistenceProvider.

* Add Missing Instances to resourceMonitoring Test App

* Add Persistent Storage To LastChangedTime

* Add README.md

* Remove `ResourceMonitoringAliasesInstanceMap` as it wasn't really needed

* Update Description Of Init()

* Update Description of AppInit() and OnResetCondition()

* Added unit tests for AttributePersistenceProvider testing the storage and retrival of all unsigned types and their nullable veriaties, bool and ByteSpan. Tested for small buffer errors.

* Changed the type of aSize in ReadValue to size_t

* Removed the dependancy on generated code in the AttributePersistencezprovider.h

* Added static funtctions to get the KVS null representation for different types.

* Fix Errors after Merge

* Some Changes From Comments From The ModeBase PR

* Added functions to read and write nullable bools and accompanying tests.

* Incorporated boolean tests in the scalar test.

* Added failure before init test

* Restyled by clang-format

* Move Headers To Resource-Monitoring-Common

* Move Cpp files To resource-monitor-common

* Remove All Unused Aliases For The Resource-Monitoring-Cluster

this was decided in the AirQuality Call on 06.07.2023

* Fixed after merge.

* Removed the failure on init test as it may have been causing seg faults in some tests.

* Renamed GetNull -> GetNullValueForNullableType

* Added the initialisation of valueReadBack and added a new templated function for nullable types to avoid the error: The left operand of '==' is a garbage value, on some platforms.

* Added handline of signed ints and accompanying tests.

* Added handline of nullable signed ints and accompanying tests.

* Type cast null.

* Restyled by clang-format

* Changed shift bit to be af the same type are the return val.

* Added tests got GetNull functions

* Remove Aliased Clusters From Resource Monitoring Clusters except Hepa and ActivatedCarbon

enable LastChangedTime for Hepa and ActivatedCarbon

* Add Resource Monitoring Aliased Clusters Server implementation To Linux All-Clusters-App

* Remove Todo

* Remove Aliased Clusters From Resource Monitoring Clusters except Hepa and ActivatedCarbon

* Remove Redundant Check

apparently it's not necessary / allow to check this

* Apply Restyled patch

* Remove Tests For Removed Aliased Clusters

- all except Hepa and ActivatedCarbon

* Fix Spelling

* Remove Unused / disallowed #include <maps>

* Remove resource-monitoring-instances.h

* Remove Unneeded Destructors

* Use Default Descructor and Make Class Non copyable or moveable

* Change IsAliascluster to IsValidAliasCluster

* Fix Typo

* Reset ChangeIndication Attribute On ResetCondition Command

Spec requires this to be reset as well

* Set FeatureMap To 3

For testing with Warning Feature enabled

* Rename mFeature To mFeatureMap

* Rewrite Some Comments From "function" to "method"

* Remove Const

* Update Comment Of Init() Method

added the exact CHIP_ERROR_XXX that this can return.

* Remove Commented Code

* Added TODO For REP Feature

* Change From "Next value" To "UINT8_MAX"

* Use ChipLogDetail Instead Of ChipLogError

* Fix Log on Some Platforms

On some platforms (e.g. ASR) uint32_t seems to be a long and will produce a error if %u is used. So cast it to unsinged long on all platforms and use %lu.

* Update README.md For Linux Resource-Monitoring-Example-App

* Remove Aliased Clusters From Resource Monitoring Clusters except Hepa and ActivatedCarbon

* Regen Code

* Apply Restylerd Patch

* Update Wordlist

- Add HEPA

* Remove PICS values For Resource Monitoring Clusters That Were Removed

* Remove PICS For Resource Monitoring Clusters from PICS.yaml

* Add Resource Monitoring README.md To docs/examples/index.md

* Remove redundant chip::app:: prefixes

* Use Bitset Instead Of Just a Number For FeatureMap

* Remove Options from CHIPProjectAppConfig.h

not needed or wrong

* Remove network commissioning bits

As of earlier today that's handled by AppInit. Which is good, because the bits here are buggy.

* Make Hepa And ActivateCarbon Filter Monitoring Instances Static

* Remove ClusterId From Specialized Hepa and Activated Carbon Construtors

They should know their cluster ids, and now they do!

* Add Getter for Endpoint

* Remove Nonsense Comment

* Remove Aliased Cluster IDs That Got Removed

* Fix Typo

* Simplify HandleResetCondition Method

* Add Copyright

* Sort out Includes

Add what is needed using "include what you use" tool

* Make Methods To Private

and move private section to bottom instead of in between

* Initialize All The Member Varaibles With Initializer List

also updated the comment with the new parameters

* Explicit Delete Move Constructors

* Make More Methods To Private

* Update Comment For OnResetCondition Command Handler

* Add FeatureMap To Zcl*.json Files

* Apply restyled Patch

* Remove ResetCondtion::Type And Encode

they are only needed for sending the command, it does not send the command.

* Remove While Loop's Body

is a very complicated no-op. Keep the while itself, it basically check if this is not malformed TLV

* Move OnResetCondition Handling to Cluster Implementation

- add PreResetCondition and PostResetCondition() methods to be overwritten

fixes project-chip#27986

* Apply Restyled Patch

* Fix Typo

* Remove Init For Resource Monitoring Clusters From main-common.cpp

And put it in resource-monitoring-helper.cpp.
This will use the ClusterInitCallbacks to initialize the instance objects.

This removes the need to have the init code in every example app, just include the helper.cpp file.

* Apply Restyled Patch

* Update examples/resource-monitoring-app/linux/src/main.cpp

Co-authored-by: Cliff Chung <[email protected]>

* Update examples/resource-monitoring-app/linux/src/main.cpp

Co-authored-by: Cliff Chung <[email protected]>

* Fix Some Typos

* Disable Removed Test Cases

* Apply Restylerd Patch

* Apply Restyled Patch

* Add Resource-Monitoring-Server To ESP32 All Clusters Example

* Remove Test Scripts For Aliased Clusters

* Revert "Disable Removed Test Cases"

This reverts commit 34e6355.

* Add VerifyOrDie() When More Than 1 EP gets Initialized For Hepa Or Activated Carbon Filter Monitoring

* Add Resource-Monitoring Clusters To ESP32 Minimal App

* Apply Restyled Patch

* Move Resource-Monitoring Instances/Delegates To All-Clusters-Common

to avoid having to include multiple directories and source code from another example app.

* Apply Restyled Patch

* Update Code Gen

* Fix Zap After Merge + CodeGen

---------

Co-authored-by: William Hicklin <[email protected]>
Co-authored-by: William <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: Cliff Chung <[email protected]>
Co-authored-by: Cliff Chung <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app documentation Improvements or additions to documentation examples review - approved tests
Projects
None yet
9 participants