Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -2851,7 +2851,7 @@ endpoint 0 {
callback attribute acceptedCommandList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;

handle command RegisterClient;
handle command RegisterClientResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8272,7 +8272,7 @@ endpoint 0 {
callback attribute acceptedCommandList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;
}

server cluster RelativeHumidityMeasurement {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2128,7 +2128,7 @@ endpoint 0 {
callback attribute acceptedCommandList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;

handle command RegisterClient;
handle command RegisterClientResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2009,7 +2009,7 @@ endpoint 0 {
callback attribute acceptedCommandList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;
}
}
endpoint 1 {
Expand Down
2 changes: 1 addition & 1 deletion examples/closure-app/closure-common/closure-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2424,7 +2424,7 @@ endpoint 0 {
callback attribute acceptedCommandList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;
}
}
endpoint 1 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2270,7 +2270,7 @@ endpoint 0 {
callback attribute acceptedCommandList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;
}
}
endpoint 1 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2132,7 +2132,7 @@ endpoint 0 {
callback attribute acceptedCommandList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;
}
}
endpoint 1 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2326,7 +2326,7 @@ endpoint 0 {
callback attribute acceptedCommandList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;

handle command RegisterClient;
handle command RegisterClientResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2172,7 +2172,7 @@ endpoint 0 {
callback attribute acceptedCommandList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;

handle command RegisterClient;
handle command RegisterClientResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2165,7 +2165,7 @@ endpoint 0 {
callback attribute acceptedCommandList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;
}
}
endpoint 1 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3272,7 +3272,7 @@ endpoint 0 {
callback attribute operatingMode;
callback attribute maximumCheckInBackOff;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;

handle command RegisterClient;
handle command RegisterClientResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3388,7 +3388,7 @@ endpoint 0 {
callback attribute activeModeDuration;
callback attribute activeModeThreshold;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;
}
}
endpoint 1 {
Expand Down
2 changes: 1 addition & 1 deletion examples/light-switch-app/qpg/zap/switch.matter
Original file line number Diff line number Diff line change
Expand Up @@ -3198,7 +3198,7 @@ endpoint 0 {
callback attribute acceptedCommandList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;

handle command RegisterClient;
handle command RegisterClientResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2882,7 +2882,7 @@ endpoint 0 {
callback attribute activeModeDuration;
callback attribute activeModeThreshold;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;
}
}
endpoint 1 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3038,7 +3038,7 @@ endpoint 0 {
callback attribute activeModeDuration;
callback attribute activeModeThreshold;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;
}
}
endpoint 1 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3038,7 +3038,7 @@ endpoint 0 {
callback attribute activeModeDuration;
callback attribute activeModeThreshold;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;
}
}
endpoint 1 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2794,7 +2794,7 @@ endpoint 0 {
callback attribute activeModeDuration;
callback attribute activeModeThreshold;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;
}
}
endpoint 1 {
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/qpg/zap/light.matter
Original file line number Diff line number Diff line change
Expand Up @@ -3214,7 +3214,7 @@ endpoint 0 {
callback attribute acceptedCommandList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;
}
}
endpoint 1 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2360,7 +2360,7 @@ endpoint 0 {
callback attribute acceptedCommandList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;

handle command RegisterClient;
handle command RegisterClientResponse;
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/lock-common/lock-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -3252,7 +3252,7 @@ endpoint 0 {
callback attribute activeModeDuration;
callback attribute activeModeThreshold;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;
}
}
endpoint 1 {
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/nxp/zap/lock-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2826,7 +2826,7 @@ endpoint 0 {
callback attribute acceptedCommandList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 1;
callback attribute clusterRevision;
}
}
endpoint 1 {
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/qpg/zap/lock.matter
Original file line number Diff line number Diff line change
Expand Up @@ -3191,7 +3191,7 @@ endpoint 0 {
callback attribute acceptedCommandList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;
}
}
endpoint 1 {
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/realtek/data_model/lock-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2799,7 +2799,7 @@ endpoint 0 {
callback attribute activeModeDuration;
callback attribute activeModeThreshold;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;
}
}
endpoint 1 {
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/silabs/data_model/lock-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -3256,7 +3256,7 @@ endpoint 0 {
callback attribute activeModeDuration;
callback attribute activeModeThreshold;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;
}
}
endpoint 1 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2584,7 +2584,7 @@ endpoint 0 {
callback attribute acceptedCommandList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;

handle command RegisterClient;
handle command RegisterClientResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3003,7 +3003,7 @@ endpoint 0 {
callback attribute acceptedCommandList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;
}
}
endpoint 1 {
Expand Down
2 changes: 1 addition & 1 deletion examples/window-app/common/window-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2780,7 +2780,7 @@ endpoint 0 {
callback attribute acceptedCommandList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 3;
callback attribute clusterRevision;
}
}
endpoint 1 {
Expand Down
1 change: 1 addition & 0 deletions src/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ if (chip_build_tests) {
"${chip_root}/src/app/clusters/general-commissioning-server/tests",
"${chip_root}/src/app/clusters/general-diagnostics-server/tests",
"${chip_root}/src/app/clusters/group-key-mgmt-server/tests",
"${chip_root}/src/app/clusters/icd-management-server/tests",
"${chip_root}/src/app/clusters/network-commissioning/tests",
"${chip_root}/src/app/clusters/ota-provider/tests",
"${chip_root}/src/app/clusters/software-diagnostics-server/tests",
Expand Down
13 changes: 11 additions & 2 deletions src/app/clusters/icd-management-server/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,22 @@ import("${chip_root}/src/app/icd/icd.gni")

# transitional dependencies so that chip_data_model sets
# the right dependencies
group("icd-management-server") {
source_set("icd-management-server") {
sources = [
"ICDManagementCluster.cpp",
"ICDManagementCluster.h",
]
public_deps = [
"${chip_root}/src/app/icd/server:configuration-data",
"${chip_root}/src/app/icd/server:icd-server-config",
"${chip_root}/src/app/icd/server:observer",
"${chip_root}/src/app/server-cluster",
]
if (chip_enable_icd_server) {
public_deps += [ "${chip_root}/src/app/icd/server:notifier" ]
public_deps += [
"${chip_root}/src/app/icd/server:notifier",
"${chip_root}/src/app/server",
]
if (chip_enable_icd_checkin) {
public_deps += [ "${chip_root}/src/app/icd/server:monitoring-table" ]
}
Expand Down
116 changes: 116 additions & 0 deletions src/app/clusters/icd-management-server/CodegenIntegration.cpp
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);
}
Loading
Loading