From 22185648f5958db64ac154426c5c49fcc9bcc898 Mon Sep 17 00:00:00 2001 From: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> Date: Mon, 9 Jan 2023 12:53:34 -0500 Subject: [PATCH] [ICD] Implements initial version of the Client Monitoring Cluster (#24284) * Initial implementation of the CM cluster * Update function calls * Add Yaml tests for cluster * remove unwanted changes * generated files * Address review comments * restyler * zap regen error * add cm table source file to cmake build * fix android build * add CM to descriptor cluster test * fix esp build * fix CI nit * fix typo --- .../all-clusters-app.matter | 43 + .../all-clusters-common/all-clusters-app.zap | 217 ++++- .../esp32/main/CMakeLists.txt | 1 + .../light-switch-common/light-switch-app.zap | 225 ++++- src/app/chip_data_model.cmake | 1 + src/app/chip_data_model.gni | 2 + .../client-monitoring-server.cpp | 163 +++- .../client-monitoring-server.h | 14 + .../TestClientMonitoringRegistrationTable.cpp | 21 + .../suites/TestClientMonitoringCluster.yaml | 102 +++ .../tests/suites/TestDescriptorCluster.yaml | 1 + src/app/tests/suites/ciTests.json | 3 +- .../ClientMonitoringRegistrationTable.cpp | 10 + .../util/ClientMonitoringRegistrationTable.h | 20 +- .../chip/client-monitoring-cluster.xml | 9 +- src/controller/data_model/BUILD.gn | 2 + .../data_model/controller-clusters.matter | 32 + .../data_model/controller-clusters.zap | 214 +++++ .../CHIPAttributeTLVValueDecoder.cpp | 214 +++++ .../java/zap-generated/CHIPCallbackTypes.h | 19 + .../CHIPEventTLVValueDecoder.cpp | 10 + .../java/zap-generated/CHIPReadCallbacks.cpp | 319 +++++++ .../java/zap-generated/CHIPReadCallbacks.h | 122 +++ .../chip/devicecontroller/ChipClusters.java | 225 +++++ .../chip/devicecontroller/ChipIdLookup.java | 36 + .../chip/devicecontroller/ChipStructs.java | 30 + .../devicecontroller/ClusterInfoMapping.java | 158 ++++ .../devicecontroller/ClusterReadMapping.java | 134 +++ .../devicecontroller/ClusterWriteMapping.java | 2 + .../python/chip/clusters/CHIPClusters.py | 80 ++ .../python/chip/clusters/Objects.py | 20 +- .../MTRAttributeTLVValueDecoder.mm | 171 ++++ .../CHIP/zap-generated/MTRBaseClusters.h | 149 ++++ .../CHIP/zap-generated/MTRBaseClusters.mm | 536 +++++++++++ .../zap-generated/MTRBaseClusters_Internal.h | 5 + .../CHIP/zap-generated/MTRCallbackBridge.h | 144 +++ .../CHIP/zap-generated/MTRCallbackBridge.mm | 156 ++++ .../CHIP/zap-generated/MTRClusterConstants.h | 3 +- .../CHIP/zap-generated/MTRClusters.h | 50 ++ .../CHIP/zap-generated/MTRClusters.mm | 318 +++++++ .../CHIP/zap-generated/MTRClusters_Internal.h | 5 + .../zap-generated/MTRCommandPayloadsObjc.h | 23 + .../zap-generated/MTRCommandPayloadsObjc.mm | 32 + .../zap-generated/MTREventTLVValueDecoder.mm | 10 + .../zap-generated/IMClusterCommandHandler.cpp | 51 ++ .../all-clusters-app/zap-generated/access.h | 6 + .../zap-generated/endpoint_config.h | 250 +++--- .../zap-generated/gen_config.h | 6 + .../app-common/zap-generated/callback.h | 6 + .../zap-generated/cluster-objects.cpp | 41 + .../zap-generated/cluster-objects.h | 40 + .../app-common/zap-generated/command-id.h | 3 +- .../app-common/zap-generated/ids/Commands.h | 6 +- .../zap-generated/cluster/Commands.h | 50 +- .../cluster/logging/DataModelLogger.cpp | 53 ++ .../chip-tool/zap-generated/test/Commands.h | 199 ++++- .../zap-generated/CHIPClientCallbacks.h | 10 + .../zap-generated/CHIPClusters.h | 9 + .../zap-generated/endpoint_config.h | 15 +- .../zap-generated/gen_config.h | 5 + .../zap-generated/cluster/Commands.h | 833 ++++++++++++++++++ .../zap-generated/test/Commands.h | 357 +++++++- 62 files changed, 5835 insertions(+), 156 deletions(-) create mode 100644 src/app/tests/suites/TestClientMonitoringCluster.yaml diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index dd31241881832e..e47d6c41fef035 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -3548,6 +3548,37 @@ server cluster ElectricalMeasurement = 2820 { readonly attribute int16u clusterRevision = 65533; } +server cluster ClientMonitoring = 4166 { + fabric_scoped struct MonitoringRegistration { + node_id clientNodeId = 1; + int64u ICid = 2; + fabric_idx fabricIndex = 254; + } + + readonly attribute int32u idleModeInterval = 0; + readonly attribute int32u activeModeInterval = 1; + readonly attribute int16u activeModeThreshold = 2; + readonly attribute MonitoringRegistration expectedClients[] = 3; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct RegisterClientMonitoringRequest { + node_id clientNodeId = 0; + INT64U ICid = 1; + } + + request struct UnregisterClientMonitoringRequest { + node_id clientNodeId = 0; + INT64U ICid = 1; + } + + command access(invoke: manage) RegisterClientMonitoring(RegisterClientMonitoringRequest): DefaultSuccess = 0; + command access(invoke: manage) UnregisterClientMonitoring(UnregisterClientMonitoringRequest): DefaultSuccess = 1; +} + server cluster UnitTesting = 4294048773 { enum SimpleEnum : ENUM8 { kUnspecified = 0; @@ -4213,6 +4244,18 @@ endpoint 0 { ram attribute clusterRevision default = 3; } + server cluster ClientMonitoring { + ram attribute idleModeInterval default = 0x12C; + ram attribute activeModeInterval default = 0x12C; + ram attribute activeModeThreshold default = 0xFA0; + callback attribute expectedClients; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + ram attribute featureMap; + ram attribute clusterRevision default = 1; + } + server cluster FaultInjection { callback attribute generatedCommandList; callback attribute acceptedCommandList; diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 33bca5d8429039..8efd7b77f1b467 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -8054,6 +8054,220 @@ } ] }, + { + "name": "Client Monitoring", + "code": 4166, + "mfgCode": null, + "define": "CLIENT_MONITORING_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "RegisterClientMonitoring", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "UnregisterClientMonitoring", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Client Monitoring", + "code": 4166, + "mfgCode": null, + "define": "CLIENT_MONITORING_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "IdleModeInterval", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x12C", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeInterval", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x12C", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeThreshold", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFA0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ExpectedClients", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, { "name": "Unit Testing", "code": 4294048773, @@ -24740,5 +24954,6 @@ "endpointVersion": 1, "deviceIdentifier": 61442 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index ee4b0639094d63..2e1988e4d88672 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -80,6 +80,7 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/basic-information" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/bindings" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/client-monitoring-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/diagnostic-logs-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/door-lock-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/occupancy-sensor-server" diff --git a/examples/light-switch-app/light-switch-common/light-switch-app.zap b/examples/light-switch-app/light-switch-common/light-switch-app.zap index 7531018282f915..c68084806a8c23 100644 --- a/examples/light-switch-app/light-switch-common/light-switch-app.zap +++ b/examples/light-switch-app/light-switch-common/light-switch-app.zap @@ -5269,6 +5269,228 @@ "reportableChange": 0 } ] + }, + { + "name": "Client Monitoring", + "code": 4166, + "mfgCode": null, + "define": "CLIENT_MONITORING_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "RegisterClientMonitoring", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "UnregisterClientMonitoring", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "StayAwakeRequest", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Client Monitoring", + "code": 4166, + "mfgCode": null, + "define": "CLIENT_MONITORING_CLUSTER", + "side": "server", + "enabled": 0, + "attributes": [ + { + "name": "IdleModeInterval", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x12C", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeInterval", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x12C", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeThreshold", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFA0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ExpectedClients", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] } ] }, @@ -9231,5 +9453,6 @@ "endpointVersion": 1, "deviceIdentifier": 15 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/src/app/chip_data_model.cmake b/src/app/chip_data_model.cmake index e779563a73ad13..849596506f2f49 100644 --- a/src/app/chip_data_model.cmake +++ b/src/app/chip_data_model.cmake @@ -112,6 +112,7 @@ function(chip_configure_data_model APP_TARGET) ${CHIP_APP_BASE_DIR}/util/attribute-storage.cpp ${CHIP_APP_BASE_DIR}/util/attribute-table.cpp ${CHIP_APP_BASE_DIR}/util/binding-table.cpp + ${CHIP_APP_BASE_DIR}/util/ClientMonitoringRegistrationTable.cpp ${CHIP_APP_BASE_DIR}/util/DataModelHandler.cpp ${CHIP_APP_BASE_DIR}/util/ember-compatibility-functions.cpp ${CHIP_APP_BASE_DIR}/util/ember-print.cpp diff --git a/src/app/chip_data_model.gni b/src/app/chip_data_model.gni index 3430cb10e8759d..e75463dac66944 100644 --- a/src/app/chip_data_model.gni +++ b/src/app/chip_data_model.gni @@ -109,6 +109,8 @@ template("chip_data_model") { "${_app_root}/clusters/on-off-server/on-off-server.h", "${_app_root}/clusters/scenes/scenes-tokens.h", "${_app_root}/clusters/scenes/scenes.h", + "${_app_root}/util/ClientMonitoringRegistrationTable.cpp", + "${_app_root}/util/ClientMonitoringRegistrationTable.h", "${_app_root}/util/DataModelHandler.cpp", "${_app_root}/util/af-event.cpp", "${_app_root}/util/attribute-size-util.cpp", diff --git a/src/app/clusters/client-monitoring-server/client-monitoring-server.cpp b/src/app/clusters/client-monitoring-server/client-monitoring-server.cpp index aedfc3864f6b7a..de7157ad777703 100644 --- a/src/app/clusters/client-monitoring-server/client-monitoring-server.cpp +++ b/src/app/clusters/client-monitoring-server/client-monitoring-server.cpp @@ -17,8 +17,11 @@ #include "client-monitoring-server.h" +#include "app/server/Server.h" #include #include +#include +#include #include #include #include @@ -31,9 +34,14 @@ using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::ClientMonitoring; +using namespace Protocols; namespace { +/************************************************************ + * ClientMonitoringAttributeAccess Implementation + ************************************************************/ + /** * @brief Implementation of attribute access for ClientMonitoring cluster */ @@ -42,51 +50,166 @@ class ClientMonitoringAttributeAccess : public app::AttributeAccessInterface public: ClientMonitoringAttributeAccess() : AttributeAccessInterface(MakeOptional(kRootEndpointId), ClientMonitoring::Id) {} - CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override + CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; + CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) override; + +private: + CHIP_ERROR ReadExpectedClients(EndpointId endpoint, AttributeValueEncoder & encoder); +}; + +CHIP_ERROR ClientMonitoringAttributeAccess::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) +{ + VerifyOrDie(aPath.mClusterId == ClientMonitoring::Id); + + switch (aPath.mAttributeId) { - VerifyOrDie(aPath.mClusterId == ClientMonitoring::Id); + case ClientMonitoring::Attributes::ExpectedClients::Id: + return ReadExpectedClients(aPath.mEndpointId, aEncoder); - switch (aPath.mAttributeId) - { - case ClientMonitoring::Attributes::ExpectedClients::Id: - // TODO : Implement Client monitoring registration table - return CHIP_IM_GLOBAL_STATUS(UnsupportedRead); + default: + break; + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR ClientMonitoringAttributeAccess::Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) +{ + return CHIP_IM_GLOBAL_STATUS(UnsupportedWrite); +} + +CHIP_ERROR ClientMonitoringAttributeAccess::ReadExpectedClients(EndpointId endpoint, AttributeValueEncoder & encoder) +{ + FabricIndex fabric = encoder.AccessingFabricIndex(); - default: - break; + return encoder.EncodeList([fabric](const auto & subEncoder) -> CHIP_ERROR { + // TODO : https://github.com/project-chip/connectedhomeip/issues/24289 + ClientMonitoringRegistrationTable clientMonitoringRegistrationTable(chip::Server::GetInstance().GetPersistentStorage()); + CHIP_ERROR err = clientMonitoringRegistrationTable.LoadFromStorage(fabric); + + if (err == CHIP_NO_ERROR) + { + ReturnErrorOnFailure(subEncoder.Encode(clientMonitoringRegistrationTable.GetClientRegistrationEntry())); + } + else if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND) + { + // No Entries saved for this fabric. Return empty list + err = CHIP_NO_ERROR; } - return CHIP_NO_ERROR; - } + return err; + }); +} + +ClientMonitoringAttributeAccess gAttribute; + +} // namespace + +/********************************************************** + * ClientMonitoringServer Implementation + *********************************************************/ + +InteractionModel::Status ClientMonitoringServer::StayAwakeRequestCommand(const ConcreteCommandPath & commandPath) +{ + // TODO: Implementent stay awake logic for end device + return InteractionModel::Status::UnsupportedCommand; +} + +InteractionModel::Status +ClientMonitoringServer::RegisterClientMonitoringCommand(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Commands::RegisterClientMonitoring::DecodableType & commandData) +{ + FabricIndex fabric = commandObj->GetAccessingFabricIndex(); + + // TODO : https://github.com/project-chip/connectedhomeip/issues/24289 + ClientMonitoringRegistrationTable table(chip::Server::GetInstance().GetPersistentStorage()); + + VerifyOrReturnError(!table.HasValueForFabric(fabric), InteractionModel::Status::ResourceExhausted); + + table.GetClientRegistrationEntry().fabricIndex = fabric; + table.GetClientRegistrationEntry().clientNodeId = commandData.clientNodeId; + table.GetClientRegistrationEntry().ICid = commandData.ICid; - CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) override + VerifyOrReturnError(table.SaveToStorage() == CHIP_NO_ERROR, InteractionModel::Status::Failure); + + return InteractionModel::Status::Success; +} + +InteractionModel::Status +ClientMonitoringServer::UnregisterClientMonitoringCommand(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Commands::UnregisterClientMonitoring::DecodableType & commandData) +{ + FabricIndex fabric = commandObj->GetAccessingFabricIndex(); + + // TODO : https://github.com/project-chip/connectedhomeip/issues/24289 + ClientMonitoringRegistrationTable table(chip::Server::GetInstance().GetPersistentStorage()); + + CHIP_ERROR err = table.LoadFromStorage(fabric); + + if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND) { - return CHIP_IM_GLOBAL_STATUS(UnsupportedWrite); + // Success if there was no key + return InteractionModel::Status::Success; } -}; -ClientMonitoringAttributeAccess gAttribute; + VerifyOrReturnError(err == CHIP_NO_ERROR, InteractionModel::Status::Failure); -} // namespace + // Check if initiator has the token and the correct node id + VerifyOrReturnError(table.GetClientRegistrationEntry().clientNodeId == commandData.clientNodeId, + InteractionModel::Status::Failure); + VerifyOrReturnError(table.GetClientRegistrationEntry().ICid == commandData.ICid, InteractionModel::Status::Failure); + + // Delete Key from storage afters checks + VerifyOrReturnError(table.DeleteFromStorage(fabric) == CHIP_NO_ERROR, InteractionModel::Status::Failure); + + return InteractionModel::Status::Success; +} + +/********************************************************** + * Callbacks Implementation + *********************************************************/ /** * @brief Client Monitoring Cluster RegisterClientMonitoring Command callback (from client) + * */ bool emberAfClientMonitoringClusterRegisterClientMonitoringCallback( CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::RegisterClientMonitoring::DecodableType & commandData) { - commandObj->AddStatus(commandPath, Protocols::InteractionModel::Status::UnsupportedCommand); - return false; + ClientMonitoringServer server; + InteractionModel::Status status = server.RegisterClientMonitoringCommand(commandObj, commandPath, commandData); + + commandObj->AddStatus(commandPath, status); + return true; } + +/** + * @brief Client Monitoring Cluster UregisterClientMonitoring Command callback (from client) + * + */ +bool emberAfClientMonitoringClusterUnregisterClientMonitoringCallback( + CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Commands::UnregisterClientMonitoring::DecodableType & commandData) +{ + ClientMonitoringServer server; + InteractionModel::Status status = server.UnregisterClientMonitoringCommand(commandObj, commandPath, commandData); + + commandObj->AddStatus(commandPath, status); + return true; +} + /** * @brief Client Monitoring Cluster StayAwakeRequest Command callback (from client) */ bool emberAfClientMonitoringClusterStayAwakeRequestCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::StayAwakeRequest::DecodableType & commandData) { - commandObj->AddStatus(commandPath, Protocols::InteractionModel::Status::UnsupportedCommand); - return false; + ClientMonitoringServer server; + InteractionModel::Status status = server.StayAwakeRequestCommand(commandPath); + + commandObj->AddStatus(commandPath, status); + return true; } void MatterClientMonitoringPluginServerInitCallback() diff --git a/src/app/clusters/client-monitoring-server/client-monitoring-server.h b/src/app/clusters/client-monitoring-server/client-monitoring-server.h index 68a536760f3990..4cc0ffa517eb4e 100644 --- a/src/app/clusters/client-monitoring-server/client-monitoring-server.h +++ b/src/app/clusters/client-monitoring-server/client-monitoring-server.h @@ -18,6 +18,20 @@ #pragma once #include +#include #include #include #include + +class ClientMonitoringServer +{ +public: + chip::Protocols::InteractionModel::Status StayAwakeRequestCommand(const chip::app::ConcreteCommandPath & commandPath); + chip::Protocols::InteractionModel::Status RegisterClientMonitoringCommand( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::ClientMonitoring::Commands::RegisterClientMonitoring::DecodableType & commandData); + + chip::Protocols::InteractionModel::Status UnregisterClientMonitoringCommand( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::ClientMonitoring::Commands::UnregisterClientMonitoring::DecodableType & commandData); +}; diff --git a/src/app/tests/TestClientMonitoringRegistrationTable.cpp b/src/app/tests/TestClientMonitoringRegistrationTable.cpp index a05d9e6d490615..e6802151b7d4d6 100644 --- a/src/app/tests/TestClientMonitoringRegistrationTable.cpp +++ b/src/app/tests/TestClientMonitoringRegistrationTable.cpp @@ -120,6 +120,26 @@ void TestSaveAllInvalidRegistrationValues(nlTestSuite * aSuite, void * context) NL_TEST_ASSERT(aSuite, err == CHIP_ERROR_INCORRECT_STATE); } +void TestDeleteValidEntryFromStorage(nlTestSuite * aSuite, void * context) +{ + chip::TestPersistentStorageDelegate testStorage; + ClientMonitoringRegistrationTable table(testStorage); + + table.GetClientRegistrationEntry().clientNodeId = kTestClientNodeId; + table.GetClientRegistrationEntry().ICid = kTestICid; + table.GetClientRegistrationEntry().fabricIndex = kTestFabricIndex; + + CHIP_ERROR err = table.SaveToStorage(); + NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + + NL_TEST_ASSERT(aSuite, table.HasValueForFabric(kTestFabricIndex)); + + err = table.DeleteFromStorage(kTestFabricIndex); + NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + + NL_TEST_ASSERT(aSuite, !table.HasValueForFabric(kTestFabricIndex)); +} + } // namespace int TestClientMonitoringRegistrationTable() @@ -130,6 +150,7 @@ int TestClientMonitoringRegistrationTable() NL_TEST_DEF("TestSaveAllInvalidRegistrationValues", TestSaveAllInvalidRegistrationValues), NL_TEST_DEF("TestSaveLoadRegistrationValueForMultipleFabrics", TestSaveLoadRegistrationValueForMultipleFabrics), + NL_TEST_DEF("TestDeleteValidEntryFromStorage", TestDeleteValidEntryFromStorage), NL_TEST_SENTINEL() }; nlTestSuite cmSuite = { "TestClientMonitoringRegistrationTable", &sTests[0], nullptr, nullptr }; diff --git a/src/app/tests/suites/TestClientMonitoringCluster.yaml b/src/app/tests/suites/TestClientMonitoringCluster.yaml new file mode 100644 index 00000000000000..8376543a7893a5 --- /dev/null +++ b/src/app/tests/suites/TestClientMonitoringCluster.yaml @@ -0,0 +1,102 @@ +# Copyright (c) 2023 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. +name: Client Monitoring Tests + +config: + nodeId: 0x12344321 + cluster: "Client Monitoring" + endpoint: 0 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Register Client 2 - Invalid" + command: "RegisterClientMonitoring" + arguments: + values: + - name: "ClientNodeId" + value: 0 + - name: "ICid" + value: 0 + response: + error: FAILURE + + - label: "Register Client 1" + command: "RegisterClientMonitoring" + arguments: + values: + - name: "ClientNodeId" + value: 10 + - name: "ICid" + value: 20 + + - label: "Register Client 2 - Invalid" + command: "RegisterClientMonitoring" + arguments: + values: + - name: "ClientNodeId" + value: 11 + - name: "ICid" + value: 21 + response: + error: RESOURCE_EXHAUSTED + + - label: "Verify Register Client" + command: "readAttribute" + attribute: "ExpectedClients" + response: + value: [{ ClientNodeId: 10, ICid: 20 }] + + - label: "Unregister Client - Invalid Client NodeId" + command: "UnregisterClientMonitoring" + arguments: + values: + - name: "ClientNodeId" + value: 30 + - name: "ICid" + value: 20 + response: + error: FAILURE + + - label: "Unregister Client - Invalid ICid" + command: "UnregisterClientMonitoring" + arguments: + values: + - name: "ClientNodeId" + value: 10 + - name: "ICid" + value: 30 + response: + error: FAILURE + + - label: "Unregister Client - Valid" + command: "UnregisterClientMonitoring" + arguments: + values: + - name: "ClientNodeId" + value: 10 + - name: "ICid" + value: 20 + + - label: "Verify Register Client - Empty" + command: "readAttribute" + attribute: "ExpectedClients" + response: + value: [] diff --git a/src/app/tests/suites/TestDescriptorCluster.yaml b/src/app/tests/suites/TestDescriptorCluster.yaml index 4b146ba502db3b..a0ac7ee099d5c9 100644 --- a/src/app/tests/suites/TestDescriptorCluster.yaml +++ b/src/app/tests/suites/TestDescriptorCluster.yaml @@ -65,6 +65,7 @@ tests: 0x0040, # Fixed Label 0x0041, # User Label 0x0405, # Relative Humidity Measurement (why on EP0?) + 0x1046, # Client Monitoring 0xFFF1FC06, # Fault Injection ] diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index 61286397607778..a6d8303c88c408 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -237,7 +237,8 @@ "TestFanControl", "TestAccessControlConstraints", "TestLevelControlWithOnOffDependency", - "TestCommissioningWindow" + "TestCommissioningWindow", + "TestClientMonitoringCluster" ], "MultiAdmin": ["TestMultiAdmin"], "SoftwareDiagnostics": ["Test_TC_DGSW_1_1"], diff --git a/src/app/util/ClientMonitoringRegistrationTable.cpp b/src/app/util/ClientMonitoringRegistrationTable.cpp index 59ff417aefb363..b996c925faab53 100644 --- a/src/app/util/ClientMonitoringRegistrationTable.cpp +++ b/src/app/util/ClientMonitoringRegistrationTable.cpp @@ -66,4 +66,14 @@ ClientMonitoringRegistrationTable::ClientRegistrationEntry & ClientMonitoringReg return mRegisteredClient; } +CHIP_ERROR ClientMonitoringRegistrationTable::DeleteFromStorage(FabricIndex fabric) +{ + return mStorage.SyncDeleteKeyValue(DefaultStorageKeyAllocator::ClientMonitoringTableEntry(fabric).KeyName()); +} + +bool ClientMonitoringRegistrationTable::HasValueForFabric(FabricIndex fabric) +{ + return mStorage.SyncDoesKeyExist(DefaultStorageKeyAllocator::ClientMonitoringTableEntry(fabric).KeyName()); +} + } // namespace chip diff --git a/src/app/util/ClientMonitoringRegistrationTable.h b/src/app/util/ClientMonitoringRegistrationTable.h index 7579cdc016cee8..18545ddad51fa2 100644 --- a/src/app/util/ClientMonitoringRegistrationTable.h +++ b/src/app/util/ClientMonitoringRegistrationTable.h @@ -32,6 +32,9 @@ namespace chip { * * This class can only manage one fabric at a time. The flow is load a fabric, execute necessary operations, * save it if there are any changes and load another fabric. + * + * Issue to refactor the class to use one entry for the entire table + * https://github.com/project-chip/connectedhomeip/issues/24288 */ class ClientMonitoringRegistrationTable { @@ -44,7 +47,6 @@ class ClientMonitoringRegistrationTable }; ClientMonitoringRegistrationTable(PersistentStorageDelegate & storage); - ~ClientMonitoringRegistrationTable(){}; /** * @brief Function saves the mRegisteredClient attribute to persitant storage @@ -62,6 +64,22 @@ class ClientMonitoringRegistrationTable */ CHIP_ERROR LoadFromStorage(FabricIndex fabricIndex); + /** + * @brief Function deletes a client registration entry from persistent storage for a single fabric + * + * @param[in] fabricIndex fabric index to delete from storage + * @return CHIP_ERROR + */ + CHIP_ERROR DeleteFromStorage(FabricIndex fabricIndex); + + /** + * @brief Function check if a client registration entry is stored for a single fabric + * + * @param[in] fabricIndex fabric index to check + * @return CHIP_ERROR + */ + bool HasValueForFabric(FabricIndex fabric); + /** * @brief Accessor function that returns the client registration entry that was loaded for a fabric from persistant storage. * @see LoadFromStorage diff --git a/src/app/zap-templates/zcl/data-model/chip/client-monitoring-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/client-monitoring-cluster.xml index 9dc128947904c5..7b7a5fbdcbe0b2 100644 --- a/src/app/zap-templates/zcl/data-model/chip/client-monitoring-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/client-monitoring-cluster.xml @@ -44,7 +44,14 @@ limitations under the License. - + + Unregister a client from an end device + + + + + + Request the end device to stay in Active Mode for an additional ActiveModeThreshold diff --git a/src/controller/data_model/BUILD.gn b/src/controller/data_model/BUILD.gn index 7e7aafcb35b57f..e5a061b94c814c 100644 --- a/src/controller/data_model/BUILD.gn +++ b/src/controller/data_model/BUILD.gn @@ -172,6 +172,8 @@ if (current_os == "android" || build_java_matter_controller) { "jni/ElectricalMeasurementClient-InvokeSubscribeImpl.cpp", "jni/UnitTestingClient-ReadImpl.cpp", "jni/UnitTestingClient-InvokeSubscribeImpl.cpp", + "jni/ClientMonitoringClient-ReadImpl.cpp", + "jni/ClientMonitoringClient-InvokeSubscribeImpl.cpp", ] deps = [ diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index b381c70ad71efe..69e6e0abf4b03f 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4108,6 +4108,37 @@ client cluster ElectricalMeasurement = 2820 { readonly attribute int16u clusterRevision = 65533; } +client cluster ClientMonitoring = 4166 { + fabric_scoped struct MonitoringRegistration { + node_id clientNodeId = 1; + int64u ICid = 2; + fabric_idx fabricIndex = 254; + } + + readonly attribute int32u idleModeInterval = 0; + readonly attribute int32u activeModeInterval = 1; + readonly attribute int16u activeModeThreshold = 2; + readonly attribute MonitoringRegistration expectedClients[] = 3; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct RegisterClientMonitoringRequest { + node_id clientNodeId = 0; + INT64U ICid = 1; + } + + request struct UnregisterClientMonitoringRequest { + node_id clientNodeId = 0; + INT64U ICid = 1; + } + + command access(invoke: manage) RegisterClientMonitoring(RegisterClientMonitoringRequest): DefaultSuccess = 0; + command access(invoke: manage) UnregisterClientMonitoring(UnregisterClientMonitoringRequest): DefaultSuccess = 1; +} + client cluster UnitTesting = 4294048773 { enum SimpleEnum : ENUM8 { kUnspecified = 0; @@ -4486,6 +4517,7 @@ endpoint 1 { binding cluster ApplicationBasic; binding cluster AccountLogin; binding cluster ElectricalMeasurement; + binding cluster ClientMonitoring; binding cluster UnitTesting; } diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index 5c84d6016ba867..fb5f7499ff2c56 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -17762,6 +17762,220 @@ } ] }, + { + "name": "Client Monitoring", + "code": 4166, + "mfgCode": null, + "define": "CLIENT_MONITORING_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "RegisterClientMonitoring", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "UnregisterClientMonitoring", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Client Monitoring", + "code": 4166, + "mfgCode": null, + "define": "CLIENT_MONITORING_CLUSTER", + "side": "server", + "enabled": 0, + "attributes": [ + { + "name": "IdleModeInterval", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x12C", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeInterval", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x12C", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeThreshold", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFA0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ExpectedClients", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, { "name": "Unit Testing", "code": 4294048773, diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index e1cf6744fcc255..7269388b208342 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -17092,6 +17092,220 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } break; } + case app::Clusters::ClientMonitoring::Id: { + using namespace app::Clusters::ClientMonitoring; + switch (aPath.mAttributeId) + { + case Attributes::IdleModeInterval::Id: { + using TypeInfo = Attributes::IdleModeInterval::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + cppValue, value); + return value; + } + case Attributes::ActiveModeInterval::Id: { + using TypeInfo = Attributes::ActiveModeInterval::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + cppValue, value); + return value; + } + case Attributes::ActiveModeThreshold::Id: { + using TypeInfo = Attributes::ActiveModeThreshold::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + cppValue, value); + return value; + } + case Attributes::ExpectedClients::Id: { + using TypeInfo = Attributes::ExpectedClients::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + jobject newElement_0_clientNodeId; + std::string newElement_0_clientNodeIdClassName = "java/lang/Long"; + std::string newElement_0_clientNodeIdCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_clientNodeIdClassName.c_str(), + newElement_0_clientNodeIdCtorSignature.c_str(), + entry_0.clientNodeId, newElement_0_clientNodeId); + jobject newElement_0_ICid; + std::string newElement_0_ICidClassName = "java/lang/Long"; + std::string newElement_0_ICidCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_ICidClassName.c_str(), newElement_0_ICidCtorSignature.c_str(), entry_0.ICid, newElement_0_ICid); + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); + + jclass monitoringRegistrationStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ClientMonitoringClusterMonitoringRegistration", + monitoringRegistrationStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ClientMonitoringClusterMonitoringRegistration"); + return nullptr; + } + jmethodID monitoringRegistrationStructCtor_1 = env->GetMethodID( + monitoringRegistrationStructClass_1, "", "(Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Integer;)V"); + if (monitoringRegistrationStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$ClientMonitoringClusterMonitoringRegistration constructor"); + return nullptr; + } + + newElement_0 = env->NewObject(monitoringRegistrationStructClass_1, monitoringRegistrationStructCtor_1, + newElement_0_clientNodeId, newElement_0_ICid, newElement_0_fabricIndex); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + cppValue, value); + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + cppValue, value); + return value; + } + default: + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + break; + } + break; + } case app::Clusters::UnitTesting::Id: { using namespace app::Clusters::UnitTesting; switch (aPath.mAttributeId) diff --git a/src/controller/java/zap-generated/CHIPCallbackTypes.h b/src/controller/java/zap-generated/CHIPCallbackTypes.h index dd2f0d7151d101..9c7f7eaf476412 100644 --- a/src/controller/java/zap-generated/CHIPCallbackTypes.h +++ b/src/controller/java/zap-generated/CHIPCallbackTypes.h @@ -1774,6 +1774,25 @@ typedef void (*CHIPElectricalMeasurementClusterFeatureMapAttributeCallbackType)( void *, chip::app::Clusters::ElectricalMeasurement::Attributes::FeatureMap::TypeInfo::DecodableArgType); typedef void (*CHIPElectricalMeasurementClusterClusterRevisionAttributeCallbackType)( void *, chip::app::Clusters::ElectricalMeasurement::Attributes::ClusterRevision::TypeInfo::DecodableArgType); + +typedef void (*CHIPClientMonitoringClusterIdleModeIntervalAttributeCallbackType)( + void *, chip::app::Clusters::ClientMonitoring::Attributes::IdleModeInterval::TypeInfo::DecodableArgType); +typedef void (*CHIPClientMonitoringClusterActiveModeIntervalAttributeCallbackType)( + void *, chip::app::Clusters::ClientMonitoring::Attributes::ActiveModeInterval::TypeInfo::DecodableArgType); +typedef void (*CHIPClientMonitoringClusterActiveModeThresholdAttributeCallbackType)( + void *, chip::app::Clusters::ClientMonitoring::Attributes::ActiveModeThreshold::TypeInfo::DecodableArgType); +typedef void (*CHIPClientMonitoringClusterExpectedClientsAttributeCallbackType)( + void *, const chip::app::Clusters::ClientMonitoring::Attributes::ExpectedClients::TypeInfo::DecodableType &); +typedef void (*CHIPClientMonitoringClusterGeneratedCommandListAttributeCallbackType)( + void *, const chip::app::Clusters::ClientMonitoring::Attributes::GeneratedCommandList::TypeInfo::DecodableType &); +typedef void (*CHIPClientMonitoringClusterAcceptedCommandListAttributeCallbackType)( + void *, const chip::app::Clusters::ClientMonitoring::Attributes::AcceptedCommandList::TypeInfo::DecodableType &); +typedef void (*CHIPClientMonitoringClusterAttributeListAttributeCallbackType)( + void *, const chip::app::Clusters::ClientMonitoring::Attributes::AttributeList::TypeInfo::DecodableType &); +typedef void (*CHIPClientMonitoringClusterFeatureMapAttributeCallbackType)( + void *, chip::app::Clusters::ClientMonitoring::Attributes::FeatureMap::TypeInfo::DecodableArgType); +typedef void (*CHIPClientMonitoringClusterClusterRevisionAttributeCallbackType)( + void *, chip::app::Clusters::ClientMonitoring::Attributes::ClusterRevision::TypeInfo::DecodableArgType); typedef void (*CHIPUnitTestingClusterTestSpecificResponseCallbackType)( void *, const chip::app::Clusters::UnitTesting::Commands::TestSpecificResponse::DecodableType &); typedef void (*CHIPUnitTestingClusterTestAddArgumentsResponseCallbackType)( diff --git a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp index 8313fe238777cc..8b08310c1c819f 100644 --- a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp @@ -3431,6 +3431,16 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & } break; } + case app::Clusters::ClientMonitoring::Id: { + using namespace app::Clusters::ClientMonitoring; + switch (aPath.mEventId) + { + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + break; + } + break; + } case app::Clusters::UnitTesting::Id: { using namespace app::Clusters::UnitTesting; switch (aPath.mEventId) diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index 9a11bc3594dbe8..e261866ed624ae 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -25785,6 +25785,325 @@ void CHIPElectricalMeasurementAttributeListAttributeCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); } +CHIPClientMonitoringExpectedClientsAttributeCallback::CHIPClientMonitoringExpectedClientsAttributeCallback(jobject javaCallback, + bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPClientMonitoringExpectedClientsAttributeCallback::~CHIPClientMonitoringExpectedClientsAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPClientMonitoringExpectedClientsAttributeCallback::CallbackFn( + void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::ClientMonitoring::Structs::MonitoringRegistration::DecodableType> & list) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_clientNodeId; + std::string newElement_0_clientNodeIdClassName = "java/lang/Long"; + std::string newElement_0_clientNodeIdCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_clientNodeIdClassName.c_str(), + newElement_0_clientNodeIdCtorSignature.c_str(), + entry_0.clientNodeId, newElement_0_clientNodeId); + jobject newElement_0_ICid; + std::string newElement_0_ICidClassName = "java/lang/Long"; + std::string newElement_0_ICidCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_ICidClassName.c_str(), newElement_0_ICidCtorSignature.c_str(), entry_0.ICid, newElement_0_ICid); + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + entry_0.fabricIndex, newElement_0_fabricIndex); + + jclass monitoringRegistrationStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ClientMonitoringClusterMonitoringRegistration", + monitoringRegistrationStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ClientMonitoringClusterMonitoringRegistration"); + return; + } + jmethodID monitoringRegistrationStructCtor_1 = env->GetMethodID(monitoringRegistrationStructClass_1, "", + "(Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Integer;)V"); + if (monitoringRegistrationStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$ClientMonitoringClusterMonitoringRegistration constructor"); + return; + } + + newElement_0 = env->NewObject(monitoringRegistrationStructClass_1, monitoringRegistrationStructCtor_1, + newElement_0_clientNodeId, newElement_0_ICid, newElement_0_fabricIndex); + chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); + } + + env->ExceptionClear(); + env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); +} + +CHIPClientMonitoringGeneratedCommandListAttributeCallback::CHIPClientMonitoringGeneratedCommandListAttributeCallback( + jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPClientMonitoringGeneratedCommandListAttributeCallback::~CHIPClientMonitoringGeneratedCommandListAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPClientMonitoringGeneratedCommandListAttributeCallback::CallbackFn( + void * context, const chip::app::DataModel::DecodableList & list) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); + } + + env->ExceptionClear(); + env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); +} + +CHIPClientMonitoringAcceptedCommandListAttributeCallback::CHIPClientMonitoringAcceptedCommandListAttributeCallback( + jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPClientMonitoringAcceptedCommandListAttributeCallback::~CHIPClientMonitoringAcceptedCommandListAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPClientMonitoringAcceptedCommandListAttributeCallback::CallbackFn( + void * context, const chip::app::DataModel::DecodableList & list) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); + } + + env->ExceptionClear(); + env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); +} + +CHIPClientMonitoringAttributeListAttributeCallback::CHIPClientMonitoringAttributeListAttributeCallback(jobject javaCallback, + bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPClientMonitoringAttributeListAttributeCallback::~CHIPClientMonitoringAttributeListAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPClientMonitoringAttributeListAttributeCallback::CallbackFn( + void * context, const chip::app::DataModel::DecodableList & list) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), + newElement_0CtorSignature.c_str(), entry_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); + } + + env->ExceptionClear(); + env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); +} + CHIPUnitTestingListInt8uAttributeCallback::CHIPUnitTestingListInt8uAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.h b/src/controller/java/zap-generated/CHIPReadCallbacks.h index c346a6444e7095..1b9e29c1571b20 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.h +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.h @@ -10803,6 +10803,128 @@ class CHIPElectricalMeasurementAttributeListAttributeCallback bool keepAlive; }; +class CHIPClientMonitoringExpectedClientsAttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPClientMonitoringExpectedClientsAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPClientMonitoringExpectedClientsAttributeCallback(); + + static void maybeDestroy(CHIPClientMonitoringExpectedClientsAttributeCallback * callback) + { + if (!callback->keepAlive) + { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::ClientMonitoring::Structs::MonitoringRegistration::DecodableType> & list); + static void OnSubscriptionEstablished(void * context) + { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( + reinterpret_cast(context)->javaCallbackRef); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + +class CHIPClientMonitoringGeneratedCommandListAttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPClientMonitoringGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPClientMonitoringGeneratedCommandListAttributeCallback(); + + static void maybeDestroy(CHIPClientMonitoringGeneratedCommandListAttributeCallback * callback) + { + if (!callback->keepAlive) + { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); + static void OnSubscriptionEstablished(void * context) + { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( + reinterpret_cast(context)->javaCallbackRef); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + +class CHIPClientMonitoringAcceptedCommandListAttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPClientMonitoringAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPClientMonitoringAcceptedCommandListAttributeCallback(); + + static void maybeDestroy(CHIPClientMonitoringAcceptedCommandListAttributeCallback * callback) + { + if (!callback->keepAlive) + { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); + static void OnSubscriptionEstablished(void * context) + { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( + reinterpret_cast(context)->javaCallbackRef); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + +class CHIPClientMonitoringAttributeListAttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPClientMonitoringAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPClientMonitoringAttributeListAttributeCallback(); + + static void maybeDestroy(CHIPClientMonitoringAttributeListAttributeCallback * callback) + { + if (!callback->keepAlive) + { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); + static void OnSubscriptionEstablished(void * context) + { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( + reinterpret_cast(context)->javaCallbackRef); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + class CHIPUnitTestingListInt8uAttributeCallback : public chip::Callback::Callback { diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index 9741978e63828d..f5664141d65a9c 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -21911,6 +21911,231 @@ private native void subscribeClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback, int minInterval, int maxInterval); } + public static class ClientMonitoringCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 4166L; + + public ClientMonitoringCluster(long devicePtr, int endpointId) { + super(devicePtr, endpointId); + } + + @Override + public native long initWithDevice(long devicePtr, int endpointId); + + public void registerClientMonitoring( + DefaultClusterCallback callback, Long clientNodeId, Long ICid) { + registerClientMonitoring(chipClusterPtr, callback, clientNodeId, ICid, null); + } + + public void registerClientMonitoring( + DefaultClusterCallback callback, Long clientNodeId, Long ICid, int timedInvokeTimeoutMs) { + registerClientMonitoring(chipClusterPtr, callback, clientNodeId, ICid, timedInvokeTimeoutMs); + } + + public void unregisterClientMonitoring( + DefaultClusterCallback callback, Long clientNodeId, Long ICid) { + unregisterClientMonitoring(chipClusterPtr, callback, clientNodeId, ICid, null); + } + + public void unregisterClientMonitoring( + DefaultClusterCallback callback, Long clientNodeId, Long ICid, int timedInvokeTimeoutMs) { + unregisterClientMonitoring( + chipClusterPtr, callback, clientNodeId, ICid, timedInvokeTimeoutMs); + } + + private native void registerClientMonitoring( + long chipClusterPtr, + DefaultClusterCallback Callback, + Long clientNodeId, + Long ICid, + @Nullable Integer timedInvokeTimeoutMs); + + private native void unregisterClientMonitoring( + long chipClusterPtr, + DefaultClusterCallback Callback, + Long clientNodeId, + Long ICid, + @Nullable Integer timedInvokeTimeoutMs); + + public interface ExpectedClientsAttributeCallback { + void onSuccess(List valueList); + + void onError(Exception ex); + + default void onSubscriptionEstablished() {} + } + + public interface GeneratedCommandListAttributeCallback { + void onSuccess(List valueList); + + void onError(Exception ex); + + default void onSubscriptionEstablished() {} + } + + public interface AcceptedCommandListAttributeCallback { + void onSuccess(List valueList); + + void onError(Exception ex); + + default void onSubscriptionEstablished() {} + } + + public interface AttributeListAttributeCallback { + void onSuccess(List valueList); + + void onError(Exception ex); + + default void onSubscriptionEstablished() {} + } + + public void readIdleModeIntervalAttribute(LongAttributeCallback callback) { + readIdleModeIntervalAttribute(chipClusterPtr, callback); + } + + public void subscribeIdleModeIntervalAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + subscribeIdleModeIntervalAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + public void readActiveModeIntervalAttribute(LongAttributeCallback callback) { + readActiveModeIntervalAttribute(chipClusterPtr, callback); + } + + public void subscribeActiveModeIntervalAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + subscribeActiveModeIntervalAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + public void readActiveModeThresholdAttribute(IntegerAttributeCallback callback) { + readActiveModeThresholdAttribute(chipClusterPtr, callback); + } + + public void subscribeActiveModeThresholdAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + subscribeActiveModeThresholdAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + public void readExpectedClientsAttribute(ExpectedClientsAttributeCallback callback) { + readExpectedClientsAttribute(chipClusterPtr, callback); + } + + public void subscribeExpectedClientsAttribute( + ExpectedClientsAttributeCallback callback, int minInterval, int maxInterval) { + subscribeExpectedClientsAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + public void readGeneratedCommandListAttribute(GeneratedCommandListAttributeCallback callback) { + readGeneratedCommandListAttribute(chipClusterPtr, callback); + } + + public void subscribeGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeGeneratedCommandListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + public void readAcceptedCommandListAttribute(AcceptedCommandListAttributeCallback callback) { + readAcceptedCommandListAttribute(chipClusterPtr, callback); + } + + public void subscribeAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAcceptedCommandListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + public void readAttributeListAttribute(AttributeListAttributeCallback callback) { + readAttributeListAttribute(chipClusterPtr, callback); + } + + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + public void readFeatureMapAttribute(LongAttributeCallback callback) { + readFeatureMapAttribute(chipClusterPtr, callback); + } + + public void subscribeFeatureMapAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + subscribeFeatureMapAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { + readClusterRevisionAttribute(chipClusterPtr, callback); + } + + public void subscribeClusterRevisionAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + subscribeClusterRevisionAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + private native void readIdleModeIntervalAttribute( + long chipClusterPtr, LongAttributeCallback callback); + + private native void subscribeIdleModeIntervalAttribute( + long chipClusterPtr, LongAttributeCallback callback, int minInterval, int maxInterval); + + private native void readActiveModeIntervalAttribute( + long chipClusterPtr, LongAttributeCallback callback); + + private native void subscribeActiveModeIntervalAttribute( + long chipClusterPtr, LongAttributeCallback callback, int minInterval, int maxInterval); + + private native void readActiveModeThresholdAttribute( + long chipClusterPtr, IntegerAttributeCallback callback); + + private native void subscribeActiveModeThresholdAttribute( + long chipClusterPtr, IntegerAttributeCallback callback, int minInterval, int maxInterval); + + private native void readExpectedClientsAttribute( + long chipClusterPtr, ExpectedClientsAttributeCallback callback); + + private native void subscribeExpectedClientsAttribute( + long chipClusterPtr, + ExpectedClientsAttributeCallback callback, + int minInterval, + int maxInterval); + + private native void readGeneratedCommandListAttribute( + long chipClusterPtr, GeneratedCommandListAttributeCallback callback); + + private native void subscribeGeneratedCommandListAttribute( + long chipClusterPtr, + GeneratedCommandListAttributeCallback callback, + int minInterval, + int maxInterval); + + private native void readAcceptedCommandListAttribute( + long chipClusterPtr, AcceptedCommandListAttributeCallback callback); + + private native void subscribeAcceptedCommandListAttribute( + long chipClusterPtr, + AcceptedCommandListAttributeCallback callback, + int minInterval, + int maxInterval); + + private native void readAttributeListAttribute( + long chipClusterPtr, AttributeListAttributeCallback callback); + + private native void subscribeAttributeListAttribute( + long chipClusterPtr, + AttributeListAttributeCallback callback, + int minInterval, + int maxInterval); + + private native void readFeatureMapAttribute( + long chipClusterPtr, LongAttributeCallback callback); + + private native void subscribeFeatureMapAttribute( + long chipClusterPtr, LongAttributeCallback callback, int minInterval, int maxInterval); + + private native void readClusterRevisionAttribute( + long chipClusterPtr, IntegerAttributeCallback callback); + + private native void subscribeClusterRevisionAttribute( + long chipClusterPtr, IntegerAttributeCallback callback, int minInterval, int maxInterval); + } + public static class UnitTestingCluster extends BaseChipCluster { public static final long CLUSTER_ID = 4294048773L; diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java index 853e4167cb936c..90ac14ecb5b15c 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java @@ -217,6 +217,9 @@ public static String clusterIdToName(long clusterId) { if (clusterId == 2820L) { return "ElectricalMeasurement"; } + if (clusterId == 4166L) { + return "ClientMonitoring"; + } if (clusterId == 4294048773L) { return "UnitTesting"; } @@ -2826,6 +2829,36 @@ public static String attributeIdToName(long clusterId, long attributeId) { } return ""; } + if (clusterId == 4166L) { + if (attributeId == 0L) { + return "IdleModeInterval"; + } + if (attributeId == 1L) { + return "ActiveModeInterval"; + } + if (attributeId == 2L) { + return "ActiveModeThreshold"; + } + if (attributeId == 3L) { + return "ExpectedClients"; + } + if (attributeId == 65528L) { + return "GeneratedCommandList"; + } + if (attributeId == 65529L) { + return "AcceptedCommandList"; + } + if (attributeId == 65531L) { + return "AttributeList"; + } + if (attributeId == 65532L) { + return "FeatureMap"; + } + if (attributeId == 65533L) { + return "ClusterRevision"; + } + return ""; + } if (clusterId == 4294048773L) { if (attributeId == 0L) { return "Boolean"; @@ -3461,6 +3494,9 @@ public static String eventIdToName(long clusterId, long eventId) { if (clusterId == 2820L) { return ""; } + if (clusterId == 4166L) { + return ""; + } if (clusterId == 4294048773L) { if (eventId == 1L) { return "TestEvent"; diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipStructs.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipStructs.java index 002ace5f91a591..977dae52bb60bd 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipStructs.java @@ -1827,6 +1827,36 @@ public String toString() { } } + public static class ClientMonitoringClusterMonitoringRegistration { + public Long clientNodeId; + public Long ICid; + public Integer fabricIndex; + + public ClientMonitoringClusterMonitoringRegistration( + Long clientNodeId, Long ICid, Integer fabricIndex) { + this.clientNodeId = clientNodeId; + this.ICid = ICid; + this.fabricIndex = fabricIndex; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ClientMonitoringClusterMonitoringRegistration {\n"); + output.append("\tclientNodeId: "); + output.append(clientNodeId); + output.append("\n"); + output.append("\tICid: "); + output.append(ICid); + output.append("\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + public static class UnitTestingClusterSimpleStruct { public Integer a; public Boolean b; diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java index 250a3e532f1f72..511492a5027eac 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java @@ -6701,6 +6701,105 @@ public void onError(Exception ex) { } } + public static class DelegatedClientMonitoringClusterExpectedClientsAttributeCallback + implements ChipClusters.ClientMonitoringCluster.ExpectedClientsAttributeCallback, + DelegatedClusterCallback { + private ClusterCommandCallback callback; + + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess( + List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = + new CommandResponseInfo( + "valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedClientMonitoringClusterGeneratedCommandListAttributeCallback + implements ChipClusters.ClientMonitoringCluster.GeneratedCommandListAttributeCallback, + DelegatedClusterCallback { + private ClusterCommandCallback callback; + + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedClientMonitoringClusterAcceptedCommandListAttributeCallback + implements ChipClusters.ClientMonitoringCluster.AcceptedCommandListAttributeCallback, + DelegatedClusterCallback { + private ClusterCommandCallback callback; + + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedClientMonitoringClusterAttributeListAttributeCallback + implements ChipClusters.ClientMonitoringCluster.AttributeListAttributeCallback, + DelegatedClusterCallback { + private ClusterCommandCallback callback; + + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + public static class DelegatedTestSpecificResponseCallback implements ChipClusters.UnitTestingCluster.TestSpecificResponseCallback, DelegatedClusterCallback { @@ -7471,6 +7570,11 @@ public Map initializeClusterMap() { (ptr, endpointId) -> new ChipClusters.ElectricalMeasurementCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("electricalMeasurement", electricalMeasurementClusterInfo); + ClusterInfo clientMonitoringClusterInfo = + new ClusterInfo( + (ptr, endpointId) -> new ChipClusters.ClientMonitoringCluster(ptr, endpointId), + new HashMap<>()); + clusterMap.put("clientMonitoring", clientMonitoringClusterInfo); ClusterInfo unitTestingClusterInfo = new ClusterInfo( (ptr, endpointId) -> new ChipClusters.UnitTestingCluster(ptr, endpointId), @@ -7567,6 +7671,7 @@ public void combineCommand( destination.get("applicationBasic").combineCommands(source.get("applicationBasic")); destination.get("accountLogin").combineCommands(source.get("accountLogin")); destination.get("electricalMeasurement").combineCommands(source.get("electricalMeasurement")); + destination.get("clientMonitoring").combineCommands(source.get("clientMonitoring")); destination.get("unitTesting").combineCommands(source.get("unitTesting")); } @@ -11696,6 +11801,59 @@ public Map> getCommandMap() { Map electricalMeasurementClusterInteractionInfoMap = new LinkedHashMap<>(); commandMap.put("electricalMeasurement", electricalMeasurementClusterInteractionInfoMap); + Map clientMonitoringClusterInteractionInfoMap = new LinkedHashMap<>(); + Map clientMonitoringregisterClientMonitoringCommandParams = + new LinkedHashMap(); + CommandParameterInfo clientMonitoringregisterClientMonitoringclientNodeIdCommandParameterInfo = + new CommandParameterInfo("clientNodeId", Long.class, Long.class); + clientMonitoringregisterClientMonitoringCommandParams.put( + "clientNodeId", clientMonitoringregisterClientMonitoringclientNodeIdCommandParameterInfo); + + CommandParameterInfo clientMonitoringregisterClientMonitoringICidCommandParameterInfo = + new CommandParameterInfo("ICid", Long.class, Long.class); + clientMonitoringregisterClientMonitoringCommandParams.put( + "ICid", clientMonitoringregisterClientMonitoringICidCommandParameterInfo); + + InteractionInfo clientMonitoringregisterClientMonitoringInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClientMonitoringCluster) cluster) + .registerClientMonitoring( + (DefaultClusterCallback) callback, + (Long) commandArguments.get("clientNodeId"), + (Long) commandArguments.get("ICid")); + }, + () -> new DelegatedDefaultClusterCallback(), + clientMonitoringregisterClientMonitoringCommandParams); + clientMonitoringClusterInteractionInfoMap.put( + "registerClientMonitoring", clientMonitoringregisterClientMonitoringInteractionInfo); + Map clientMonitoringunregisterClientMonitoringCommandParams = + new LinkedHashMap(); + CommandParameterInfo + clientMonitoringunregisterClientMonitoringclientNodeIdCommandParameterInfo = + new CommandParameterInfo("clientNodeId", Long.class, Long.class); + clientMonitoringunregisterClientMonitoringCommandParams.put( + "clientNodeId", clientMonitoringunregisterClientMonitoringclientNodeIdCommandParameterInfo); + + CommandParameterInfo clientMonitoringunregisterClientMonitoringICidCommandParameterInfo = + new CommandParameterInfo("ICid", Long.class, Long.class); + clientMonitoringunregisterClientMonitoringCommandParams.put( + "ICid", clientMonitoringunregisterClientMonitoringICidCommandParameterInfo); + + InteractionInfo clientMonitoringunregisterClientMonitoringInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClientMonitoringCluster) cluster) + .unregisterClientMonitoring( + (DefaultClusterCallback) callback, + (Long) commandArguments.get("clientNodeId"), + (Long) commandArguments.get("ICid")); + }, + () -> new DelegatedDefaultClusterCallback(), + clientMonitoringunregisterClientMonitoringCommandParams); + clientMonitoringClusterInteractionInfoMap.put( + "unregisterClientMonitoring", clientMonitoringunregisterClientMonitoringInteractionInfo); + commandMap.put("clientMonitoring", clientMonitoringClusterInteractionInfoMap); Map unitTestingClusterInteractionInfoMap = new LinkedHashMap<>(); Map unitTestingtestCommandParams = new LinkedHashMap(); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java index 50ea7744c347b8..5ae1c4204d4dd9 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java @@ -11329,6 +11329,140 @@ public Map> getReadAttributeMap() { "readClusterRevisionAttribute", readElectricalMeasurementClusterRevisionAttributeInteractionInfo); readAttributeMap.put("electricalMeasurement", readElectricalMeasurementInteractionInfo); + Map readClientMonitoringInteractionInfo = new LinkedHashMap<>(); + Map readClientMonitoringIdleModeIntervalCommandParams = + new LinkedHashMap(); + InteractionInfo readClientMonitoringIdleModeIntervalAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClientMonitoringCluster) cluster) + .readIdleModeIntervalAttribute((ChipClusters.LongAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readClientMonitoringIdleModeIntervalCommandParams); + readClientMonitoringInteractionInfo.put( + "readIdleModeIntervalAttribute", + readClientMonitoringIdleModeIntervalAttributeInteractionInfo); + Map readClientMonitoringActiveModeIntervalCommandParams = + new LinkedHashMap(); + InteractionInfo readClientMonitoringActiveModeIntervalAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClientMonitoringCluster) cluster) + .readActiveModeIntervalAttribute((ChipClusters.LongAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readClientMonitoringActiveModeIntervalCommandParams); + readClientMonitoringInteractionInfo.put( + "readActiveModeIntervalAttribute", + readClientMonitoringActiveModeIntervalAttributeInteractionInfo); + Map readClientMonitoringActiveModeThresholdCommandParams = + new LinkedHashMap(); + InteractionInfo readClientMonitoringActiveModeThresholdAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClientMonitoringCluster) cluster) + .readActiveModeThresholdAttribute( + (ChipClusters.IntegerAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readClientMonitoringActiveModeThresholdCommandParams); + readClientMonitoringInteractionInfo.put( + "readActiveModeThresholdAttribute", + readClientMonitoringActiveModeThresholdAttributeInteractionInfo); + Map readClientMonitoringExpectedClientsCommandParams = + new LinkedHashMap(); + InteractionInfo readClientMonitoringExpectedClientsAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClientMonitoringCluster) cluster) + .readExpectedClientsAttribute( + (ChipClusters.ClientMonitoringCluster.ExpectedClientsAttributeCallback) + callback); + }, + () -> + new ClusterInfoMapping + .DelegatedClientMonitoringClusterExpectedClientsAttributeCallback(), + readClientMonitoringExpectedClientsCommandParams); + readClientMonitoringInteractionInfo.put( + "readExpectedClientsAttribute", + readClientMonitoringExpectedClientsAttributeInteractionInfo); + Map readClientMonitoringGeneratedCommandListCommandParams = + new LinkedHashMap(); + InteractionInfo readClientMonitoringGeneratedCommandListAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClientMonitoringCluster) cluster) + .readGeneratedCommandListAttribute( + (ChipClusters.ClientMonitoringCluster.GeneratedCommandListAttributeCallback) + callback); + }, + () -> + new ClusterInfoMapping + .DelegatedClientMonitoringClusterGeneratedCommandListAttributeCallback(), + readClientMonitoringGeneratedCommandListCommandParams); + readClientMonitoringInteractionInfo.put( + "readGeneratedCommandListAttribute", + readClientMonitoringGeneratedCommandListAttributeInteractionInfo); + Map readClientMonitoringAcceptedCommandListCommandParams = + new LinkedHashMap(); + InteractionInfo readClientMonitoringAcceptedCommandListAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClientMonitoringCluster) cluster) + .readAcceptedCommandListAttribute( + (ChipClusters.ClientMonitoringCluster.AcceptedCommandListAttributeCallback) + callback); + }, + () -> + new ClusterInfoMapping + .DelegatedClientMonitoringClusterAcceptedCommandListAttributeCallback(), + readClientMonitoringAcceptedCommandListCommandParams); + readClientMonitoringInteractionInfo.put( + "readAcceptedCommandListAttribute", + readClientMonitoringAcceptedCommandListAttributeInteractionInfo); + Map readClientMonitoringAttributeListCommandParams = + new LinkedHashMap(); + InteractionInfo readClientMonitoringAttributeListAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClientMonitoringCluster) cluster) + .readAttributeListAttribute( + (ChipClusters.ClientMonitoringCluster.AttributeListAttributeCallback) + callback); + }, + () -> + new ClusterInfoMapping + .DelegatedClientMonitoringClusterAttributeListAttributeCallback(), + readClientMonitoringAttributeListCommandParams); + readClientMonitoringInteractionInfo.put( + "readAttributeListAttribute", readClientMonitoringAttributeListAttributeInteractionInfo); + Map readClientMonitoringFeatureMapCommandParams = + new LinkedHashMap(); + InteractionInfo readClientMonitoringFeatureMapAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClientMonitoringCluster) cluster) + .readFeatureMapAttribute((ChipClusters.LongAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readClientMonitoringFeatureMapCommandParams); + readClientMonitoringInteractionInfo.put( + "readFeatureMapAttribute", readClientMonitoringFeatureMapAttributeInteractionInfo); + Map readClientMonitoringClusterRevisionCommandParams = + new LinkedHashMap(); + InteractionInfo readClientMonitoringClusterRevisionAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClientMonitoringCluster) cluster) + .readClusterRevisionAttribute((ChipClusters.IntegerAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readClientMonitoringClusterRevisionCommandParams); + readClientMonitoringInteractionInfo.put( + "readClusterRevisionAttribute", + readClientMonitoringClusterRevisionAttributeInteractionInfo); + readAttributeMap.put("clientMonitoring", readClientMonitoringInteractionInfo); Map readUnitTestingInteractionInfo = new LinkedHashMap<>(); Map readUnitTestingBooleanCommandParams = new LinkedHashMap(); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java index 151ace65fbd07b..10f10c28583be5 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java @@ -1608,6 +1608,8 @@ public Map> getWriteAttributeMap() { writeAttributeMap.put("accountLogin", writeAccountLoginInteractionInfo); Map writeElectricalMeasurementInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("electricalMeasurement", writeElectricalMeasurementInteractionInfo); + Map writeClientMonitoringInteractionInfo = new LinkedHashMap<>(); + writeAttributeMap.put("clientMonitoring", writeClientMonitoringInteractionInfo); Map writeUnitTestingInteractionInfo = new LinkedHashMap<>(); Map writeUnitTestingBooleanCommandParams = new LinkedHashMap(); diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 1fe68ce43a2b33..f8ec1b46585faa 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -6737,6 +6737,84 @@ class ChipClusters: }, }, } + _CLIENT_MONITORING_CLUSTER_INFO = { + "clusterName": "ClientMonitoring", + "clusterId": 0x00001046, + "commands": { + 0x00000000: { + "commandId": 0x00000000, + "commandName": "RegisterClientMonitoring", + "args": { + "clientNodeId": "int", + "ICid": "int", + }, + }, + 0x00000001: { + "commandId": 0x00000001, + "commandName": "UnregisterClientMonitoring", + "args": { + "clientNodeId": "int", + "ICid": "int", + }, + }, + }, + "attributes": { + 0x00000000: { + "attributeName": "IdleModeInterval", + "attributeId": 0x00000000, + "type": "int", + "reportable": True, + }, + 0x00000001: { + "attributeName": "ActiveModeInterval", + "attributeId": 0x00000001, + "type": "int", + "reportable": True, + }, + 0x00000002: { + "attributeName": "ActiveModeThreshold", + "attributeId": 0x00000002, + "type": "int", + "reportable": True, + }, + 0x00000003: { + "attributeName": "ExpectedClients", + "attributeId": 0x00000003, + "type": "", + "reportable": True, + }, + 0x0000FFF8: { + "attributeName": "GeneratedCommandList", + "attributeId": 0x0000FFF8, + "type": "int", + "reportable": True, + }, + 0x0000FFF9: { + "attributeName": "AcceptedCommandList", + "attributeId": 0x0000FFF9, + "type": "int", + "reportable": True, + }, + 0x0000FFFB: { + "attributeName": "AttributeList", + "attributeId": 0x0000FFFB, + "type": "int", + "reportable": True, + }, + 0x0000FFFC: { + "attributeName": "FeatureMap", + "attributeId": 0x0000FFFC, + "type": "int", + "reportable": True, + }, + 0x0000FFFD: { + "attributeName": "ClusterRevision", + "attributeId": 0x0000FFFD, + "type": "int", + "reportable": True, + }, + }, + } _UNIT_TESTING_CLUSTER_INFO = { "clusterName": "UnitTesting", "clusterId": 0xFFF1FC05, @@ -7568,6 +7646,7 @@ class ChipClusters: 0x0000050D: _APPLICATION_BASIC_CLUSTER_INFO, 0x0000050E: _ACCOUNT_LOGIN_CLUSTER_INFO, 0x00000B04: _ELECTRICAL_MEASUREMENT_CLUSTER_INFO, + 0x00001046: _CLIENT_MONITORING_CLUSTER_INFO, 0xFFF1FC05: _UNIT_TESTING_CLUSTER_INFO, } @@ -7636,6 +7715,7 @@ class ChipClusters: "ApplicationBasic": _APPLICATION_BASIC_CLUSTER_INFO, "AccountLogin": _ACCOUNT_LOGIN_CLUSTER_INFO, "ElectricalMeasurement": _ELECTRICAL_MEASUREMENT_CLUSTER_INFO, + "ClientMonitoring": _CLIENT_MONITORING_CLUSTER_INFO, "UnitTesting": _UNIT_TESTING_CLUSTER_INFO, } diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index b6f00e98429bff..303e47d8a5f551 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -26941,12 +26941,30 @@ def descriptor(cls) -> ClusterObjectDescriptor: ICid: 'uint' = 0 @dataclass - class StayAwakeRequest(ClusterCommand): + class UnregisterClientMonitoring(ClusterCommand): cluster_id: typing.ClassVar[int] = 0x1046 command_id: typing.ClassVar[int] = 0x0001 is_client: typing.ClassVar[bool] = True response_type: typing.ClassVar[str] = None + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="clientNodeId", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="ICid", Tag=1, Type=uint), + ]) + + clientNodeId: 'uint' = 0 + ICid: 'uint' = 0 + + @dataclass + class StayAwakeRequest(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x1046 + command_id: typing.ClassVar[int] = 0x0002 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index a5ffd8d0eb3010..04e99df067a6ff 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -16082,6 +16082,177 @@ id MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader & } break; } + case Clusters::ClientMonitoring::Id: { + using namespace Clusters::ClientMonitoring; + switch (aPath.mAttributeId) { + case Attributes::IdleModeInterval::Id: { + using TypeInfo = Attributes::IdleModeInterval::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ActiveModeInterval::Id: { + using TypeInfo = Attributes::ActiveModeInterval::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ActiveModeThreshold::Id: { + using TypeInfo = Attributes::ActiveModeThreshold::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ExpectedClients::Id: { + using TypeInfo = Attributes::ExpectedClients::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRClientMonitoringClusterMonitoringRegistration * newElement_0; + newElement_0 = [MTRClientMonitoringClusterMonitoringRegistration new]; + newElement_0.clientNodeId = [NSNumber numberWithUnsignedLongLong:entry_0.clientNodeId]; + newElement_0.iCid = [NSNumber numberWithUnsignedLongLong:entry_0.ICid]; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + break; + } + break; + } case Clusters::UnitTesting::Id: { using namespace Clusters::UnitTesting; switch (aPath.mAttributeId) { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 3d2835298fb782..a29a8c2685fadc 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -15349,6 +15349,155 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @end +/** + * Cluster Client Monitoring + * + * Client Monitoring allows for ensuring that listed clients meet the required monitoring conditions on the server. + */ +MTR_NEWLY_AVAILABLE +@interface MTRBaseClusterClientMonitoring : MTRCluster + +- (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_NEWLY_AVAILABLE; + +/** + * Command RegisterClientMonitoring + * + * Register a client to the end device + */ +- (void)registerClientMonitoringWithParams:(MTRClientMonitoringClusterRegisterClientMonitoringParams *)params + completion:(MTRStatusCompletion)completion MTR_NEWLY_AVAILABLE; +/** + * Command UnregisterClientMonitoring + * + * Unregister a client from an end device + */ +- (void)unregisterClientMonitoringWithParams:(MTRClientMonitoringClusterUnregisterClientMonitoringParams *)params + completion:(MTRStatusCompletion)completion MTR_NEWLY_AVAILABLE; +/** + * Command StayAwakeRequest + * + * Request the end device to stay in Active Mode for an additional ActiveModeThreshold + */ +- (void)stayAwakeRequestWithParams:(MTRClientMonitoringClusterStayAwakeRequestParams * _Nullable)params + completion:(MTRStatusCompletion)completion MTR_NEWLY_AVAILABLE; +- (void)stayAwakeRequestWithCompletion:(MTRStatusCompletion)completion MTR_NEWLY_AVAILABLE; + +- (void)readAttributeIdleModeIntervalWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion + MTR_NEWLY_AVAILABLE; +- (void)subscribeAttributeIdleModeIntervalWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler + MTR_NEWLY_AVAILABLE; ++ (void)readAttributeIdleModeIntervalWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completion MTR_NEWLY_AVAILABLE; + +- (void)readAttributeActiveModeIntervalWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion + MTR_NEWLY_AVAILABLE; +- (void)subscribeAttributeActiveModeIntervalWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))reportHandler MTR_NEWLY_AVAILABLE; ++ (void)readAttributeActiveModeIntervalWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completion MTR_NEWLY_AVAILABLE; + +- (void)readAttributeActiveModeThresholdWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion + MTR_NEWLY_AVAILABLE; +- (void)subscribeAttributeActiveModeThresholdWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))reportHandler MTR_NEWLY_AVAILABLE; ++ (void)readAttributeActiveModeThresholdWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completion MTR_NEWLY_AVAILABLE; + +- (void)readAttributeExpectedClientsWithParams:(MTRReadParams * _Nullable)params + completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion + MTR_NEWLY_AVAILABLE; +- (void)subscribeAttributeExpectedClientsWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler + MTR_NEWLY_AVAILABLE; ++ (void)readAttributeExpectedClientsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion + MTR_NEWLY_AVAILABLE; + +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion + MTR_NEWLY_AVAILABLE; +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, + NSError * _Nullable error))reportHandler MTR_NEWLY_AVAILABLE; ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion:(void (^)(NSArray * _Nullable value, + NSError * _Nullable error))completion MTR_NEWLY_AVAILABLE; + +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion + MTR_NEWLY_AVAILABLE; +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, + NSError * _Nullable error))reportHandler MTR_NEWLY_AVAILABLE; ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion:(void (^)(NSArray * _Nullable value, + NSError * _Nullable error))completion MTR_NEWLY_AVAILABLE; + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion + MTR_NEWLY_AVAILABLE; +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler + MTR_NEWLY_AVAILABLE; ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion + MTR_NEWLY_AVAILABLE; + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion + MTR_NEWLY_AVAILABLE; +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler + MTR_NEWLY_AVAILABLE; ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion + MTR_NEWLY_AVAILABLE; + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion + MTR_NEWLY_AVAILABLE; +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler + MTR_NEWLY_AVAILABLE; ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completion MTR_NEWLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + /** * Cluster Unit Testing * diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 5c069f177d2013..c6513ae12384df 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -104070,6 +104070,542 @@ - (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16 @end +@implementation MTRBaseClusterClientMonitoring + +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue +{ + if (self = [super initWithQueue:queue]) { + if (device == nil) { + return nil; + } + + _device = device; + _endpoint = [endpointID unsignedShortValue]; + } + return self; +} + +- (void)registerClientMonitoringWithParams:(MTRClientMonitoringClusterRegisterClientMonitoringParams *)params + completion:(MTRStatusCompletion)completion +{ + // Make a copy of params before we go async. + params = [params copy]; + auto * bridge = new MTRCommandSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable value, NSError * _Nullable error) { + completion(error); + }, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, + MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { + auto * typedBridge = static_cast(bridge); + chip::Optional timedInvokeTimeoutMs; + ListFreer listFreer; + ClientMonitoring::Commands::RegisterClientMonitoring::Type request; + if (params != nil) { + if (params.timedInvokeTimeoutMs != nil) { + timedInvokeTimeoutMs.SetValue(params.timedInvokeTimeoutMs.unsignedShortValue); + } + } + request.clientNodeId = params.clientNodeId.unsignedLongLongValue; + request.ICid = params.iCid.unsignedLongLongValue; + + return MTRStartInvokeInteraction( + typedBridge, request, exchangeManager, session, successCb, failureCb, self->_endpoint, timedInvokeTimeoutMs); + }); + std::move(*bridge).DispatchAction(self.device); +} + +- (void)unregisterClientMonitoringWithParams:(MTRClientMonitoringClusterUnregisterClientMonitoringParams *)params + completion:(MTRStatusCompletion)completion +{ + // Make a copy of params before we go async. + params = [params copy]; + auto * bridge = new MTRCommandSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable value, NSError * _Nullable error) { + completion(error); + }, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, + MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { + auto * typedBridge = static_cast(bridge); + chip::Optional timedInvokeTimeoutMs; + ListFreer listFreer; + ClientMonitoring::Commands::UnregisterClientMonitoring::Type request; + if (params != nil) { + if (params.timedInvokeTimeoutMs != nil) { + timedInvokeTimeoutMs.SetValue(params.timedInvokeTimeoutMs.unsignedShortValue); + } + } + request.clientNodeId = params.clientNodeId.unsignedLongLongValue; + request.ICid = params.iCid.unsignedLongLongValue; + + return MTRStartInvokeInteraction( + typedBridge, request, exchangeManager, session, successCb, failureCb, self->_endpoint, timedInvokeTimeoutMs); + }); + std::move(*bridge).DispatchAction(self.device); +} + +- (void)stayAwakeRequestWithCompletion:(MTRStatusCompletion)completion +{ + [self stayAwakeRequestWithParams:nil completion:completion]; +} +- (void)stayAwakeRequestWithParams:(MTRClientMonitoringClusterStayAwakeRequestParams * _Nullable)params + completion:(MTRStatusCompletion)completion +{ + // Make a copy of params before we go async. + params = [params copy]; + auto * bridge = new MTRCommandSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable value, NSError * _Nullable error) { + completion(error); + }, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, + MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { + auto * typedBridge = static_cast(bridge); + chip::Optional timedInvokeTimeoutMs; + ListFreer listFreer; + ClientMonitoring::Commands::StayAwakeRequest::Type request; + if (params != nil) { + if (params.timedInvokeTimeoutMs != nil) { + timedInvokeTimeoutMs.SetValue(params.timedInvokeTimeoutMs.unsignedShortValue); + } + } + + return MTRStartInvokeInteraction( + typedBridge, request, exchangeManager, session, successCb, failureCb, self->_endpoint, timedInvokeTimeoutMs); + }); + std::move(*bridge).DispatchAction(self.device); +} + +- (void)readAttributeIdleModeIntervalWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + MTRReadParams * params = [[MTRReadParams alloc] init]; + using TypeInfo = ClientMonitoring::Attributes::IdleModeInterval::TypeInfo; + return MTRReadAttribute( + params, completion, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); +} + +- (void)subscribeAttributeIdleModeIntervalWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClientMonitoring::Attributes::IdleModeInterval::TypeInfo; + MTRSubscribeAttribute(params, + subscriptionEstablished, reportHandler, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), + TypeInfo::GetAttributeId()); +} + ++ (void)readAttributeIdleModeIntervalWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + auto * bridge = new MTRInt32uAttributeCallbackBridge(queue, completion); + std::move(*bridge).DispatchLocalAction( + clusterStateCacheContainer.baseDevice, ^(Int32uAttributeCallback successCb, MTRErrorCallback failureCb) { + if (clusterStateCacheContainer.cppClusterStateCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = ClientMonitoring::Attributes::IdleModeInterval::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = clusterStateCacheContainer.cppClusterStateCache->Get(path, value); + if (err == CHIP_NO_ERROR) { + successCb(bridge, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +- (void)readAttributeActiveModeIntervalWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + MTRReadParams * params = [[MTRReadParams alloc] init]; + using TypeInfo = ClientMonitoring::Attributes::ActiveModeInterval::TypeInfo; + return MTRReadAttribute( + params, completion, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); +} + +- (void)subscribeAttributeActiveModeIntervalWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClientMonitoring::Attributes::ActiveModeInterval::TypeInfo; + MTRSubscribeAttribute(params, + subscriptionEstablished, reportHandler, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), + TypeInfo::GetAttributeId()); +} + ++ (void)readAttributeActiveModeIntervalWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + auto * bridge = new MTRInt32uAttributeCallbackBridge(queue, completion); + std::move(*bridge).DispatchLocalAction( + clusterStateCacheContainer.baseDevice, ^(Int32uAttributeCallback successCb, MTRErrorCallback failureCb) { + if (clusterStateCacheContainer.cppClusterStateCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = ClientMonitoring::Attributes::ActiveModeInterval::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = clusterStateCacheContainer.cppClusterStateCache->Get(path, value); + if (err == CHIP_NO_ERROR) { + successCb(bridge, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +- (void)readAttributeActiveModeThresholdWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + MTRReadParams * params = [[MTRReadParams alloc] init]; + using TypeInfo = ClientMonitoring::Attributes::ActiveModeThreshold::TypeInfo; + return MTRReadAttribute( + params, completion, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); +} + +- (void)subscribeAttributeActiveModeThresholdWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClientMonitoring::Attributes::ActiveModeThreshold::TypeInfo; + MTRSubscribeAttribute(params, + subscriptionEstablished, reportHandler, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), + TypeInfo::GetAttributeId()); +} + ++ (void)readAttributeActiveModeThresholdWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + auto * bridge = new MTRInt16uAttributeCallbackBridge(queue, completion); + std::move(*bridge).DispatchLocalAction( + clusterStateCacheContainer.baseDevice, ^(Int16uAttributeCallback successCb, MTRErrorCallback failureCb) { + if (clusterStateCacheContainer.cppClusterStateCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = ClientMonitoring::Attributes::ActiveModeThreshold::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = clusterStateCacheContainer.cppClusterStateCache->Get(path, value); + if (err == CHIP_NO_ERROR) { + successCb(bridge, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +- (void)readAttributeExpectedClientsWithParams:(MTRReadParams * _Nullable)params + completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ // Make a copy of params before we go async. + params = [params copy]; + using TypeInfo = ClientMonitoring::Attributes::ExpectedClients::TypeInfo; + return MTRReadAttribute( + params, completion, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); +} + +- (void)subscribeAttributeExpectedClientsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClientMonitoring::Attributes::ExpectedClients::TypeInfo; + MTRSubscribeAttribute(params, subscriptionEstablished, reportHandler, self.callbackQueue, self.device, self->_endpoint, + TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); +} + ++ (void)readAttributeExpectedClientsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + auto * bridge = new MTRClientMonitoringExpectedClientsListAttributeCallbackBridge(queue, completion); + std::move(*bridge).DispatchLocalAction(clusterStateCacheContainer.baseDevice, + ^(ClientMonitoringExpectedClientsListAttributeCallback successCb, MTRErrorCallback failureCb) { + if (clusterStateCacheContainer.cppClusterStateCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = ClientMonitoring::Attributes::ExpectedClients::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = clusterStateCacheContainer.cppClusterStateCache->Get(path, value); + if (err == CHIP_NO_ERROR) { + successCb(bridge, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + MTRReadParams * params = [[MTRReadParams alloc] init]; + using TypeInfo = ClientMonitoring::Attributes::GeneratedCommandList::TypeInfo; + return MTRReadAttribute( + params, completion, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); +} + +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler: + (void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClientMonitoring::Attributes::GeneratedCommandList::TypeInfo; + MTRSubscribeAttribute(params, subscriptionEstablished, reportHandler, self.callbackQueue, self.device, self->_endpoint, + TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); +} + ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion: + (void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + auto * bridge = new MTRClientMonitoringGeneratedCommandListListAttributeCallbackBridge(queue, completion); + std::move(*bridge).DispatchLocalAction(clusterStateCacheContainer.baseDevice, + ^(ClientMonitoringGeneratedCommandListListAttributeCallback successCb, MTRErrorCallback failureCb) { + if (clusterStateCacheContainer.cppClusterStateCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = ClientMonitoring::Attributes::GeneratedCommandList::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = clusterStateCacheContainer.cppClusterStateCache->Get(path, value); + if (err == CHIP_NO_ERROR) { + successCb(bridge, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + MTRReadParams * params = [[MTRReadParams alloc] init]; + using TypeInfo = ClientMonitoring::Attributes::AcceptedCommandList::TypeInfo; + return MTRReadAttribute( + params, completion, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); +} + +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler: + (void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClientMonitoring::Attributes::AcceptedCommandList::TypeInfo; + MTRSubscribeAttribute(params, subscriptionEstablished, reportHandler, self.callbackQueue, self.device, self->_endpoint, + TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); +} + ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion: + (void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + auto * bridge = new MTRClientMonitoringAcceptedCommandListListAttributeCallbackBridge(queue, completion); + std::move(*bridge).DispatchLocalAction(clusterStateCacheContainer.baseDevice, + ^(ClientMonitoringAcceptedCommandListListAttributeCallback successCb, MTRErrorCallback failureCb) { + if (clusterStateCacheContainer.cppClusterStateCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = ClientMonitoring::Attributes::AcceptedCommandList::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = clusterStateCacheContainer.cppClusterStateCache->Get(path, value); + if (err == CHIP_NO_ERROR) { + successCb(bridge, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + MTRReadParams * params = [[MTRReadParams alloc] init]; + using TypeInfo = ClientMonitoring::Attributes::AttributeList::TypeInfo; + return MTRReadAttribute( + params, completion, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); +} + +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClientMonitoring::Attributes::AttributeList::TypeInfo; + MTRSubscribeAttribute(params, subscriptionEstablished, reportHandler, self.callbackQueue, self.device, self->_endpoint, + TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); +} + ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + auto * bridge = new MTRClientMonitoringAttributeListListAttributeCallbackBridge(queue, completion); + std::move(*bridge).DispatchLocalAction(clusterStateCacheContainer.baseDevice, + ^(ClientMonitoringAttributeListListAttributeCallback successCb, MTRErrorCallback failureCb) { + if (clusterStateCacheContainer.cppClusterStateCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = ClientMonitoring::Attributes::AttributeList::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = clusterStateCacheContainer.cppClusterStateCache->Get(path, value); + if (err == CHIP_NO_ERROR) { + successCb(bridge, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + MTRReadParams * params = [[MTRReadParams alloc] init]; + using TypeInfo = ClientMonitoring::Attributes::FeatureMap::TypeInfo; + return MTRReadAttribute( + params, completion, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); +} + +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClientMonitoring::Attributes::FeatureMap::TypeInfo; + MTRSubscribeAttribute(params, + subscriptionEstablished, reportHandler, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), + TypeInfo::GetAttributeId()); +} + ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + auto * bridge = new MTRInt32uAttributeCallbackBridge(queue, completion); + std::move(*bridge).DispatchLocalAction( + clusterStateCacheContainer.baseDevice, ^(Int32uAttributeCallback successCb, MTRErrorCallback failureCb) { + if (clusterStateCacheContainer.cppClusterStateCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = ClientMonitoring::Attributes::FeatureMap::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = clusterStateCacheContainer.cppClusterStateCache->Get(path, value); + if (err == CHIP_NO_ERROR) { + successCb(bridge, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + MTRReadParams * params = [[MTRReadParams alloc] init]; + using TypeInfo = ClientMonitoring::Attributes::ClusterRevision::TypeInfo; + return MTRReadAttribute( + params, completion, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); +} + +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClientMonitoring::Attributes::ClusterRevision::TypeInfo; + MTRSubscribeAttribute(params, + subscriptionEstablished, reportHandler, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), + TypeInfo::GetAttributeId()); +} + ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + auto * bridge = new MTRInt16uAttributeCallbackBridge(queue, completion); + std::move(*bridge).DispatchLocalAction( + clusterStateCacheContainer.baseDevice, ^(Int16uAttributeCallback successCb, MTRErrorCallback failureCb) { + if (clusterStateCacheContainer.cppClusterStateCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = ClientMonitoring::Attributes::ClusterRevision::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = clusterStateCacheContainer.cppClusterStateCache->Get(path, value); + if (err == CHIP_NO_ERROR) { + successCb(bridge, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +@end + +@implementation MTRBaseClusterClientMonitoring (Deprecated) + +- (void)registerClientMonitoringWithParams:(MTRClientMonitoringClusterRegisterClientMonitoringParams *)params + completionHandler:(MTRStatusCompletion)completionHandler +{ + [self registerClientMonitoringWithParams:params completion:completionHandler]; +} +- (void)unregisterClientMonitoringWithParams:(MTRClientMonitoringClusterUnregisterClientMonitoringParams *)params + completionHandler:(MTRStatusCompletion)completionHandler +{ + [self unregisterClientMonitoringWithParams:params completion:completionHandler]; +} +- (void)stayAwakeRequestWithParams:(MTRClientMonitoringClusterStayAwakeRequestParams * _Nullable)params + completionHandler:(MTRStatusCompletion)completionHandler +{ + [self stayAwakeRequestWithParams:params completion:completionHandler]; +} +- (void)stayAwakeRequestWithCompletionHandler:(MTRStatusCompletion)completionHandler +{ + [self stayAwakeRequestWithParams:nil completionHandler:completionHandler]; +} + +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +{ + return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; +} + +@end + @implementation MTRBaseClusterUnitTesting - (instancetype)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters_Internal.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters_Internal.h index 333bc902185570..065387a01f13a6 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters_Internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters_Internal.h @@ -342,6 +342,11 @@ @property (nonatomic, assign, readonly) chip::EndpointId endpoint; @end +@interface MTRBaseClusterClientMonitoring () +@property (nonatomic, strong, readonly) MTRBaseDevice * device; +@property (nonatomic, assign, readonly) chip::EndpointId endpoint; +@end + @interface MTRBaseClusterUnitTesting () @property (nonatomic, strong, readonly) MTRBaseDevice * device; @property (nonatomic, assign, readonly) chip::EndpointId endpoint; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.h b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.h index c3d79ef81d5c97..54c0fb4dc1f5fe 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.h @@ -1074,6 +1074,16 @@ typedef void (*ElectricalMeasurementAcceptedCommandListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); typedef void (*ElectricalMeasurementAttributeListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*ClientMonitoringExpectedClientsListAttributeCallback)( + void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::ClientMonitoring::Structs::MonitoringRegistration::DecodableType> & data); +typedef void (*ClientMonitoringGeneratedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*ClientMonitoringAcceptedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*ClientMonitoringAttributeListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); typedef void (*UnitTestingBitmap8AttributeCallback)(void *, chip::BitMask); typedef void (*UnitTestingBitmap16AttributeCallback)(void *, chip::BitMask); typedef void (*UnitTestingBitmap32AttributeCallback)(void *, chip::BitMask); @@ -10234,6 +10244,140 @@ class MTRElectricalMeasurementAttributeListListAttributeCallbackSubscriptionBrid MTRSubscriptionEstablishedHandler mEstablishedHandler; }; +class MTRClientMonitoringExpectedClientsListAttributeCallbackBridge + : public MTRCallbackBridge +{ +public: + MTRClientMonitoringExpectedClientsListAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler) : + MTRCallbackBridge(queue, handler, OnSuccessFn){}; + + MTRClientMonitoringExpectedClientsListAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + MTRActionBlock action) : + MTRCallbackBridge(queue, handler, action, OnSuccessFn){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::ClientMonitoring::Structs::MonitoringRegistration::DecodableType> & value); +}; + +class MTRClientMonitoringExpectedClientsListAttributeCallbackSubscriptionBridge + : public MTRClientMonitoringExpectedClientsListAttributeCallbackBridge +{ +public: + MTRClientMonitoringExpectedClientsListAttributeCallbackSubscriptionBridge( + dispatch_queue_t queue, ResponseHandler handler, MTRActionBlock action, + MTRSubscriptionEstablishedHandler establishedHandler) : + MTRClientMonitoringExpectedClientsListAttributeCallbackBridge(queue, handler, action), + mEstablishedHandler(establishedHandler) + {} + + void OnSubscriptionEstablished(); + using MTRClientMonitoringExpectedClientsListAttributeCallbackBridge::KeepAliveOnCallback; + using MTRClientMonitoringExpectedClientsListAttributeCallbackBridge::OnDone; + +private: + MTRSubscriptionEstablishedHandler mEstablishedHandler; +}; + +class MTRClientMonitoringGeneratedCommandListListAttributeCallbackBridge + : public MTRCallbackBridge +{ +public: + MTRClientMonitoringGeneratedCommandListListAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler) : + MTRCallbackBridge(queue, handler, OnSuccessFn){}; + + MTRClientMonitoringGeneratedCommandListListAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + MTRActionBlock action) : + MTRCallbackBridge(queue, handler, action, OnSuccessFn){}; + + static void OnSuccessFn(void * context, const chip::app::DataModel::DecodableList & value); +}; + +class MTRClientMonitoringGeneratedCommandListListAttributeCallbackSubscriptionBridge + : public MTRClientMonitoringGeneratedCommandListListAttributeCallbackBridge +{ +public: + MTRClientMonitoringGeneratedCommandListListAttributeCallbackSubscriptionBridge( + dispatch_queue_t queue, ResponseHandler handler, MTRActionBlock action, + MTRSubscriptionEstablishedHandler establishedHandler) : + MTRClientMonitoringGeneratedCommandListListAttributeCallbackBridge(queue, handler, action), + mEstablishedHandler(establishedHandler) + {} + + void OnSubscriptionEstablished(); + using MTRClientMonitoringGeneratedCommandListListAttributeCallbackBridge::KeepAliveOnCallback; + using MTRClientMonitoringGeneratedCommandListListAttributeCallbackBridge::OnDone; + +private: + MTRSubscriptionEstablishedHandler mEstablishedHandler; +}; + +class MTRClientMonitoringAcceptedCommandListListAttributeCallbackBridge + : public MTRCallbackBridge +{ +public: + MTRClientMonitoringAcceptedCommandListListAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler) : + MTRCallbackBridge(queue, handler, OnSuccessFn){}; + + MTRClientMonitoringAcceptedCommandListListAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + MTRActionBlock action) : + MTRCallbackBridge(queue, handler, action, OnSuccessFn){}; + + static void OnSuccessFn(void * context, const chip::app::DataModel::DecodableList & value); +}; + +class MTRClientMonitoringAcceptedCommandListListAttributeCallbackSubscriptionBridge + : public MTRClientMonitoringAcceptedCommandListListAttributeCallbackBridge +{ +public: + MTRClientMonitoringAcceptedCommandListListAttributeCallbackSubscriptionBridge( + dispatch_queue_t queue, ResponseHandler handler, MTRActionBlock action, + MTRSubscriptionEstablishedHandler establishedHandler) : + MTRClientMonitoringAcceptedCommandListListAttributeCallbackBridge(queue, handler, action), + mEstablishedHandler(establishedHandler) + {} + + void OnSubscriptionEstablished(); + using MTRClientMonitoringAcceptedCommandListListAttributeCallbackBridge::KeepAliveOnCallback; + using MTRClientMonitoringAcceptedCommandListListAttributeCallbackBridge::OnDone; + +private: + MTRSubscriptionEstablishedHandler mEstablishedHandler; +}; + +class MTRClientMonitoringAttributeListListAttributeCallbackBridge + : public MTRCallbackBridge +{ +public: + MTRClientMonitoringAttributeListListAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler) : + MTRCallbackBridge(queue, handler, OnSuccessFn){}; + + MTRClientMonitoringAttributeListListAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + MTRActionBlock action) : + MTRCallbackBridge(queue, handler, action, OnSuccessFn){}; + + static void OnSuccessFn(void * context, const chip::app::DataModel::DecodableList & value); +}; + +class MTRClientMonitoringAttributeListListAttributeCallbackSubscriptionBridge + : public MTRClientMonitoringAttributeListListAttributeCallbackBridge +{ +public: + MTRClientMonitoringAttributeListListAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, ResponseHandler handler, + MTRActionBlock action, + MTRSubscriptionEstablishedHandler establishedHandler) : + MTRClientMonitoringAttributeListListAttributeCallbackBridge(queue, handler, action), + mEstablishedHandler(establishedHandler) + {} + + void OnSubscriptionEstablished(); + using MTRClientMonitoringAttributeListListAttributeCallbackBridge::KeepAliveOnCallback; + using MTRClientMonitoringAttributeListListAttributeCallbackBridge::OnDone; + +private: + MTRSubscriptionEstablishedHandler mEstablishedHandler; +}; + class MTRUnitTestingBitmap8AttributeCallbackBridge : public MTRCallbackBridge { public: diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm index e7f3cb9bb21ced..b63df8097eb31d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm @@ -10413,6 +10413,162 @@ } } +void MTRClientMonitoringExpectedClientsListAttributeCallbackBridge::OnSuccessFn(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::ClientMonitoring::Structs::MonitoringRegistration::DecodableType> & value) +{ + NSArray * _Nonnull objCValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = value.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRClientMonitoringClusterMonitoringRegistration * newElement_0; + newElement_0 = [MTRClientMonitoringClusterMonitoringRegistration new]; + newElement_0.clientNodeId = [NSNumber numberWithUnsignedLongLong:entry_0.clientNodeId]; + newElement_0.iCid = [NSNumber numberWithUnsignedLongLong:entry_0.ICid]; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + OnFailureFn(context, err); + return; + } + objCValue = array_0; + } + DispatchSuccess(context, objCValue); +}; + +void MTRClientMonitoringExpectedClientsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished() +{ + if (!mQueue) { + return; + } + + if (mEstablishedHandler != nil) { + dispatch_async(mQueue, mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + mEstablishedHandler = nil; + } +} + +void MTRClientMonitoringGeneratedCommandListListAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::DecodableList & value) +{ + NSArray * _Nonnull objCValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = value.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + OnFailureFn(context, err); + return; + } + objCValue = array_0; + } + DispatchSuccess(context, objCValue); +}; + +void MTRClientMonitoringGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished() +{ + if (!mQueue) { + return; + } + + if (mEstablishedHandler != nil) { + dispatch_async(mQueue, mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + mEstablishedHandler = nil; + } +} + +void MTRClientMonitoringAcceptedCommandListListAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::DecodableList & value) +{ + NSArray * _Nonnull objCValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = value.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + OnFailureFn(context, err); + return; + } + objCValue = array_0; + } + DispatchSuccess(context, objCValue); +}; + +void MTRClientMonitoringAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished() +{ + if (!mQueue) { + return; + } + + if (mEstablishedHandler != nil) { + dispatch_async(mQueue, mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + mEstablishedHandler = nil; + } +} + +void MTRClientMonitoringAttributeListListAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::DecodableList & value) +{ + NSArray * _Nonnull objCValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = value.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + OnFailureFn(context, err); + return; + } + objCValue = array_0; + } + DispatchSuccess(context, objCValue); +}; + +void MTRClientMonitoringAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished() +{ + if (!mQueue) { + return; + } + + if (mEstablishedHandler != nil) { + dispatch_async(mQueue, mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + mEstablishedHandler = nil; + } +} + void MTRUnitTestingBitmap8AttributeCallbackBridge::OnSuccessFn( void * context, chip::BitMask value) { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 2a33847365f571..b8fe172dc3dafa 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -6596,7 +6596,8 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { // Cluster ClientMonitoring commands MTRCommandIDTypeClusterClientMonitoringCommandRegisterClientMonitoringID MTR_NEWLY_AVAILABLE = 0x00000000, - MTRCommandIDTypeClusterClientMonitoringCommandStayAwakeRequestID MTR_NEWLY_AVAILABLE = 0x00000001, + MTRCommandIDTypeClusterClientMonitoringCommandUnregisterClientMonitoringID MTR_NEWLY_AVAILABLE = 0x00000001, + MTRCommandIDTypeClusterClientMonitoringCommandStayAwakeRequestID MTR_NEWLY_AVAILABLE = 0x00000002, // Cluster TestCluster deprecated command id names MTRClusterTestClusterCommandTestID API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index c374d5bc9a260e..b5fde881dbaed7 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -5867,6 +5867,56 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @end +/** + * Cluster Client Monitoring + * Client Monitoring allows for ensuring that listed clients meet the required monitoring conditions on the server. + */ +MTR_NEWLY_AVAILABLE +@interface MTRClusterClientMonitoring : MTRCluster + +- (instancetype _Nullable)initWithDevice:(MTRDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_NEWLY_AVAILABLE; + +- (void)registerClientMonitoringWithParams:(MTRClientMonitoringClusterRegisterClientMonitoringParams *)params + expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries + expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs + completion:(MTRStatusCompletion)completion MTR_NEWLY_AVAILABLE; +- (void)unregisterClientMonitoringWithParams:(MTRClientMonitoringClusterUnregisterClientMonitoringParams *)params + expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries + expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs + completion:(MTRStatusCompletion)completion MTR_NEWLY_AVAILABLE; +- (void)stayAwakeRequestWithParams:(MTRClientMonitoringClusterStayAwakeRequestParams * _Nullable)params + expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries + expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs + completion:(MTRStatusCompletion)completion MTR_NEWLY_AVAILABLE; +- (void)stayAwakeRequestWithExpectedValues:(NSArray *> *)expectedValues + expectedValueInterval:(NSNumber *)expectedValueIntervalMs + completion:(MTRStatusCompletion)completion MTR_NEWLY_AVAILABLE; + +- (NSDictionary *)readAttributeIdleModeIntervalWithParams:(MTRReadParams * _Nullable)params MTR_NEWLY_AVAILABLE; + +- (NSDictionary *)readAttributeActiveModeIntervalWithParams:(MTRReadParams * _Nullable)params MTR_NEWLY_AVAILABLE; + +- (NSDictionary *)readAttributeActiveModeThresholdWithParams:(MTRReadParams * _Nullable)params MTR_NEWLY_AVAILABLE; + +- (NSDictionary *)readAttributeExpectedClientsWithParams:(MTRReadParams * _Nullable)params MTR_NEWLY_AVAILABLE; + +- (NSDictionary *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_NEWLY_AVAILABLE; + +- (NSDictionary *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_NEWLY_AVAILABLE; + +- (NSDictionary *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params MTR_NEWLY_AVAILABLE; + +- (NSDictionary *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params MTR_NEWLY_AVAILABLE; + +- (NSDictionary *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params MTR_NEWLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + /** * Cluster Unit Testing * The Test Cluster is meant to validate the generated code diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 404f5c3c808789..4ee84b4908302a 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -25636,6 +25636,324 @@ - (void)getMeasurementProfileCommandWithParams:(MTRElectricalMeasurementClusterG } @end +@implementation MTRClusterClientMonitoring + +- (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue +{ + if (self = [super initWithQueue:queue]) { + if (device == nil) { + return nil; + } + + _endpoint = [endpointID unsignedShortValue]; + _device = device; + } + return self; +} + +- (void)registerClientMonitoringWithParams:(MTRClientMonitoringClusterRegisterClientMonitoringParams *)params + expectedValues:(NSArray *> *)expectedValues + expectedValueInterval:(NSNumber *)expectedValueIntervalMs + completion:(MTRStatusCompletion)completion +{ + NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, + _endpoint, (unsigned int) MTRClusterIDTypeClientMonitoringID, + (unsigned int) MTRCommandIDTypeClusterClientMonitoringCommandRegisterClientMonitoringID]; + // Make a copy of params before we go async. + params = [params copy]; + NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMsParam) { + timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); + } + MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID + controller:self.device.deviceController]; + auto * bridge = new MTRCommandSuccessCallbackBridge( + self.device.queue, + ^(id _Nullable value, NSError * _Nullable error) { + MTRClustersLogCompletion(logPrefix, value, error); + dispatch_async(self.callbackQueue, ^{ + completion(error); + }); + [workItem endWork]; + }, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, + MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { + chip::Optional timedInvokeTimeoutMs; + ListFreer listFreer; + ClientMonitoring::Commands::RegisterClientMonitoring::Type request; + if (timedInvokeTimeoutMsParam != nil) { + timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); + } + request.clientNodeId = params.clientNodeId.unsignedLongLongValue; + request.ICid = params.iCid.unsignedLongLongValue; + + chip::Controller::ClientMonitoringCluster cppCluster(exchangeManager, session, self->_endpoint); + return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); + }); + std::move(*bridge).DispatchAction(baseDevice); + }; + workItem.readyHandler = readyHandler; + MTRClustersLogEnqueue(logPrefix, self.device.asyncCallbackWorkQueue); + [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; + + if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { + expectedValues = nil; + } else { + expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); + } + if (expectedValues) { + [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; + } +} + +- (void)unregisterClientMonitoringWithParams:(MTRClientMonitoringClusterUnregisterClientMonitoringParams *)params + expectedValues:(NSArray *> *)expectedValues + expectedValueInterval:(NSNumber *)expectedValueIntervalMs + completion:(MTRStatusCompletion)completion +{ + NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, + _endpoint, (unsigned int) MTRClusterIDTypeClientMonitoringID, + (unsigned int) MTRCommandIDTypeClusterClientMonitoringCommandUnregisterClientMonitoringID]; + // Make a copy of params before we go async. + params = [params copy]; + NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMsParam) { + timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); + } + MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID + controller:self.device.deviceController]; + auto * bridge = new MTRCommandSuccessCallbackBridge( + self.device.queue, + ^(id _Nullable value, NSError * _Nullable error) { + MTRClustersLogCompletion(logPrefix, value, error); + dispatch_async(self.callbackQueue, ^{ + completion(error); + }); + [workItem endWork]; + }, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, + MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { + chip::Optional timedInvokeTimeoutMs; + ListFreer listFreer; + ClientMonitoring::Commands::UnregisterClientMonitoring::Type request; + if (timedInvokeTimeoutMsParam != nil) { + timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); + } + request.clientNodeId = params.clientNodeId.unsignedLongLongValue; + request.ICid = params.iCid.unsignedLongLongValue; + + chip::Controller::ClientMonitoringCluster cppCluster(exchangeManager, session, self->_endpoint); + return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); + }); + std::move(*bridge).DispatchAction(baseDevice); + }; + workItem.readyHandler = readyHandler; + MTRClustersLogEnqueue(logPrefix, self.device.asyncCallbackWorkQueue); + [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; + + if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { + expectedValues = nil; + } else { + expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); + } + if (expectedValues) { + [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; + } +} + +- (void)stayAwakeRequestWithExpectedValues:(NSArray *> *)expectedValues + expectedValueInterval:(NSNumber *)expectedValueIntervalMs + completion:(MTRStatusCompletion)completion +{ + [self stayAwakeRequestWithParams:nil + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + completion:completion]; +} +- (void)stayAwakeRequestWithParams:(MTRClientMonitoringClusterStayAwakeRequestParams * _Nullable)params + expectedValues:(NSArray *> *)expectedValues + expectedValueInterval:(NSNumber *)expectedValueIntervalMs + completion:(MTRStatusCompletion)completion +{ + NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, + _endpoint, (unsigned int) MTRClusterIDTypeClientMonitoringID, + (unsigned int) MTRCommandIDTypeClusterClientMonitoringCommandStayAwakeRequestID]; + // Make a copy of params before we go async. + params = [params copy]; + NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMsParam) { + timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); + } + MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID + controller:self.device.deviceController]; + auto * bridge = new MTRCommandSuccessCallbackBridge( + self.device.queue, + ^(id _Nullable value, NSError * _Nullable error) { + MTRClustersLogCompletion(logPrefix, value, error); + dispatch_async(self.callbackQueue, ^{ + completion(error); + }); + [workItem endWork]; + }, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, + MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { + chip::Optional timedInvokeTimeoutMs; + ListFreer listFreer; + ClientMonitoring::Commands::StayAwakeRequest::Type request; + if (timedInvokeTimeoutMsParam != nil) { + timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); + } + + chip::Controller::ClientMonitoringCluster cppCluster(exchangeManager, session, self->_endpoint); + return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); + }); + std::move(*bridge).DispatchAction(baseDevice); + }; + workItem.readyHandler = readyHandler; + MTRClustersLogEnqueue(logPrefix, self.device.asyncCallbackWorkQueue); + [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; + + if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { + expectedValues = nil; + } else { + expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); + } + if (expectedValues) { + [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; + } +} + +- (NSDictionary *)readAttributeIdleModeIntervalWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(_endpoint) + clusterID:@(MTRClusterIDTypeClientMonitoringID) + attributeID:@(MTRAttributeIDTypeClusterClientMonitoringAttributeIdleModeIntervalID) + params:params]; +} + +- (NSDictionary *)readAttributeActiveModeIntervalWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(_endpoint) + clusterID:@(MTRClusterIDTypeClientMonitoringID) + attributeID:@(MTRAttributeIDTypeClusterClientMonitoringAttributeActiveModeIntervalID) + params:params]; +} + +- (NSDictionary *)readAttributeActiveModeThresholdWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(_endpoint) + clusterID:@(MTRClusterIDTypeClientMonitoringID) + attributeID:@(MTRAttributeIDTypeClusterClientMonitoringAttributeActiveModeThresholdID) + params:params]; +} + +- (NSDictionary *)readAttributeExpectedClientsWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(_endpoint) + clusterID:@(MTRClusterIDTypeClientMonitoringID) + attributeID:@(MTRAttributeIDTypeClusterClientMonitoringAttributeExpectedClientsID) + params:params]; +} + +- (NSDictionary *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(_endpoint) + clusterID:@(MTRClusterIDTypeClientMonitoringID) + attributeID:@(MTRAttributeIDTypeClusterClientMonitoringAttributeGeneratedCommandListID) + params:params]; +} + +- (NSDictionary *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(_endpoint) + clusterID:@(MTRClusterIDTypeClientMonitoringID) + attributeID:@(MTRAttributeIDTypeClusterClientMonitoringAttributeAcceptedCommandListID) + params:params]; +} + +- (NSDictionary *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(_endpoint) + clusterID:@(MTRClusterIDTypeClientMonitoringID) + attributeID:@(MTRAttributeIDTypeClusterClientMonitoringAttributeAttributeListID) + params:params]; +} + +- (NSDictionary *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(_endpoint) + clusterID:@(MTRClusterIDTypeClientMonitoringID) + attributeID:@(MTRAttributeIDTypeClusterClientMonitoringAttributeFeatureMapID) + params:params]; +} + +- (NSDictionary *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(_endpoint) + clusterID:@(MTRClusterIDTypeClientMonitoringID) + attributeID:@(MTRAttributeIDTypeClusterClientMonitoringAttributeClusterRevisionID) + params:params]; +} + +@end + +@implementation MTRClusterClientMonitoring (Deprecated) + +- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +{ + return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; +} + +- (void)registerClientMonitoringWithParams:(MTRClientMonitoringClusterRegisterClientMonitoringParams *)params + expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries + expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs + completionHandler:(MTRStatusCompletion)completionHandler +{ + [self registerClientMonitoringWithParams:params + expectedValues:expectedDataValueDictionaries + expectedValueInterval:expectedValueIntervalMs + completion:completionHandler]; +} +- (void)unregisterClientMonitoringWithParams:(MTRClientMonitoringClusterUnregisterClientMonitoringParams *)params + expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries + expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs + completionHandler:(MTRStatusCompletion)completionHandler +{ + [self unregisterClientMonitoringWithParams:params + expectedValues:expectedDataValueDictionaries + expectedValueInterval:expectedValueIntervalMs + completion:completionHandler]; +} +- (void)stayAwakeRequestWithParams:(MTRClientMonitoringClusterStayAwakeRequestParams * _Nullable)params + expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries + expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs + completionHandler:(MTRStatusCompletion)completionHandler +{ + [self stayAwakeRequestWithParams:params + expectedValues:expectedDataValueDictionaries + expectedValueInterval:expectedValueIntervalMs + completion:completionHandler]; +} +- (void)stayAwakeRequestWithExpectedValues:(NSArray *> *)expectedValues + expectedValueInterval:(NSNumber *)expectedValueIntervalMs + completionHandler:(MTRStatusCompletion)completionHandler +{ + [self stayAwakeRequestWithParams:nil + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + completionHandler:completionHandler]; +} +@end + @implementation MTRClusterUnitTesting - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters_Internal.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters_Internal.h index fe4cc255dcb8f5..84d58b18bd299a 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters_Internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters_Internal.h @@ -343,6 +343,11 @@ @property (nonatomic, readonly) MTRDevice * device; @end +@interface MTRClusterClientMonitoring () +@property (nonatomic, readonly) uint16_t endpoint; +@property (nonatomic, readonly) MTRDevice * device; +@end + @interface MTRClusterUnitTesting () @property (nonatomic, readonly) uint16_t endpoint; @property (nonatomic, readonly) MTRDevice * device; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index ce896e4df4794b..4daf8479567632 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -5195,6 +5195,29 @@ MTR_NEWLY_AVAILABLE @property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; @end +MTR_NEWLY_AVAILABLE +@interface MTRClientMonitoringClusterUnregisterClientMonitoringParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull clientNodeId MTR_NEWLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nonnull iCid MTR_NEWLY_AVAILABLE; +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the sever to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; +@end + MTR_NEWLY_AVAILABLE @interface MTRClientMonitoringClusterStayAwakeRequestParams : NSObject /** diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index efc4fee32f2c5d..861638c62c5da4 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -7194,6 +7194,38 @@ - (NSString *)description return descriptionString; } +@end +@implementation MTRClientMonitoringClusterUnregisterClientMonitoringParams +- (instancetype)init +{ + if (self = [super init]) { + + _clientNodeId = @(0); + + _iCid = @(0); + _timedInvokeTimeoutMs = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRClientMonitoringClusterUnregisterClientMonitoringParams alloc] init]; + + other.clientNodeId = self.clientNodeId; + other.iCid = self.iCid; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = + [NSString stringWithFormat:@"<%@: clientNodeId:%@; iCid:%@; >", NSStringFromClass([self class]), _clientNodeId, _iCid]; + return descriptionString; +} + @end @implementation MTRClientMonitoringClusterStayAwakeRequestParams - (instancetype)init diff --git a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm index a2fa781704a557..cd9d590301347d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm @@ -2256,6 +2256,16 @@ id MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVReader & aRead } break; } + case Clusters::ClientMonitoring::Id: { + using namespace Clusters::ClientMonitoring; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + break; + } + break; + } case Clusters::UnitTesting::Id: { using namespace Clusters::UnitTesting; switch (aPath.mEventId) { diff --git a/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp index 8f61a4bc3c38c3..fd7f7dc56103e7 100644 --- a/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp @@ -145,6 +145,54 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } // namespace BarrierControl +namespace ClientMonitoring { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::RegisterClientMonitoring::Id: { + Commands::RegisterClientMonitoring::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = + emberAfClientMonitoringClusterRegisterClientMonitoringCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::UnregisterClientMonitoring::Id: { + Commands::UnregisterClientMonitoring::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = + emberAfClientMonitoringClusterUnregisterClientMonitoringCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace ClientMonitoring + namespace ColorControl { void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) @@ -2063,6 +2111,9 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: case Clusters::BarrierControl::Id: Clusters::BarrierControl::DispatchServerCommand(apCommandObj, aCommandPath, aReader); break; + case Clusters::ClientMonitoring::Id: + Clusters::ClientMonitoring::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; case Clusters::ColorControl::Id: Clusters::ColorControl::DispatchServerCommand(apCommandObj, aCommandPath, aReader); break; diff --git a/zzz_generated/all-clusters-app/zap-generated/access.h b/zzz_generated/all-clusters-app/zap-generated/access.h index 1a450a728ed1d0..27aa6ad3619bd9 100644 --- a/zzz_generated/all-clusters-app/zap-generated/access.h +++ b/zzz_generated/all-clusters-app/zap-generated/access.h @@ -430,6 +430,8 @@ 257, /* Cluster: Door Lock, Command: SetCredential, Privilege: administer */ \ 257, /* Cluster: Door Lock, Command: GetCredentialStatus, Privilege: administer */ \ 257, /* Cluster: Door Lock, Command: ClearCredential, Privilege: administer */ \ + 4166, /* Cluster: Client Monitoring, Command: RegisterClientMonitoring, Privilege: manage */ \ + 4166, /* Cluster: Client Monitoring, Command: UnregisterClientMonitoring, Privilege: manage */ \ 4294048774, /* Cluster: Fault Injection, Command: FailAtFault, Privilege: manage */ \ 4294048774, /* Cluster: Fault Injection, Command: FailRandomlyAtFault, Privilege: manage */ \ } @@ -482,6 +484,8 @@ 34, /* Cluster: Door Lock, Command: SetCredential, Privilege: administer */ \ 36, /* Cluster: Door Lock, Command: GetCredentialStatus, Privilege: administer */ \ 38, /* Cluster: Door Lock, Command: ClearCredential, Privilege: administer */ \ + 0, /* Cluster: Client Monitoring, Command: RegisterClientMonitoring, Privilege: manage */ \ + 1, /* Cluster: Client Monitoring, Command: UnregisterClientMonitoring, Privilege: manage */ \ 0, /* Cluster: Fault Injection, Command: FailAtFault, Privilege: manage */ \ 1, /* Cluster: Fault Injection, Command: FailRandomlyAtFault, Privilege: manage */ \ } @@ -534,6 +538,8 @@ kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: SetCredential, Privilege: administer */ \ kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: GetCredentialStatus, Privilege: administer */ \ kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: ClearCredential, Privilege: administer */ \ + kMatterAccessPrivilegeManage, /* Cluster: Client Monitoring, Command: RegisterClientMonitoring, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Client Monitoring, Command: UnregisterClientMonitoring, Privilege: manage */ \ kMatterAccessPrivilegeManage, /* Cluster: Fault Injection, Command: FailAtFault, Privilege: manage */ \ kMatterAccessPrivilegeManage, /* Cluster: Fault Injection, Command: FailRandomlyAtFault, Privilege: manage */ \ } diff --git a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h index c1bc090a1ca4dc..34ef6a4b852d51 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -369,7 +369,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 718 +#define GENERATED_ATTRIBUTE_COUNT 724 #define GENERATED_ATTRIBUTES \ { \ \ @@ -761,6 +761,14 @@ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ \ + /* Endpoint: 0, Cluster: Client Monitoring (server) */ \ + { 0x00000000, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x12C) }, /* IdleModeInterval */ \ + { 0x00000001, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x12C) }, /* ActiveModeInterval */ \ + { 0x00000002, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0xFA0) }, /* ActiveModeThreshold */ \ + { 0x00000003, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* ExpectedClients */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ /* Endpoint: 0, Cluster: Fault Injection (server) */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ @@ -1672,18 +1680,23 @@ 0x00000002 /* KeySetReadResponse */, \ 0x00000005 /* KeySetReadAllIndicesResponse */, \ chip::kInvalidCommandId /* end of list */, \ - /* Endpoint: 0, Cluster: Fault Injection (server) */\ + /* Endpoint: 0, Cluster: Client Monitoring (server) */\ /* AcceptedCommandList (index=76) */ \ + 0x00000000 /* RegisterClientMonitoring */, \ + 0x00000001 /* UnregisterClientMonitoring */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: Fault Injection (server) */\ + /* AcceptedCommandList (index=79) */ \ 0x00000000 /* FailAtFault */, \ 0x00000001 /* FailRandomlyAtFault */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Identify (server) */\ - /* AcceptedCommandList (index=79) */ \ + /* AcceptedCommandList (index=82) */ \ 0x00000000 /* Identify */, \ 0x00000040 /* TriggerEffect */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Groups (server) */\ - /* AcceptedCommandList (index=82) */ \ + /* AcceptedCommandList (index=85) */ \ 0x00000000 /* AddGroup */, \ 0x00000001 /* ViewGroup */, \ 0x00000002 /* GetGroupMembership */, \ @@ -1691,14 +1704,14 @@ 0x00000004 /* RemoveAllGroups */, \ 0x00000005 /* AddGroupIfIdentifying */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=89)*/ \ + /* GeneratedCommandList (index=92)*/ \ 0x00000000 /* AddGroupResponse */, \ 0x00000001 /* ViewGroupResponse */, \ 0x00000002 /* GetGroupMembershipResponse */, \ 0x00000003 /* RemoveGroupResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Scenes (server) */\ - /* AcceptedCommandList (index=94) */ \ + /* AcceptedCommandList (index=97) */ \ 0x00000000 /* AddScene */, \ 0x00000001 /* ViewScene */, \ 0x00000002 /* RemoveScene */, \ @@ -1707,7 +1720,7 @@ 0x00000005 /* RecallScene */, \ 0x00000006 /* GetSceneMembership */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=102)*/ \ + /* GeneratedCommandList (index=105)*/ \ 0x00000000 /* AddSceneResponse */, \ 0x00000001 /* ViewSceneResponse */, \ 0x00000002 /* RemoveSceneResponse */, \ @@ -1716,7 +1729,7 @@ 0x00000006 /* GetSceneMembershipResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: On/Off (server) */\ - /* AcceptedCommandList (index=109) */ \ + /* AcceptedCommandList (index=112) */ \ 0x00000000 /* Off */, \ 0x00000001 /* On */, \ 0x00000002 /* Toggle */, \ @@ -1725,7 +1738,7 @@ 0x00000042 /* OnWithTimedOff */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Level Control (server) */\ - /* AcceptedCommandList (index=116) */ \ + /* AcceptedCommandList (index=119) */ \ 0x00000000 /* MoveToLevel */, \ 0x00000001 /* Move */, \ 0x00000002 /* Step */, \ @@ -1736,11 +1749,11 @@ 0x00000007 /* StopWithOnOff */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Mode Select (server) */\ - /* AcceptedCommandList (index=125) */ \ + /* AcceptedCommandList (index=128) */ \ 0x00000000 /* ChangeToMode */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Door Lock (server) */\ - /* AcceptedCommandList (index=127) */ \ + /* AcceptedCommandList (index=130) */ \ 0x00000000 /* LockDoor */, \ 0x00000001 /* UnlockDoor */, \ 0x00000003 /* UnlockWithTimeout */, \ @@ -1756,7 +1769,7 @@ 0x00000024 /* GetCredentialStatus */, \ 0x00000026 /* ClearCredential */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=142)*/ \ + /* GeneratedCommandList (index=145)*/ \ 0x0000000C /* GetWeekDayScheduleResponse */, \ 0x0000000F /* GetYearDayScheduleResponse */, \ 0x0000001C /* GetUserResponse */, \ @@ -1764,7 +1777,7 @@ 0x00000025 /* GetCredentialStatusResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Window Covering (server) */\ - /* AcceptedCommandList (index=148) */ \ + /* AcceptedCommandList (index=151) */ \ 0x00000000 /* UpOrOpen */, \ 0x00000001 /* DownOrClose */, \ 0x00000002 /* StopMotion */, \ @@ -1774,16 +1787,16 @@ 0x00000008 /* GoToTiltPercentage */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Barrier Control (server) */\ - /* AcceptedCommandList (index=156) */ \ + /* AcceptedCommandList (index=159) */ \ 0x00000000 /* BarrierControlGoToPercent */, \ 0x00000001 /* BarrierControlStop */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Thermostat (server) */\ - /* AcceptedCommandList (index=159) */ \ + /* AcceptedCommandList (index=162) */ \ 0x00000000 /* SetpointRaiseLower */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Color Control (server) */\ - /* AcceptedCommandList (index=161) */ \ + /* AcceptedCommandList (index=164) */ \ 0x00000000 /* MoveToHue */, \ 0x00000001 /* MoveHue */, \ 0x00000002 /* StepHue */, \ @@ -1805,32 +1818,32 @@ 0x0000004C /* StepColorTemperature */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Target Navigator (server) */\ - /* AcceptedCommandList (index=181) */ \ + /* AcceptedCommandList (index=184) */ \ 0x00000000 /* NavigateTarget */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=183)*/ \ + /* GeneratedCommandList (index=186)*/ \ 0x00000001 /* NavigateTargetResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Media Input (server) */\ - /* AcceptedCommandList (index=185) */ \ + /* AcceptedCommandList (index=188) */ \ 0x00000000 /* SelectInput */, \ 0x00000001 /* ShowInputStatus */, \ 0x00000002 /* HideInputStatus */, \ 0x00000003 /* RenameInput */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Low Power (server) */\ - /* AcceptedCommandList (index=190) */ \ + /* AcceptedCommandList (index=193) */ \ 0x00000000 /* Sleep */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Keypad Input (server) */\ - /* AcceptedCommandList (index=192) */ \ + /* AcceptedCommandList (index=195) */ \ 0x00000000 /* SendKey */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=194)*/ \ + /* GeneratedCommandList (index=197)*/ \ 0x00000001 /* SendKeyResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Unit Testing (server) */\ - /* AcceptedCommandList (index=196) */ \ + /* AcceptedCommandList (index=199) */ \ 0x00000000 /* Test */, \ 0x00000001 /* TestNotHandled */, \ 0x00000002 /* TestSpecific */, \ @@ -1850,7 +1863,7 @@ 0x00000014 /* TestEmitTestEventRequest */, \ 0x00000015 /* TestEmitTestFabricScopedEventRequest */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=215)*/ \ + /* GeneratedCommandList (index=218)*/ \ 0x00000000 /* TestSpecificResponse */, \ 0x00000001 /* TestAddArgumentsResponse */, \ 0x00000004 /* TestListInt8UReverseResponse */, \ @@ -1862,7 +1875,7 @@ 0x0000000B /* TestEmitTestFabricScopedEventResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 2, Cluster: Groups (server) */\ - /* AcceptedCommandList (index=225) */ \ + /* AcceptedCommandList (index=228) */ \ 0x00000000 /* AddGroup */, \ 0x00000001 /* ViewGroup */, \ 0x00000002 /* GetGroupMembership */, \ @@ -1870,20 +1883,20 @@ 0x00000004 /* RemoveAllGroups */, \ 0x00000005 /* AddGroupIfIdentifying */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=232)*/ \ + /* GeneratedCommandList (index=235)*/ \ 0x00000000 /* AddGroupResponse */, \ 0x00000001 /* ViewGroupResponse */, \ 0x00000002 /* GetGroupMembershipResponse */, \ 0x00000003 /* RemoveGroupResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 2, Cluster: On/Off (server) */\ - /* AcceptedCommandList (index=237) */ \ + /* AcceptedCommandList (index=240) */ \ 0x00000000 /* Off */, \ 0x00000001 /* On */, \ 0x00000002 /* Toggle */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 65534, Cluster: Network Commissioning (server) */\ - /* AcceptedCommandList (index=241) */ \ + /* AcceptedCommandList (index=244) */ \ 0x00000000 /* ScanNetworks */, \ 0x00000002 /* AddOrUpdateWiFiNetwork */, \ 0x00000003 /* AddOrUpdateThreadNetwork */, \ @@ -1891,7 +1904,7 @@ 0x00000006 /* ConnectNetwork */, \ 0x00000008 /* ReorderNetwork */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=248)*/ \ + /* GeneratedCommandList (index=251)*/ \ 0x00000001 /* ScanNetworksResponse */, \ 0x00000005 /* NetworkConfigResponse */, \ 0x00000007 /* ConnectNetworkResponse */, \ @@ -1901,7 +1914,7 @@ // clang-format on #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 78 +#define GENERATED_CLUSTER_COUNT 79 // clang-format off #define GENERATED_CLUSTERS { \ @@ -2202,65 +2215,76 @@ .acceptedCommandList = nullptr ,\ .generatedCommandList = nullptr ,\ },\ + { \ + /* Endpoint: 0, Cluster: Client Monitoring (server) */ \ + .clusterId = 0x00001046, \ + .attributes = ZAP_ATTRIBUTE_INDEX(231), \ + .attributeCount = 6, \ + .clusterSize = 16, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 76 ) ,\ + .generatedCommandList = nullptr ,\ + },\ { \ /* Endpoint: 0, Cluster: Fault Injection (server) */ \ .clusterId = 0xFFF1FC06, \ - .attributes = ZAP_ATTRIBUTE_INDEX(231), \ + .attributes = ZAP_ATTRIBUTE_INDEX(237), \ .attributeCount = 2, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 76 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 79 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Identify (server) */ \ .clusterId = 0x00000003, \ - .attributes = ZAP_ATTRIBUTE_INDEX(233), \ + .attributes = ZAP_ATTRIBUTE_INDEX(239), \ .attributeCount = 4, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayIdentifyServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 79 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 82 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Groups (server) */ \ .clusterId = 0x00000004, \ - .attributes = ZAP_ATTRIBUTE_INDEX(237), \ + .attributes = ZAP_ATTRIBUTE_INDEX(243), \ .attributeCount = 3, \ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayGroupsServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 82 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 89 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 85 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 92 ) ,\ },\ { \ /* Endpoint: 1, Cluster: Scenes (server) */ \ .clusterId = 0x00000005, \ - .attributes = ZAP_ATTRIBUTE_INDEX(240), \ + .attributes = ZAP_ATTRIBUTE_INDEX(246), \ .attributeCount = 7, \ .clusterSize = 12, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayScenesServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 94 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 102 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 97 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 105 ) ,\ },\ { \ /* Endpoint: 1, Cluster: On/Off (server) */ \ .clusterId = 0x00000006, \ - .attributes = ZAP_ATTRIBUTE_INDEX(247), \ + .attributes = ZAP_ATTRIBUTE_INDEX(253), \ .attributeCount = 7, \ .clusterSize = 13, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayOnOffServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 109 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 112 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: On/off Switch Configuration (server) */ \ .clusterId = 0x00000007, \ - .attributes = ZAP_ATTRIBUTE_INDEX(254), \ + .attributes = ZAP_ATTRIBUTE_INDEX(260), \ .attributeCount = 4, \ .clusterSize = 8, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2271,18 +2295,18 @@ { \ /* Endpoint: 1, Cluster: Level Control (server) */ \ .clusterId = 0x00000008, \ - .attributes = ZAP_ATTRIBUTE_INDEX(258), \ + .attributes = ZAP_ATTRIBUTE_INDEX(264), \ .attributeCount = 16, \ .clusterSize = 27, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayLevelControlServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 116 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 119 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Binary Input (Basic) (server) */ \ .clusterId = 0x0000000F, \ - .attributes = ZAP_ATTRIBUTE_INDEX(274), \ + .attributes = ZAP_ATTRIBUTE_INDEX(280), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2293,7 +2317,7 @@ { \ /* Endpoint: 1, Cluster: Descriptor (server) */ \ .clusterId = 0x0000001D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(279), \ + .attributes = ZAP_ATTRIBUTE_INDEX(285), \ .attributeCount = 6, \ .clusterSize = 4, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2304,7 +2328,7 @@ { \ /* Endpoint: 1, Cluster: Binding (server) */ \ .clusterId = 0x0000001E, \ - .attributes = ZAP_ATTRIBUTE_INDEX(285), \ + .attributes = ZAP_ATTRIBUTE_INDEX(291), \ .attributeCount = 3, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2315,7 +2339,7 @@ { \ /* Endpoint: 1, Cluster: Actions (server) */ \ .clusterId = 0x00000025, \ - .attributes = ZAP_ATTRIBUTE_INDEX(288), \ + .attributes = ZAP_ATTRIBUTE_INDEX(294), \ .attributeCount = 5, \ .clusterSize = 4, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2326,7 +2350,7 @@ { \ /* Endpoint: 1, Cluster: Power Source (server) */ \ .clusterId = 0x0000002F, \ - .attributes = ZAP_ATTRIBUTE_INDEX(293), \ + .attributes = ZAP_ATTRIBUTE_INDEX(299), \ .attributeCount = 8, \ .clusterSize = 72, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2337,7 +2361,7 @@ { \ /* Endpoint: 1, Cluster: Switch (server) */ \ .clusterId = 0x0000003B, \ - .attributes = ZAP_ATTRIBUTE_INDEX(301), \ + .attributes = ZAP_ATTRIBUTE_INDEX(307), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2348,7 +2372,7 @@ { \ /* Endpoint: 1, Cluster: Fixed Label (server) */ \ .clusterId = 0x00000040, \ - .attributes = ZAP_ATTRIBUTE_INDEX(306), \ + .attributes = ZAP_ATTRIBUTE_INDEX(312), \ .attributeCount = 3, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2359,7 +2383,7 @@ { \ /* Endpoint: 1, Cluster: User Label (server) */ \ .clusterId = 0x00000041, \ - .attributes = ZAP_ATTRIBUTE_INDEX(309), \ + .attributes = ZAP_ATTRIBUTE_INDEX(315), \ .attributeCount = 3, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2370,7 +2394,7 @@ { \ /* Endpoint: 1, Cluster: Boolean State (server) */ \ .clusterId = 0x00000045, \ - .attributes = ZAP_ATTRIBUTE_INDEX(312), \ + .attributes = ZAP_ATTRIBUTE_INDEX(318), \ .attributeCount = 3, \ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2381,51 +2405,51 @@ { \ /* Endpoint: 1, Cluster: Mode Select (server) */ \ .clusterId = 0x00000050, \ - .attributes = ZAP_ATTRIBUTE_INDEX(315), \ + .attributes = ZAP_ATTRIBUTE_INDEX(321), \ .attributeCount = 9, \ .clusterSize = 45, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayModeSelectServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 125 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 128 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Door Lock (server) */ \ .clusterId = 0x00000101, \ - .attributes = ZAP_ATTRIBUTE_INDEX(324), \ + .attributes = ZAP_ATTRIBUTE_INDEX(330), \ .attributeCount = 33, \ .clusterSize = 55, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayDoorLockServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 127 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 142 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 130 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 145 ) ,\ },\ { \ /* Endpoint: 1, Cluster: Window Covering (server) */ \ .clusterId = 0x00000102, \ - .attributes = ZAP_ATTRIBUTE_INDEX(357), \ + .attributes = ZAP_ATTRIBUTE_INDEX(363), \ .attributeCount = 24, \ .clusterSize = 43, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayWindowCoveringServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 148 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 151 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Barrier Control (server) */ \ .clusterId = 0x00000103, \ - .attributes = ZAP_ATTRIBUTE_INDEX(381), \ + .attributes = ZAP_ATTRIBUTE_INDEX(387), \ .attributeCount = 6, \ .clusterSize = 11, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 156 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 159 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Pump Configuration and Control (server) */ \ .clusterId = 0x00000200, \ - .attributes = ZAP_ATTRIBUTE_INDEX(387), \ + .attributes = ZAP_ATTRIBUTE_INDEX(393), \ .attributeCount = 25, \ .clusterSize = 52, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ @@ -2436,18 +2460,18 @@ { \ /* Endpoint: 1, Cluster: Thermostat (server) */ \ .clusterId = 0x00000201, \ - .attributes = ZAP_ATTRIBUTE_INDEX(412), \ + .attributes = ZAP_ATTRIBUTE_INDEX(418), \ .attributeCount = 16, \ .clusterSize = 31, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayThermostatServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 159 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 162 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Fan Control (server) */ \ .clusterId = 0x00000202, \ - .attributes = ZAP_ATTRIBUTE_INDEX(428), \ + .attributes = ZAP_ATTRIBUTE_INDEX(434), \ .attributeCount = 13, \ .clusterSize = 17, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ @@ -2458,7 +2482,7 @@ { \ /* Endpoint: 1, Cluster: Thermostat User Interface Configuration (server) */ \ .clusterId = 0x00000204, \ - .attributes = ZAP_ATTRIBUTE_INDEX(441), \ + .attributes = ZAP_ATTRIBUTE_INDEX(447), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ @@ -2469,18 +2493,18 @@ { \ /* Endpoint: 1, Cluster: Color Control (server) */ \ .clusterId = 0x00000300, \ - .attributes = ZAP_ATTRIBUTE_INDEX(446), \ + .attributes = ZAP_ATTRIBUTE_INDEX(452), \ .attributeCount = 54, \ .clusterSize = 345, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayColorControlServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 161 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 164 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Illuminance Measurement (server) */ \ .clusterId = 0x00000400, \ - .attributes = ZAP_ATTRIBUTE_INDEX(500), \ + .attributes = ZAP_ATTRIBUTE_INDEX(506), \ .attributeCount = 7, \ .clusterSize = 15, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2491,7 +2515,7 @@ { \ /* Endpoint: 1, Cluster: Temperature Measurement (server) */ \ .clusterId = 0x00000402, \ - .attributes = ZAP_ATTRIBUTE_INDEX(507), \ + .attributes = ZAP_ATTRIBUTE_INDEX(513), \ .attributeCount = 6, \ .clusterSize = 14, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2502,7 +2526,7 @@ { \ /* Endpoint: 1, Cluster: Pressure Measurement (server) */ \ .clusterId = 0x00000403, \ - .attributes = ZAP_ATTRIBUTE_INDEX(513), \ + .attributes = ZAP_ATTRIBUTE_INDEX(519), \ .attributeCount = 5, \ .clusterSize = 12, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2513,7 +2537,7 @@ { \ /* Endpoint: 1, Cluster: Flow Measurement (server) */ \ .clusterId = 0x00000404, \ - .attributes = ZAP_ATTRIBUTE_INDEX(518), \ + .attributes = ZAP_ATTRIBUTE_INDEX(524), \ .attributeCount = 6, \ .clusterSize = 14, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2524,7 +2548,7 @@ { \ /* Endpoint: 1, Cluster: Relative Humidity Measurement (server) */ \ .clusterId = 0x00000405, \ - .attributes = ZAP_ATTRIBUTE_INDEX(524), \ + .attributes = ZAP_ATTRIBUTE_INDEX(530), \ .attributeCount = 6, \ .clusterSize = 14, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2535,7 +2559,7 @@ { \ /* Endpoint: 1, Cluster: Occupancy Sensing (server) */ \ .clusterId = 0x00000406, \ - .attributes = ZAP_ATTRIBUTE_INDEX(530), \ + .attributes = ZAP_ATTRIBUTE_INDEX(536), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -2546,7 +2570,7 @@ { \ /* Endpoint: 1, Cluster: Wake on LAN (server) */ \ .clusterId = 0x00000503, \ - .attributes = ZAP_ATTRIBUTE_INDEX(535), \ + .attributes = ZAP_ATTRIBUTE_INDEX(541), \ .attributeCount = 3, \ .clusterSize = 39, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2557,7 +2581,7 @@ { \ /* Endpoint: 1, Cluster: Channel (server) */ \ .clusterId = 0x00000504, \ - .attributes = ZAP_ATTRIBUTE_INDEX(538), \ + .attributes = ZAP_ATTRIBUTE_INDEX(544), \ .attributeCount = 3, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2568,18 +2592,18 @@ { \ /* Endpoint: 1, Cluster: Target Navigator (server) */ \ .clusterId = 0x00000505, \ - .attributes = ZAP_ATTRIBUTE_INDEX(541), \ + .attributes = ZAP_ATTRIBUTE_INDEX(547), \ .attributeCount = 4, \ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 181 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 183 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 184 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 186 ) ,\ },\ { \ /* Endpoint: 1, Cluster: Media Playback (server) */ \ .clusterId = 0x00000506, \ - .attributes = ZAP_ATTRIBUTE_INDEX(545), \ + .attributes = ZAP_ATTRIBUTE_INDEX(551), \ .attributeCount = 8, \ .clusterSize = 43, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2590,40 +2614,40 @@ { \ /* Endpoint: 1, Cluster: Media Input (server) */ \ .clusterId = 0x00000507, \ - .attributes = ZAP_ATTRIBUTE_INDEX(553), \ + .attributes = ZAP_ATTRIBUTE_INDEX(559), \ .attributeCount = 4, \ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 185 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 188 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Low Power (server) */ \ .clusterId = 0x00000508, \ - .attributes = ZAP_ATTRIBUTE_INDEX(557), \ + .attributes = ZAP_ATTRIBUTE_INDEX(563), \ .attributeCount = 2, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 190 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 193 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Keypad Input (server) */ \ .clusterId = 0x00000509, \ - .attributes = ZAP_ATTRIBUTE_INDEX(559), \ + .attributes = ZAP_ATTRIBUTE_INDEX(565), \ .attributeCount = 2, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 192 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 194 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 195 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 197 ) ,\ },\ { \ /* Endpoint: 1, Cluster: Content Launcher (server) */ \ .clusterId = 0x0000050A, \ - .attributes = ZAP_ATTRIBUTE_INDEX(561), \ + .attributes = ZAP_ATTRIBUTE_INDEX(567), \ .attributeCount = 4, \ .clusterSize = 10, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2634,7 +2658,7 @@ { \ /* Endpoint: 1, Cluster: Audio Output (server) */ \ .clusterId = 0x0000050B, \ - .attributes = ZAP_ATTRIBUTE_INDEX(565), \ + .attributes = ZAP_ATTRIBUTE_INDEX(571), \ .attributeCount = 4, \ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2645,7 +2669,7 @@ { \ /* Endpoint: 1, Cluster: Application Launcher (server) */ \ .clusterId = 0x0000050C, \ - .attributes = ZAP_ATTRIBUTE_INDEX(569), \ + .attributes = ZAP_ATTRIBUTE_INDEX(575), \ .attributeCount = 3, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2656,7 +2680,7 @@ { \ /* Endpoint: 1, Cluster: Application Basic (server) */ \ .clusterId = 0x0000050D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(572), \ + .attributes = ZAP_ATTRIBUTE_INDEX(578), \ .attributeCount = 9, \ .clusterSize = 110, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2667,7 +2691,7 @@ { \ /* Endpoint: 1, Cluster: Account Login (server) */ \ .clusterId = 0x0000050E, \ - .attributes = ZAP_ATTRIBUTE_INDEX(581), \ + .attributes = ZAP_ATTRIBUTE_INDEX(587), \ .attributeCount = 2, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2678,7 +2702,7 @@ { \ /* Endpoint: 1, Cluster: Electrical Measurement (server) */ \ .clusterId = 0x00000B04, \ - .attributes = ZAP_ATTRIBUTE_INDEX(583), \ + .attributes = ZAP_ATTRIBUTE_INDEX(589), \ .attributeCount = 13, \ .clusterSize = 32, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2689,40 +2713,40 @@ { \ /* Endpoint: 1, Cluster: Unit Testing (server) */ \ .clusterId = 0xFFF1FC05, \ - .attributes = ZAP_ATTRIBUTE_INDEX(596), \ + .attributes = ZAP_ATTRIBUTE_INDEX(602), \ .attributeCount = 83, \ .clusterSize = 2289, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 196 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 215 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 199 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 218 ) ,\ },\ { \ /* Endpoint: 2, Cluster: Groups (server) */ \ .clusterId = 0x00000004, \ - .attributes = ZAP_ATTRIBUTE_INDEX(679), \ + .attributes = ZAP_ATTRIBUTE_INDEX(685), \ .attributeCount = 3, \ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayGroupsServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 225 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 232 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 228 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 235 ) ,\ },\ { \ /* Endpoint: 2, Cluster: On/Off (server) */ \ .clusterId = 0x00000006, \ - .attributes = ZAP_ATTRIBUTE_INDEX(682), \ + .attributes = ZAP_ATTRIBUTE_INDEX(688), \ .attributeCount = 7, \ .clusterSize = 13, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayOnOffServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 237 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 240 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 2, Cluster: Descriptor (server) */ \ .clusterId = 0x0000001D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(689), \ + .attributes = ZAP_ATTRIBUTE_INDEX(695), \ .attributeCount = 6, \ .clusterSize = 4, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2733,7 +2757,7 @@ { \ /* Endpoint: 2, Cluster: Power Source (server) */ \ .clusterId = 0x0000002F, \ - .attributes = ZAP_ATTRIBUTE_INDEX(695), \ + .attributes = ZAP_ATTRIBUTE_INDEX(701), \ .attributeCount = 8, \ .clusterSize = 72, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2744,7 +2768,7 @@ { \ /* Endpoint: 2, Cluster: Occupancy Sensing (server) */ \ .clusterId = 0x00000406, \ - .attributes = ZAP_ATTRIBUTE_INDEX(703), \ + .attributes = ZAP_ATTRIBUTE_INDEX(709), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -2755,13 +2779,13 @@ { \ /* Endpoint: 65534, Cluster: Network Commissioning (server) */ \ .clusterId = 0x00000031, \ - .attributes = ZAP_ATTRIBUTE_INDEX(708), \ + .attributes = ZAP_ATTRIBUTE_INDEX(714), \ .attributeCount = 10, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 241 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 248 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 244 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 251 ) ,\ },\ } @@ -2769,13 +2793,13 @@ #define ZAP_CLUSTER_INDEX(index) (&generatedClusters[index]) -#define ZAP_FIXED_ENDPOINT_DATA_VERSION_COUNT 77 +#define ZAP_FIXED_ENDPOINT_DATA_VERSION_COUNT 78 // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 28, 361 }, { ZAP_CLUSTER_INDEX(28), 44, 3459 }, { ZAP_CLUSTER_INDEX(72), 5, 105 }, \ - { ZAP_CLUSTER_INDEX(77), 1, 0 }, \ + { ZAP_CLUSTER_INDEX(0), 29, 377 }, { ZAP_CLUSTER_INDEX(29), 44, 3459 }, { ZAP_CLUSTER_INDEX(73), 5, 105 }, \ + { ZAP_CLUSTER_INDEX(78), 1, 0 }, \ } // Largest attribute size is needed for various buffers @@ -2787,7 +2811,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, #define ATTRIBUTE_SINGLETONS_SIZE (37) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (3925) +#define ATTRIBUTE_MAX_SIZE (3941) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (4) diff --git a/zzz_generated/all-clusters-app/zap-generated/gen_config.h b/zzz_generated/all-clusters-app/zap-generated/gen_config.h index b608d4fe5dbf93..b4d285a75344ae 100644 --- a/zzz_generated/all-clusters-app/zap-generated/gen_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/gen_config.h @@ -91,6 +91,7 @@ #define EMBER_AF_APPLICATION_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_ACCOUNT_LOGIN_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_ELECTRICAL_MEASUREMENT_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_CLIENT_MONITORING_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_UNIT_TESTING_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_FAULT_INJECTION_CLUSTER_SERVER_ENDPOINT_COUNT (1) @@ -425,6 +426,11 @@ #define EMBER_AF_PLUGIN_ELECTRICAL_MEASUREMENT_SERVER #define EMBER_AF_PLUGIN_ELECTRICAL_MEASUREMENT +// Use this macro to check if the server side of the Client Monitoring cluster is included +#define ZCL_USING_CLIENT_MONITORING_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_CLIENT_MONITORING_SERVER +#define EMBER_AF_PLUGIN_CLIENT_MONITORING + // Use this macro to check if the server side of the Unit Testing cluster is included #define ZCL_USING_UNIT_TESTING_CLUSTER_SERVER #define EMBER_AF_PLUGIN_UNIT_TESTING_SERVER diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index 6818db81106eb4..bacd478f877e5f 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -8809,6 +8809,12 @@ bool emberAfElectricalMeasurementClusterGetMeasurementProfileCommandCallback( bool emberAfClientMonitoringClusterRegisterClientMonitoringCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::ClientMonitoring::Commands::RegisterClientMonitoring::DecodableType & commandData); +/** + * @brief Client Monitoring Cluster UnregisterClientMonitoring Command callback (from client) + */ +bool emberAfClientMonitoringClusterUnregisterClientMonitoringCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::ClientMonitoring::Commands::UnregisterClientMonitoring::DecodableType & commandData); /** * @brief Client Monitoring Cluster StayAwakeRequest Command callback (from client) */ diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index e2a0f0ed234443..f1e122f28d43f2 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -18784,6 +18784,47 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) return CHIP_NO_ERROR; } } // namespace RegisterClientMonitoring. +namespace UnregisterClientMonitoring { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kClientNodeId)), clientNodeId)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kICid)), ICid)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kClientNodeId): + ReturnErrorOnFailure(DataModel::Decode(reader, clientNodeId)); + break; + case to_underlying(Fields::kICid): + ReturnErrorOnFailure(DataModel::Decode(reader, ICid)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace UnregisterClientMonitoring. namespace StayAwakeRequest { CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 70c6d6ab26422c..4998f1b07f35f7 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -25341,6 +25341,11 @@ struct Type; struct DecodableType; } // namespace RegisterClientMonitoring +namespace UnregisterClientMonitoring { +struct Type; +struct DecodableType; +} // namespace UnregisterClientMonitoring + namespace StayAwakeRequest { struct Type; struct DecodableType; @@ -25384,6 +25389,41 @@ struct DecodableType CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace RegisterClientMonitoring +namespace UnregisterClientMonitoring { +enum class Fields +{ + kClientNodeId = 0, + kICid = 1, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::UnregisterClientMonitoring::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ClientMonitoring::Id; } + + chip::NodeId clientNodeId = static_cast(0); + uint64_t ICid = static_cast(0); + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::UnregisterClientMonitoring::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ClientMonitoring::Id; } + + chip::NodeId clientNodeId = static_cast(0); + uint64_t ICid = static_cast(0); + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace UnregisterClientMonitoring namespace StayAwakeRequest { enum class Fields { diff --git a/zzz_generated/app-common/app-common/zap-generated/command-id.h b/zzz_generated/app-common/app-common/zap-generated/command-id.h index dbc65d09a73c12..7caa52c0d19bdb 100644 --- a/zzz_generated/app-common/app-common/zap-generated/command-id.h +++ b/zzz_generated/app-common/app-common/zap-generated/command-id.h @@ -319,7 +319,8 @@ // Commands for cluster: Client Monitoring #define ZCL_REGISTER_CLIENT_MONITORING_COMMAND_ID (0x00) -#define ZCL_STAY_AWAKE_REQUEST_COMMAND_ID (0x01) +#define ZCL_UNREGISTER_CLIENT_MONITORING_COMMAND_ID (0x01) +#define ZCL_STAY_AWAKE_REQUEST_COMMAND_ID (0x02) // Commands for cluster: Unit Testing #define ZCL_TEST_COMMAND_ID (0x00) diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h index 22576400404724..3205ee2707acde 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h @@ -1098,8 +1098,12 @@ namespace RegisterClientMonitoring { static constexpr CommandId Id = 0x00000000; } // namespace RegisterClientMonitoring -namespace StayAwakeRequest { +namespace UnregisterClientMonitoring { static constexpr CommandId Id = 0x00000001; +} // namespace UnregisterClientMonitoring + +namespace StayAwakeRequest { +static constexpr CommandId Id = 0x00000002; } // namespace StayAwakeRequest } // namespace Commands diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index b4aebd87faf38d..a89e062b249ca8 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -7306,7 +7306,8 @@ class ElectricalMeasurementGetMeasurementProfileCommand : public ClusterCommand |------------------------------------------------------------------------------| | Commands: | | | * RegisterClientMonitoring | 0x00 | -| * StayAwakeRequest | 0x01 | +| * UnregisterClientMonitoring | 0x01 | +| * StayAwakeRequest | 0x02 | |------------------------------------------------------------------------------| | Attributes: | | | * IdleModeInterval | 0x0000 | @@ -7355,14 +7356,16 @@ class ClientMonitoringRegisterClientMonitoring : public ClusterCommand }; /* - * Command StayAwakeRequest + * Command UnregisterClientMonitoring */ -class ClientMonitoringStayAwakeRequest : public ClusterCommand +class ClientMonitoringUnregisterClientMonitoring : public ClusterCommand { public: - ClientMonitoringStayAwakeRequest(CredentialIssuerCommands * credsIssuerConfig) : - ClusterCommand("stay-awake-request", credsIssuerConfig) + ClientMonitoringUnregisterClientMonitoring(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("unregister-client-monitoring", credsIssuerConfig) { + AddArgument("ClientNodeId", 0, UINT64_MAX, &mRequest.clientNodeId); + AddArgument("ICid", 0, UINT64_MAX, &mRequest.ICid); ClusterCommand::AddArguments(); } @@ -7380,6 +7383,36 @@ class ClientMonitoringStayAwakeRequest : public ClusterCommand return ClusterCommand::SendGroupCommand(groupId, fabricIndex, 0x00001046, 0x00000001, mRequest); } +private: + chip::app::Clusters::ClientMonitoring::Commands::UnregisterClientMonitoring::Type mRequest; +}; + +/* + * Command StayAwakeRequest + */ +class ClientMonitoringStayAwakeRequest : public ClusterCommand +{ +public: + ClientMonitoringStayAwakeRequest(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("stay-awake-request", credsIssuerConfig) + { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) command (0x00000002) on endpoint %u", endpointIds.at(0)); + + return ClusterCommand::SendCommand(device, endpointIds.at(0), 0x00001046, 0x00000002, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) command (0x00000002) on Group %u", groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, 0x00001046, 0x00000002, mRequest); + } + private: chip::app::Clusters::ClientMonitoring::Commands::StayAwakeRequest::Type mRequest; }; @@ -13013,9 +13046,10 @@ void registerClusterClientMonitoring(Commands & commands, CredentialIssuerComman // // Commands // - make_unique(Id, credsIssuerConfig), // - make_unique(credsIssuerConfig), // - make_unique(credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // // // Attributes // diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index ea4a2460397b0d..f08aa9a67b1f4c 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -9678,6 +9678,59 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP } break; } + case ClientMonitoring::Id: { + switch (path.mAttributeId) + { + case ClientMonitoring::Attributes::IdleModeInterval::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("IdleModeInterval", 1, value); + } + case ClientMonitoring::Attributes::ActiveModeInterval::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ActiveModeInterval", 1, value); + } + case ClientMonitoring::Attributes::ActiveModeThreshold::Id: { + uint16_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ActiveModeThreshold", 1, value); + } + case ClientMonitoring::Attributes::ExpectedClients::Id: { + chip::app::DataModel::DecodableList< + chip::app::Clusters::ClientMonitoring::Structs::MonitoringRegistration::DecodableType> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ExpectedClients", 1, value); + } + case ClientMonitoring::Attributes::GeneratedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + } + case ClientMonitoring::Attributes::AcceptedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + } + case ClientMonitoring::Attributes::AttributeList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AttributeList", 1, value); + } + case ClientMonitoring::Attributes::FeatureMap::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("FeatureMap", 1, value); + } + case ClientMonitoring::Attributes::ClusterRevision::Id: { + uint16_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ClusterRevision", 1, value); + } + } + break; + } case UnitTesting::Id: { switch (path.mAttributeId) { diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index f8570828a26f3d..290abe1ea66f01 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -242,6 +242,7 @@ class TestList : public Command printf("TestAccessControlConstraints\n"); printf("TestLevelControlWithOnOffDependency\n"); printf("TestCommissioningWindow\n"); + printf("TestClientMonitoringCluster\n"); printf("TestMultiAdmin\n"); printf("Test_TC_DGSW_1_1\n"); printf("TestSubscribe_OnOff\n"); @@ -64576,8 +64577,10 @@ class TestDescriptorClusterSuite : public TestCommand VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 25)); VerifyOrReturn(CheckValue("serverList[25]", iter_0.GetValue(), 1029UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 26)); - VerifyOrReturn(CheckValue("serverList[26]", iter_0.GetValue(), 4294048774UL)); - VerifyOrReturn(CheckNoMoreListItems("serverList", iter_0, 27)); + VerifyOrReturn(CheckValue("serverList[26]", iter_0.GetValue(), 4166UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 27)); + VerifyOrReturn(CheckValue("serverList[27]", iter_0.GetValue(), 4294048774UL)); + VerifyOrReturn(CheckNoMoreListItems("serverList", iter_0, 28)); } } break; @@ -69508,6 +69511,197 @@ class TestCommissioningWindowSuite : public TestCommand } }; +class TestClientMonitoringClusterSuite : public TestCommand +{ +public: + TestClientMonitoringClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TestClientMonitoringCluster", 9, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~TestClientMonitoringClusterSuite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::ClientMonitoring::Structs::MonitoringRegistration::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("expectedClients", iter_0, 0)); + VerifyOrReturn(CheckValue("expectedClients[0].clientNodeId", iter_0.GetValue().clientNodeId, 10ULL)); + VerifyOrReturn(CheckValue("expectedClients[0].ICid", iter_0.GetValue().ICid, 20ULL)); + VerifyOrReturn(CheckNoMoreListItems("expectedClients", iter_0, 1)); + } + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::ClientMonitoring::Structs::MonitoringRegistration::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("expectedClients", iter_0, 0)); + } + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Register Client 2 - Invalid"); + ListFreer listFreer; + chip::app::Clusters::ClientMonitoring::Commands::RegisterClientMonitoring::Type value; + value.clientNodeId = 0ULL; + value.ICid = 0ULL; + return SendCommand(kIdentityAlpha, GetEndpoint(0), ClientMonitoring::Id, + ClientMonitoring::Commands::RegisterClientMonitoring::Id, value, chip::NullOptional + + ); + } + case 2: { + LogStep(2, "Register Client 1"); + ListFreer listFreer; + chip::app::Clusters::ClientMonitoring::Commands::RegisterClientMonitoring::Type value; + value.clientNodeId = 10ULL; + value.ICid = 20ULL; + return SendCommand(kIdentityAlpha, GetEndpoint(0), ClientMonitoring::Id, + ClientMonitoring::Commands::RegisterClientMonitoring::Id, value, chip::NullOptional + + ); + } + case 3: { + LogStep(3, "Register Client 2 - Invalid"); + ListFreer listFreer; + chip::app::Clusters::ClientMonitoring::Commands::RegisterClientMonitoring::Type value; + value.clientNodeId = 11ULL; + value.ICid = 21ULL; + return SendCommand(kIdentityAlpha, GetEndpoint(0), ClientMonitoring::Id, + ClientMonitoring::Commands::RegisterClientMonitoring::Id, value, chip::NullOptional + + ); + } + case 4: { + LogStep(4, "Verify Register Client"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ClientMonitoring::Id, + ClientMonitoring::Attributes::ExpectedClients::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Unregister Client - Invalid Client NodeId"); + ListFreer listFreer; + chip::app::Clusters::ClientMonitoring::Commands::UnregisterClientMonitoring::Type value; + value.clientNodeId = 30ULL; + value.ICid = 20ULL; + return SendCommand(kIdentityAlpha, GetEndpoint(0), ClientMonitoring::Id, + ClientMonitoring::Commands::UnregisterClientMonitoring::Id, value, chip::NullOptional + + ); + } + case 6: { + LogStep(6, "Unregister Client - Invalid ICid"); + ListFreer listFreer; + chip::app::Clusters::ClientMonitoring::Commands::UnregisterClientMonitoring::Type value; + value.clientNodeId = 10ULL; + value.ICid = 30ULL; + return SendCommand(kIdentityAlpha, GetEndpoint(0), ClientMonitoring::Id, + ClientMonitoring::Commands::UnregisterClientMonitoring::Id, value, chip::NullOptional + + ); + } + case 7: { + LogStep(7, "Unregister Client - Valid"); + ListFreer listFreer; + chip::app::Clusters::ClientMonitoring::Commands::UnregisterClientMonitoring::Type value; + value.clientNodeId = 10ULL; + value.ICid = 20ULL; + return SendCommand(kIdentityAlpha, GetEndpoint(0), ClientMonitoring::Id, + ClientMonitoring::Commands::UnregisterClientMonitoring::Id, value, chip::NullOptional + + ); + } + case 8: { + LogStep(8, "Verify Register Client - Empty"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ClientMonitoring::Id, + ClientMonitoring::Attributes::ExpectedClients::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + class TestMultiAdminSuite : public TestCommand { public: @@ -109161,6 +109355,7 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h index 8f1d6b556b7953..2d73fce3376b6e 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h @@ -497,6 +497,16 @@ typedef void (*ElectricalMeasurementAcceptedCommandListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); typedef void (*ElectricalMeasurementAttributeListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*ClientMonitoringExpectedClientsListAttributeCallback)( + void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::ClientMonitoring::Structs::MonitoringRegistration::DecodableType> & data); +typedef void (*ClientMonitoringGeneratedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*ClientMonitoringAcceptedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*ClientMonitoringAttributeListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); typedef void (*UnitTestingListInt8uListAttributeCallback)(void * context, const chip::app::DataModel::DecodableList & data); typedef void (*UnitTestingListOctetStringListAttributeCallback)(void * context, diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h index 90f78f5e26b47e..3929eb6c02a50c 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h @@ -622,6 +622,15 @@ class DLL_EXPORT ElectricalMeasurementCluster : public ClusterBase ~ElectricalMeasurementCluster() {} }; +class DLL_EXPORT ClientMonitoringCluster : public ClusterBase +{ +public: + ClientMonitoringCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : + ClusterBase(exchangeManager, session, app::Clusters::ClientMonitoring::Id, endpoint) + {} + ~ClientMonitoringCluster() {} +}; + class DLL_EXPORT UnitTestingCluster : public ClusterBase { public: diff --git a/zzz_generated/controller-clusters/zap-generated/endpoint_config.h b/zzz_generated/controller-clusters/zap-generated/endpoint_config.h index c134aad070496c..720a24d02a363f 100644 --- a/zzz_generated/controller-clusters/zap-generated/endpoint_config.h +++ b/zzz_generated/controller-clusters/zap-generated/endpoint_config.h @@ -79,7 +79,7 @@ #define GENERATED_FUNCTION_ARRAYS #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 65 +#define GENERATED_CLUSTER_COUNT 66 // clang-format off #define GENERATED_CLUSTERS { \ @@ -787,6 +787,17 @@ .acceptedCommandList = nullptr ,\ .generatedCommandList = nullptr ,\ },\ + { \ + /* Endpoint: 1, Cluster: Client Monitoring (client) */ \ + .clusterId = 0x00001046, \ + .attributes = ZAP_ATTRIBUTE_INDEX(0), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(CLIENT), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ { \ /* Endpoint: 1, Cluster: Unit Testing (client) */ \ .clusterId = 0xFFF1FC05, \ @@ -809,7 +820,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 65, 0 }, \ + { ZAP_CLUSTER_INDEX(0), 66, 0 }, \ } // Largest attribute size is needed for various buffers diff --git a/zzz_generated/controller-clusters/zap-generated/gen_config.h b/zzz_generated/controller-clusters/zap-generated/gen_config.h index 055a70eae86e90..439f069fe5a6c3 100644 --- a/zzz_generated/controller-clusters/zap-generated/gen_config.h +++ b/zzz_generated/controller-clusters/zap-generated/gen_config.h @@ -93,6 +93,7 @@ #define EMBER_AF_APPLICATION_BASIC_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_ACCOUNT_LOGIN_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_ELECTRICAL_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_CLIENT_MONITORING_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_UNIT_TESTING_CLUSTER_CLIENT_ENDPOINT_COUNT (1) /**** Cluster Plugins ****/ @@ -353,6 +354,10 @@ #define ZCL_USING_ELECTRICAL_MEASUREMENT_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_ELECTRICAL_MEASUREMENT_CLIENT +// Use this macro to check if the client side of the Client Monitoring cluster is included +#define ZCL_USING_CLIENT_MONITORING_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_CLIENT_MONITORING_CLIENT + // Use this macro to check if the client side of the Unit Testing cluster is included #define ZCL_USING_UNIT_TESTING_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_UNIT_TESTING_CLIENT diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index a0c24d16313634..ff4856b9664bb6 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -86056,6 +86056,802 @@ class SubscribeAttributeElectricalMeasurementClusterRevision : public SubscribeA } }; +/*----------------------------------------------------------------------------*\ +| Cluster ClientMonitoring | 0x1046 | +|------------------------------------------------------------------------------| +| Commands: | | +| * RegisterClientMonitoring | 0x00 | +| * UnregisterClientMonitoring | 0x01 | +| * StayAwakeRequest | 0x02 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * IdleModeInterval | 0x0000 | +| * ActiveModeInterval | 0x0001 | +| * ActiveModeThreshold | 0x0002 | +| * ExpectedClients | 0x0003 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + +/* + * Command RegisterClientMonitoring + */ +class ClientMonitoringRegisterClientMonitoring : public ClusterCommand { +public: + ClientMonitoringRegisterClientMonitoring() + : ClusterCommand("register-client-monitoring") + { + AddArgument("ClientNodeId", 0, UINT64_MAX, &mRequest.clientNodeId); + AddArgument("ICid", 0, UINT64_MAX, &mRequest.ICid); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) command (0x00000000) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type * params = [[MTRClientMonitoringClusterRegisterClientMonitoringParams alloc] init]; + params.timedInvokeTimeoutMs + = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + params.clientNodeId = [NSNumber numberWithUnsignedLongLong:mRequest.clientNodeId]; + params.iCid = [NSNumber numberWithUnsignedLongLong:mRequest.ICid]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster registerClientMonitoringWithParams:params + completion:^(NSError * _Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::ClientMonitoring::Commands::RegisterClientMonitoring::Type mRequest; +}; + +/* + * Command UnregisterClientMonitoring + */ +class ClientMonitoringUnregisterClientMonitoring : public ClusterCommand { +public: + ClientMonitoringUnregisterClientMonitoring() + : ClusterCommand("unregister-client-monitoring") + { + AddArgument("ClientNodeId", 0, UINT64_MAX, &mRequest.clientNodeId); + AddArgument("ICid", 0, UINT64_MAX, &mRequest.ICid); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) command (0x00000001) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type * params = [[MTRClientMonitoringClusterUnregisterClientMonitoringParams alloc] init]; + params.timedInvokeTimeoutMs + = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + params.clientNodeId = [NSNumber numberWithUnsignedLongLong:mRequest.clientNodeId]; + params.iCid = [NSNumber numberWithUnsignedLongLong:mRequest.ICid]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster unregisterClientMonitoringWithParams:params + completion:^(NSError * _Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::ClientMonitoring::Commands::UnregisterClientMonitoring::Type mRequest; +}; + +/* + * Command StayAwakeRequest + */ +class ClientMonitoringStayAwakeRequest : public ClusterCommand { +public: + ClientMonitoringStayAwakeRequest() + : ClusterCommand("stay-awake-request") + { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) command (0x00000002) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type * params = [[MTRClientMonitoringClusterStayAwakeRequestParams alloc] init]; + params.timedInvokeTimeoutMs + = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster stayAwakeRequestWithParams:params + completion:^(NSError * _Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: +}; + +/* + * Attribute IdleModeInterval + */ +class ReadClientMonitoringIdleModeInterval : public ReadAttribute { +public: + ReadClientMonitoringIdleModeInterval() + : ReadAttribute("idle-mode-interval") + { + } + + ~ReadClientMonitoringIdleModeInterval() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) ReadAttribute (0x00000000) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeIdleModeIntervalWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClientMonitoring.IdleModeInterval response %@", [value description]); + if (error != nil) { + LogNSError("ClientMonitoring IdleModeInterval read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClientMonitoringIdleModeInterval : public SubscribeAttribute { +public: + SubscribeAttributeClientMonitoringIdleModeInterval() + : SubscribeAttribute("idle-mode-interval") + { + } + + ~SubscribeAttributeClientMonitoringIdleModeInterval() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) ReportAttribute (0x00000000) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeIdleModeIntervalWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClientMonitoring.IdleModeInterval response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute ActiveModeInterval + */ +class ReadClientMonitoringActiveModeInterval : public ReadAttribute { +public: + ReadClientMonitoringActiveModeInterval() + : ReadAttribute("active-mode-interval") + { + } + + ~ReadClientMonitoringActiveModeInterval() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) ReadAttribute (0x00000001) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActiveModeIntervalWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClientMonitoring.ActiveModeInterval response %@", [value description]); + if (error != nil) { + LogNSError("ClientMonitoring ActiveModeInterval read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClientMonitoringActiveModeInterval : public SubscribeAttribute { +public: + SubscribeAttributeClientMonitoringActiveModeInterval() + : SubscribeAttribute("active-mode-interval") + { + } + + ~SubscribeAttributeClientMonitoringActiveModeInterval() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) ReportAttribute (0x00000001) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActiveModeIntervalWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClientMonitoring.ActiveModeInterval response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute ActiveModeThreshold + */ +class ReadClientMonitoringActiveModeThreshold : public ReadAttribute { +public: + ReadClientMonitoringActiveModeThreshold() + : ReadAttribute("active-mode-threshold") + { + } + + ~ReadClientMonitoringActiveModeThreshold() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) ReadAttribute (0x00000002) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeActiveModeThresholdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClientMonitoring.ActiveModeThreshold response %@", [value description]); + if (error != nil) { + LogNSError("ClientMonitoring ActiveModeThreshold read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClientMonitoringActiveModeThreshold : public SubscribeAttribute { +public: + SubscribeAttributeClientMonitoringActiveModeThreshold() + : SubscribeAttribute("active-mode-threshold") + { + } + + ~SubscribeAttributeClientMonitoringActiveModeThreshold() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) ReportAttribute (0x00000002) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeActiveModeThresholdWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClientMonitoring.ActiveModeThreshold response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute ExpectedClients + */ +class ReadClientMonitoringExpectedClients : public ReadAttribute { +public: + ReadClientMonitoringExpectedClients() + : ReadAttribute("expected-clients") + { + } + + ~ReadClientMonitoringExpectedClients() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) ReadAttribute (0x00000003) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type * params = [[MTRReadParams alloc] init]; + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + [cluster readAttributeExpectedClientsWithParams:params + completion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClientMonitoring.ExpectedClients response %@", [value description]); + if (error != nil) { + LogNSError("ClientMonitoring ExpectedClients read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClientMonitoringExpectedClients : public SubscribeAttribute { +public: + SubscribeAttributeClientMonitoringExpectedClients() + : SubscribeAttribute("expected-clients") + { + } + + ~SubscribeAttributeClientMonitoringExpectedClients() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) ReportAttribute (0x00000003) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeExpectedClientsWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClientMonitoring.ExpectedClients response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute GeneratedCommandList + */ +class ReadClientMonitoringGeneratedCommandList : public ReadAttribute { +public: + ReadClientMonitoringGeneratedCommandList() + : ReadAttribute("generated-command-list") + { + } + + ~ReadClientMonitoringGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClientMonitoring.GeneratedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("ClientMonitoring GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClientMonitoringGeneratedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeClientMonitoringGeneratedCommandList() + : SubscribeAttribute("generated-command-list") + { + } + + ~SubscribeAttributeClientMonitoringGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClientMonitoring.GeneratedCommandList response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute AcceptedCommandList + */ +class ReadClientMonitoringAcceptedCommandList : public ReadAttribute { +public: + ReadClientMonitoringAcceptedCommandList() + : ReadAttribute("accepted-command-list") + { + } + + ~ReadClientMonitoringAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClientMonitoring.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("ClientMonitoring AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClientMonitoringAcceptedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeClientMonitoringAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") + { + } + + ~SubscribeAttributeClientMonitoringAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClientMonitoring.AcceptedCommandList response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute AttributeList + */ +class ReadClientMonitoringAttributeList : public ReadAttribute { +public: + ReadClientMonitoringAttributeList() + : ReadAttribute("attribute-list") + { + } + + ~ReadClientMonitoringAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClientMonitoring.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("ClientMonitoring AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClientMonitoringAttributeList : public SubscribeAttribute { +public: + SubscribeAttributeClientMonitoringAttributeList() + : SubscribeAttribute("attribute-list") + { + } + + ~SubscribeAttributeClientMonitoringAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClientMonitoring.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute FeatureMap + */ +class ReadClientMonitoringFeatureMap : public ReadAttribute { +public: + ReadClientMonitoringFeatureMap() + : ReadAttribute("feature-map") + { + } + + ~ReadClientMonitoringFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClientMonitoring.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("ClientMonitoring FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClientMonitoringFeatureMap : public SubscribeAttribute { +public: + SubscribeAttributeClientMonitoringFeatureMap() + : SubscribeAttribute("feature-map") + { + } + + ~SubscribeAttributeClientMonitoringFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClientMonitoring.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute ClusterRevision + */ +class ReadClientMonitoringClusterRevision : public ReadAttribute { +public: + ReadClientMonitoringClusterRevision() + : ReadAttribute("cluster-revision") + { + } + + ~ReadClientMonitoringClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClientMonitoring.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("ClientMonitoring ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClientMonitoringClusterRevision : public SubscribeAttribute { +public: + SubscribeAttributeClientMonitoringClusterRevision() + : SubscribeAttribute("cluster-revision") + { + } + + ~SubscribeAttributeClientMonitoringClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00001046) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeIfLost = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClientMonitoring.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + /*----------------------------------------------------------------------------*\ | Cluster UnitTesting | 0xFFF1FC05| |------------------------------------------------------------------------------| @@ -100704,6 +101500,42 @@ void registerClusterElectricalMeasurement(Commands & commands) commands.Register(clusterName, clusterCommands); } +void registerClusterClientMonitoring(Commands & commands) +{ + using namespace chip::app::Clusters::ClientMonitoring; + + const char * clusterName = "ClientMonitoring"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(Id), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + }; + + commands.Register(clusterName, clusterCommands); +} void registerClusterUnitTesting(Commands & commands) { using namespace chip::app::Clusters::UnitTesting; @@ -101080,5 +101912,6 @@ void registerClusters(Commands & commands) registerClusterApplicationBasic(commands); registerClusterAccountLogin(commands); registerClusterElectricalMeasurement(commands); + registerClusterClientMonitoring(commands); registerClusterUnitTesting(commands); } diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index dae86fd7579d5f..c65316664f6cb9 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -220,6 +220,7 @@ class TestList : public Command { printf("TestAccessControlConstraints\n"); printf("TestLevelControlWithOnOffDependency\n"); printf("TestCommissioningWindow\n"); + printf("TestClientMonitoringCluster\n"); printf("TestMultiAdmin\n"); printf("Test_TC_DGSW_1_1\n"); printf("TestSubscribe_OnOff\n"); @@ -95592,7 +95593,7 @@ class TestDescriptorCluster : public TestCommandBridge { { id actualValue = value; - VerifyOrReturn(CheckValue("ServerList", [actualValue count], static_cast(27))); + VerifyOrReturn(CheckValue("ServerList", [actualValue count], static_cast(28))); VerifyOrReturn(CheckValue("", actualValue[0], 3UL)); VerifyOrReturn(CheckValue("", actualValue[1], 4UL)); VerifyOrReturn(CheckValue("", actualValue[2], 29UL)); @@ -95619,7 +95620,8 @@ class TestDescriptorCluster : public TestCommandBridge { VerifyOrReturn(CheckValue("", actualValue[23], 64UL)); VerifyOrReturn(CheckValue("", actualValue[24], 65UL)); VerifyOrReturn(CheckValue("", actualValue[25], 1029UL)); - VerifyOrReturn(CheckValue("", actualValue[26], 4294048774UL)); + VerifyOrReturn(CheckValue("", actualValue[26], 4166UL)); + VerifyOrReturn(CheckValue("", actualValue[27], 4294048774UL)); } NextTest(); @@ -104157,6 +104159,356 @@ class TestCommissioningWindow : public TestCommandBridge { } }; +class TestClientMonitoringCluster : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + TestClientMonitoringCluster() + : TestCommandBridge("TestClientMonitoringCluster") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~TestClientMonitoringCluster() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: TestClientMonitoringCluster\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: TestClientMonitoringCluster\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Register Client 2 - Invalid\n"); + err = TestRegisterClient2Invalid_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Register Client 1\n"); + err = TestRegisterClient1_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Register Client 2 - Invalid\n"); + err = TestRegisterClient2Invalid_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Verify Register Client\n"); + err = TestVerifyRegisterClient_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Unregister Client - Invalid Client NodeId\n"); + err = TestUnregisterClientInvalidClientNodeId_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Unregister Client - Invalid ICid\n"); + err = TestUnregisterClientInvalidICid_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Unregister Client - Valid\n"); + err = TestUnregisterClientValid_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Verify Register Client - Empty\n"); + err = TestVerifyRegisterClientEmpty_8(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 9; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestRegisterClient2Invalid_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRClientMonitoringClusterRegisterClientMonitoringParams alloc] init]; + params.clientNodeId = [NSNumber numberWithUnsignedLongLong:0ULL]; + params.iCid = [NSNumber numberWithUnsignedLongLong:0ULL]; + [cluster registerClientMonitoringWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Register Client 2 - Invalid Error: %@", err); + + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] + ? err.code + : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_FAILURE)); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestRegisterClient1_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRClientMonitoringClusterRegisterClientMonitoringParams alloc] init]; + params.clientNodeId = [NSNumber numberWithUnsignedLongLong:10ULL]; + params.iCid = [NSNumber numberWithUnsignedLongLong:20ULL]; + [cluster registerClientMonitoringWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Register Client 1 Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestRegisterClient2Invalid_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRClientMonitoringClusterRegisterClientMonitoringParams alloc] init]; + params.clientNodeId = [NSNumber numberWithUnsignedLongLong:11ULL]; + params.iCid = [NSNumber numberWithUnsignedLongLong:21ULL]; + [cluster registerClientMonitoringWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Register Client 2 - Invalid Error: %@", err); + + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] + ? err.code + : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED)); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyRegisterClient_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRReadParams alloc] init]; + params.filterByFabric = true; + [cluster readAttributeExpectedClientsWithParams:params + completion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Verify Register Client Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue( + "ExpectedClients", [actualValue count], static_cast(1))); + VerifyOrReturn(CheckValue("ClientNodeId", + ((MTRClientMonitoringClusterMonitoringRegistration *) actualValue[0]) + .clientNodeId, + 10ULL)); + VerifyOrReturn(CheckValue("ICid", + ((MTRClientMonitoringClusterMonitoringRegistration *) actualValue[0]).iCid, + 20ULL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUnregisterClientInvalidClientNodeId_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRClientMonitoringClusterUnregisterClientMonitoringParams alloc] init]; + params.clientNodeId = [NSNumber numberWithUnsignedLongLong:30ULL]; + params.iCid = [NSNumber numberWithUnsignedLongLong:20ULL]; + [cluster unregisterClientMonitoringWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Unregister Client - Invalid Client NodeId Error: %@", err); + + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] + ? err.code + : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_FAILURE)); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUnregisterClientInvalidICid_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRClientMonitoringClusterUnregisterClientMonitoringParams alloc] init]; + params.clientNodeId = [NSNumber numberWithUnsignedLongLong:10ULL]; + params.iCid = [NSNumber numberWithUnsignedLongLong:30ULL]; + [cluster unregisterClientMonitoringWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Unregister Client - Invalid ICid Error: %@", err); + + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] + ? err.code + : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_FAILURE)); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUnregisterClientValid_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRClientMonitoringClusterUnregisterClientMonitoringParams alloc] init]; + params.clientNodeId = [NSNumber numberWithUnsignedLongLong:10ULL]; + params.iCid = [NSNumber numberWithUnsignedLongLong:20ULL]; + [cluster unregisterClientMonitoringWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Unregister Client - Valid Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyRegisterClientEmpty_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterClientMonitoring alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRReadParams alloc] init]; + params.filterByFabric = true; + [cluster readAttributeExpectedClientsWithParams:params + completion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Verify Register Client - Empty Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue( + "ExpectedClients", [actualValue count], static_cast(0))); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + class TestMultiAdmin : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced @@ -129854,6 +130206,7 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(),