-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[Part3] Decouple ICD Management cluster to be code driven. #41499
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
Open
jadhavrohit924
wants to merge
14
commits into
project-chip:master
Choose a base branch
from
jadhavrohit924:icd_management/code
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+803
−402
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
1b37a37
Decouple ICD Management cluster to be code driven.
jadhavrohit924 92a0120
Add cluster to decoupled list.
jadhavrohit924 d23e085
Add codegen integration
jadhavrohit924 aa3ebbc
Add unit tests
jadhavrohit924 23fb641
Zap regen
jadhavrohit924 d038275
Restyler
jadhavrohit924 9dcd148
Addressed review comments.
jadhavrohit924 1ee2430
Fix CI
jadhavrohit924 1122602
Refactor the cluster implementation.
jadhavrohit924 e2136c5
Reorder member varible for memory holes, validated buffer size before…
jadhavrohit924 d275210
Rebase and zap regen
jadhavrohit924 94c3562
Rebase
jadhavrohit924 a785235
Zap regen
jadhavrohit924 1f21fb9
Address copilot review
jadhavrohit924 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
src/app/clusters/icd-management-server/CodegenIntegration.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| /** | ||
| * | ||
| * Copyright (c) 2025 Project CHIP Authors | ||
| * | ||
| * 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. | ||
| */ | ||
|
|
||
| #include <app-common/zap-generated/attributes/Accessors.h> | ||
| #include <app/clusters/icd-management-server/ICDManagementCluster.h> | ||
| #include <app/server/Server.h> | ||
| #include <app/static-cluster-config/IcdManagement.h> | ||
| #include <data-model-providers/codegen/ClusterIntegration.h> | ||
| #include <zap-generated/gen_config.h> | ||
|
|
||
| namespace { | ||
| using namespace chip; | ||
| using namespace chip::app; | ||
| using namespace chip::app::Clusters; | ||
| using namespace chip::app::Clusters::IcdManagement; | ||
|
|
||
| static_assert((IcdManagement::StaticApplicationConfig::kFixedClusterConfig.size() == 1 && | ||
| IcdManagement::StaticApplicationConfig::kFixedClusterConfig[0].endpointNumber == kRootEndpointId) || | ||
| IcdManagement::StaticApplicationConfig::kFixedClusterConfig.size() == 0); | ||
|
|
||
| #if CHIP_CONFIG_ENABLE_ICD_CIP | ||
| LazyRegisteredServerCluster<ICDManagementClusterWithCIP> gServer; | ||
| #else | ||
| LazyRegisteredServerCluster<ICDManagementCluster> gServer; | ||
| #endif | ||
|
|
||
| constexpr chip::BitMask<OptionalCommands> kEnabledCommands() | ||
| { | ||
| #if defined(ICD_MANAGEMENT_STAY_ACTIVE_REQUEST_COMMAND) | ||
| return chip::BitMask<OptionalCommands>(kStayActive); | ||
| #else | ||
| return chip::BitMask<OptionalCommands>(); | ||
| #endif | ||
| } | ||
|
|
||
| class IntegrationDelegate : public CodegenClusterIntegration::Delegate | ||
| { | ||
| public: | ||
| ServerClusterRegistration & CreateRegistration(EndpointId endpointId, unsigned clusterInstanceIndex, | ||
| uint32_t optionalAttributeBits, uint32_t featureMap) override | ||
| { | ||
| ICDManagementCluster::OptionalAttributeSet optionalAttributeSet(optionalAttributeBits); | ||
| constexpr BitMask<OptionalCommands> enabledCommands = kEnabledCommands(); | ||
|
|
||
| // Get UserActiveModeTriggerHint | ||
| BitMask<IcdManagement::UserActiveModeTriggerBitmap> userActiveModeTriggerHint(0); | ||
| if (Clusters::IcdManagement::Attributes::UserActiveModeTriggerHint::Get(endpointId, &userActiveModeTriggerHint) != | ||
| Protocols::InteractionModel::Status::Success) | ||
| { | ||
| ChipLogError(Zcl, "Failed to get UserActiveModeTriggerHint, using default (0)"); | ||
| userActiveModeTriggerHint.ClearAll(); | ||
| } | ||
|
|
||
| // Get UserActiveModeTriggerInstruction | ||
| char instructionBuffer[kUserActiveModeTriggerInstructionMaxLength]; | ||
| MutableCharSpan instructionSpan(instructionBuffer); | ||
|
|
||
| if (Clusters::IcdManagement::Attributes::UserActiveModeTriggerInstruction::Get(endpointId, instructionSpan) != | ||
| Protocols::InteractionModel::Status::Success) | ||
| { | ||
| ChipLogError(Zcl, "Failed to get UserActiveModeTriggerInstruction, using default (empty string)"); | ||
| instructionSpan = MutableCharSpan(); | ||
| } | ||
|
|
||
| gServer.Create(endpointId, *Server::GetInstance().GetSessionKeystore(), Server::GetInstance().GetFabricTable(), | ||
| ICDConfigurationData::GetInstance(), optionalAttributeSet, enabledCommands, userActiveModeTriggerHint, | ||
| instructionSpan); | ||
| return gServer.Registration(); | ||
| } | ||
|
|
||
| ServerClusterInterface * FindRegistration(unsigned clusterInstanceIndex) override { return &gServer.Cluster(); } | ||
| void ReleaseRegistration(unsigned clusterInstanceIndex) override { gServer.Destroy(); } | ||
| }; | ||
| } // namespace | ||
|
|
||
| void MatterIcdManagementClusterInitCallback(EndpointId endpointId) | ||
| { | ||
| IntegrationDelegate integrationDelegate; | ||
| CodegenClusterIntegration::RegisterServer( | ||
| { | ||
| .endpointId = endpointId, | ||
| .clusterId = IcdManagement::Id, | ||
| .fixedClusterInstanceCount = static_cast<uint16_t>(IcdManagement::StaticApplicationConfig::kFixedClusterConfig.size()), | ||
| .maxClusterInstanceCount = 1, // only root-node functionality supported by this implementation | ||
| .fetchFeatureMap = false, | ||
| .fetchOptionalAttributes = true, | ||
| }, | ||
| integrationDelegate); | ||
| } | ||
|
|
||
| void MatterIcdManagementClusterShutdownCallback(EndpointId endpointId) | ||
| { | ||
| IntegrationDelegate integrationDelegate; | ||
| CodegenClusterIntegration::UnregisterServer( | ||
| { | ||
| .endpointId = endpointId, | ||
| .clusterId = IcdManagement::Id, | ||
| .fixedClusterInstanceCount = static_cast<uint16_t>(IcdManagement::StaticApplicationConfig::kFixedClusterConfig.size()), | ||
| .maxClusterInstanceCount = 1, // only root-node functionality supported by this implementation | ||
| }, | ||
| integrationDelegate); | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.