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 b5b01cbbe77edd..ba13b42667e261 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 @@ -3827,6 +3827,32 @@ server cluster TestCluster = 4294048773 { command TestEmitTestFabricScopedEventRequest(TestEmitTestFabricScopedEventRequestRequest): TestEmitTestFabricScopedEventResponse = 21; } +server cluster FaultInjection = 4294048774 { + enum FaultType : ENUM8 { + kUnspecified = 0; + kSystemFault = 1; + kInetFault = 2; + kChipFault = 3; + kCertFault = 4; + } + + 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 FailAtFaultRequest { + FaultType type = 0; + INT32U id = 1; + INT32U numCallsToSkip = 2; + INT32U numCallsToFail = 3; + BOOLEAN takeMutex = 4; + } + + command access(invoke: manage) FailAtFault(FailAtFaultRequest): DefaultSuccess = 0; +} + endpoint 0 { device type rootdevice = 22; binding cluster OtaSoftwareUpdateProvider; @@ -4145,6 +4171,14 @@ endpoint 0 { ram attribute featureMap; ram attribute clusterRevision default = 3; } + + server cluster FaultInjection { + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + ram attribute featureMap; + ram attribute clusterRevision default = 1; + } } endpoint 1 { device type onofflight = 256; 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 89133045cc89c6..baefdc4cf4a07c 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 @@ -8445,6 +8445,148 @@ "reportableChange": 0 } ] + }, + { + "name": "Fault Injection", + "code": 4294048774, + "mfgCode": null, + "define": "FAULT_INJECTION_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "FailAtFault", + "code": 0, + "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": "Fault Injection", + "code": 4294048774, + "mfgCode": null, + "define": "FAULT_INJECTION_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "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 + } + ] } ] }, diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index 7c33a523e965bb..f8ea390ec05a99 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -23,6 +23,7 @@ set(PRIV_INCLUDE_DIRS_LIST "${CMAKE_CURRENT_LIST_DIR}/include" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/third_party/nlfaultinjection/repo/include" ) set(SRC_DIRS_LIST "${CMAKE_CURRENT_LIST_DIR}" @@ -41,6 +42,7 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/application-basic-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/test-cluster-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/descriptor" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fault-injection-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fan-control-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fixed-label-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/user-label-server" diff --git a/src/app/clusters/fault-injection-server/fault-injection-server.cpp b/src/app/clusters/fault-injection-server/fault-injection-server.cpp new file mode 100644 index 00000000000000..83e1e678f8e8e2 --- /dev/null +++ b/src/app/clusters/fault-injection-server/fault-injection-server.cpp @@ -0,0 +1,96 @@ +/** + * + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "app/server/Server.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#if CHIP_WITH_NLFAULTINJECTION +#include +#include +#include +#endif + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters::FaultInjection; +using chip::Protocols::InteractionModel::Status; + +bool emberAfFaultInjectionClusterFailAtFaultCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Commands::FailAtFault::DecodableType & commandData) +{ + if (commandPath.mClusterId != Clusters::FaultInjection::Id) + { + // We shouldn't have been called at all. + commandObj->AddStatus(commandPath, Status::UnsupportedCluster); + return true; + } + +#if CHIP_WITH_NLFAULTINJECTION + Status returnStatus = Status::Success; + nl::FaultInjection::Manager * faultInjectionMgr = nullptr; + + switch (commandData.type) + { + case FaultType::kSystemFault: + faultInjectionMgr = &chip::System::FaultInjection::GetManager(); + break; + case FaultType::kInetFault: + faultInjectionMgr = &chip::Inet::FaultInjection::GetManager(); + break; + case FaultType::kChipFault: + faultInjectionMgr = &chip::FaultInjection::GetManager(); + break; + default: + ChipLogError(Zcl, "FaultInjection: Unsupported Fault type received"); + returnStatus = Status::InvalidCommand; + break; + } + + if (faultInjectionMgr != nullptr) + { + ChipLogProgress(Zcl, "FaultInjection: Configure a fault of type: %d and Id: %d to be triggered deterministically", + static_cast(commandData.type), commandData.id); + int32_t err = faultInjectionMgr->FailAtFault(commandData.id, commandData.numCallsToSkip, commandData.numCallsToFail, + commandData.takeMutex); + + if (err != 0) + { + ChipLogError(Zcl, "FaultInjection: Pass invalid inputs to FailAtFault"); + returnStatus = Status::InvalidCommand; + } + } + else + { + ChipLogError(Zcl, "FaultInjection: Failed to get Fault Injection manager"); + returnStatus = Status::Failure; + } +#else + Status returnStatus = Status::UnsupportedCommand; +#endif // CHIP_WITH_NLFAULTINJECTION + + commandObj->AddStatus(commandPath, returnStatus); + return true; +} + +void MatterFaultInjectionPluginServerInitCallback() {} diff --git a/src/app/tests/suites/TestDescriptorCluster.yaml b/src/app/tests/suites/TestDescriptorCluster.yaml index c8bf01e3ab3d00..543010309e8372 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?) + 0xFFF1FC06, # Fault Injection ] - label: "Read attribute Client list" diff --git a/src/app/zap-templates/zcl/data-model/all.xml b/src/app/zap-templates/zcl/data-model/all.xml index ac3fe6e5aa22d1..c050af49dcafa5 100644 --- a/src/app/zap-templates/zcl/data-model/all.xml +++ b/src/app/zap-templates/zcl/data-model/all.xml @@ -19,6 +19,7 @@ + diff --git a/src/app/zap-templates/zcl/data-model/chip/fault-injection-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/fault-injection-cluster.xml new file mode 100644 index 00000000000000..f8c764d8e139c6 --- /dev/null +++ b/src/app/zap-templates/zcl/data-model/chip/fault-injection-cluster.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + CHIP + Fault Injection + 0xFFF1FC06 + FAULT_INJECTION_CLUSTER + The Fault Injection Cluster provide a means for a test harness to configure faults(for example triggering a fault in the system). + + Configure a fault to be triggered deterministically + + + + + + + + + diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index ef8507106cdd5f..971824a0081df5 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -31,6 +31,7 @@ "diagnostic-logs-cluster.xml", "door-lock-cluster.xml", "ethernet-network-diagnostics-cluster.xml", + "fault-injection-cluster.xml", "fixed-label-cluster.xml", "flow-measurement-cluster.xml", "general-commissioning-cluster.xml", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index a5478bfb9e2057..da4c1d78bd83c2 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -26,6 +26,7 @@ "diagnostic-logs-cluster.xml", "door-lock-cluster.xml", "ethernet-network-diagnostics-cluster.xml", + "fault-injection-cluster.xml", "fixed-label-cluster.xml", "flow-measurement-cluster.xml", "general-commissioning-cluster.xml", diff --git a/src/app/zap_cluster_list.py b/src/app/zap_cluster_list.py index 9dd6cf3182469f..bf61468e3fcc2b 100755 --- a/src/app/zap_cluster_list.py +++ b/src/app/zap_cluster_list.py @@ -34,6 +34,7 @@ 'DOOR_LOCK_CLUSTER': ['door-lock-server'], 'ELECTRICAL_MEASUREMENT_CLUSTER': [], 'ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER': ['ethernet-network-diagnostics-server'], + 'FAULT_INJECTION_CLUSTER': ['fault-injection-server'], 'FAN_CONTROL_CLUSTER': ['fan-control-server'], 'FIXED_LABEL_CLUSTER': ['fixed-label-server'], 'FLOW_MEASUREMENT_CLUSTER': [], @@ -118,6 +119,7 @@ 'DOOR_LOCK_CLUSTER': [], 'ELECTRICAL_MEASUREMENT_CLUSTER': [], 'ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER': [], + 'FAULT_INJECTION_CLUSTER': [], 'FAN_CONTROL_CLUSTER': [], 'FIXED_LABEL_CLUSTER': [], 'FLOW_MEASUREMENT_CLUSTER': [], diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index ddb54a3525ae21..f8a88c7b66bb5f 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4387,6 +4387,32 @@ client cluster TestCluster = 4294048773 { command TestEmitTestEventRequest(TestEmitTestEventRequestRequest): TestEmitTestEventResponse = 20; } +client cluster FaultInjection = 4294048774 { + enum FaultType : ENUM8 { + kUnspecified = 0; + kSystemFault = 1; + kInetFault = 2; + kChipFault = 3; + kCertFault = 4; + } + + 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 FailAtFaultRequest { + FaultType type = 0; + INT32U id = 1; + INT32U numCallsToSkip = 2; + INT32U numCallsToFail = 3; + BOOLEAN takeMutex = 4; + } + + command access(invoke: manage) FailAtFault(FailAtFaultRequest): DefaultSuccess = 0; +} + endpoint 1 { device type rootdevice = 22; binding cluster Identify; @@ -4454,6 +4480,7 @@ endpoint 1 { binding cluster AccountLogin; binding cluster ElectricalMeasurement; binding cluster TestCluster; + binding cluster FaultInjection; } diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index 584ca5177c3405..88b9b7cc085330 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -19401,6 +19401,148 @@ "reportableChange": 0 } ] + }, + { + "name": "Fault Injection", + "code": 4294048774, + "mfgCode": null, + "define": "FAULT_INJECTION_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "FailAtFault", + "code": 0, + "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": "Fault Injection", + "code": 4294048774, + "mfgCode": null, + "define": "FAULT_INJECTION_CLUSTER", + "side": "server", + "enabled": 0, + "attributes": [ + { + "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 + } + ] } ] } diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 336a61be05a3ff..fe0eb5ce4cd193 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -19478,6 +19478,118 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } break; } + case app::Clusters::FaultInjection::Id: { + using namespace app::Clusters::FaultInjection; + switch (aPath.mAttributeId) + { + 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; + } default: *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; break; diff --git a/src/controller/java/zap-generated/CHIPCallbackTypes.h b/src/controller/java/zap-generated/CHIPCallbackTypes.h index be01149ef4bc17..cf42bf39d28966 100644 --- a/src/controller/java/zap-generated/CHIPCallbackTypes.h +++ b/src/controller/java/zap-generated/CHIPCallbackTypes.h @@ -1963,3 +1963,14 @@ typedef void (*CHIPTestClusterClusterFeatureMapAttributeCallbackType)( void *, chip::app::Clusters::TestCluster::Attributes::FeatureMap::TypeInfo::DecodableArgType); typedef void (*CHIPTestClusterClusterClusterRevisionAttributeCallbackType)( void *, chip::app::Clusters::TestCluster::Attributes::ClusterRevision::TypeInfo::DecodableArgType); + +typedef void (*CHIPFaultInjectionClusterGeneratedCommandListAttributeCallbackType)( + void *, const chip::app::Clusters::FaultInjection::Attributes::GeneratedCommandList::TypeInfo::DecodableType &); +typedef void (*CHIPFaultInjectionClusterAcceptedCommandListAttributeCallbackType)( + void *, const chip::app::Clusters::FaultInjection::Attributes::AcceptedCommandList::TypeInfo::DecodableType &); +typedef void (*CHIPFaultInjectionClusterAttributeListAttributeCallbackType)( + void *, const chip::app::Clusters::FaultInjection::Attributes::AttributeList::TypeInfo::DecodableType &); +typedef void (*CHIPFaultInjectionClusterFeatureMapAttributeCallbackType)( + void *, chip::app::Clusters::FaultInjection::Attributes::FeatureMap::TypeInfo::DecodableArgType); +typedef void (*CHIPFaultInjectionClusterClusterRevisionAttributeCallbackType)( + void *, chip::app::Clusters::FaultInjection::Attributes::ClusterRevision::TypeInfo::DecodableArgType); diff --git a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp index fcdb5b536f65a1..411028f4237550 100644 --- a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp @@ -3495,6 +3495,16 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & } break; } + case app::Clusters::FaultInjection::Id: { + using namespace app::Clusters::FaultInjection; + switch (aPath.mEventId) + { + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + break; + } + break; + } default: *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; break; diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index 68e371fabf727c..2dab6e13780b9d 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -29193,3 +29193,216 @@ void CHIPTestClusterAttributeListAttributeCallback::CallbackFn(void * context, env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); } + +CHIPFaultInjectionGeneratedCommandListAttributeCallback::CHIPFaultInjectionGeneratedCommandListAttributeCallback( + 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"); + } +} + +CHIPFaultInjectionGeneratedCommandListAttributeCallback::~CHIPFaultInjectionGeneratedCommandListAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPFaultInjectionGeneratedCommandListAttributeCallback::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); +} + +CHIPFaultInjectionAcceptedCommandListAttributeCallback::CHIPFaultInjectionAcceptedCommandListAttributeCallback(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"); + } +} + +CHIPFaultInjectionAcceptedCommandListAttributeCallback::~CHIPFaultInjectionAcceptedCommandListAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPFaultInjectionAcceptedCommandListAttributeCallback::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); +} + +CHIPFaultInjectionAttributeListAttributeCallback::CHIPFaultInjectionAttributeListAttributeCallback(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"); + } +} + +CHIPFaultInjectionAttributeListAttributeCallback::~CHIPFaultInjectionAttributeListAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPFaultInjectionAttributeListAttributeCallback::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); +} diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.h b/src/controller/java/zap-generated/CHIPReadCallbacks.h index b1951ce5d661c3..f5dc7866c0e0c9 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.h +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.h @@ -12045,3 +12045,93 @@ class CHIPTestClusterAttributeListAttributeCallback jobject javaCallbackRef; bool keepAlive; }; + +class CHIPFaultInjectionGeneratedCommandListAttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPFaultInjectionGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPFaultInjectionGeneratedCommandListAttributeCallback(); + + static void maybeDestroy(CHIPFaultInjectionGeneratedCommandListAttributeCallback * 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 CHIPFaultInjectionAcceptedCommandListAttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPFaultInjectionAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPFaultInjectionAcceptedCommandListAttributeCallback(); + + static void maybeDestroy(CHIPFaultInjectionAcceptedCommandListAttributeCallback * 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 CHIPFaultInjectionAttributeListAttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPFaultInjectionAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPFaultInjectionAttributeListAttributeCallback(); + + static void maybeDestroy(CHIPFaultInjectionAttributeListAttributeCallback * 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; +}; diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index 1aa9a1d2574557..73c28214ab6173 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -25168,4 +25168,163 @@ private native void readClusterRevisionAttribute( private native void subscribeClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback, int minInterval, int maxInterval); } + + public static class FaultInjectionCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 4294048774L; + + public FaultInjectionCluster(long devicePtr, int endpointId) { + super(devicePtr, endpointId); + } + + @Override + public native long initWithDevice(long devicePtr, int endpointId); + + public void failAtFault( + DefaultClusterCallback callback, + Integer type, + Long id, + Long numCallsToSkip, + Long numCallsToFail, + Boolean takeMutex) { + failAtFault( + chipClusterPtr, callback, type, id, numCallsToSkip, numCallsToFail, takeMutex, null); + } + + public void failAtFault( + DefaultClusterCallback callback, + Integer type, + Long id, + Long numCallsToSkip, + Long numCallsToFail, + Boolean takeMutex, + int timedInvokeTimeoutMs) { + failAtFault( + chipClusterPtr, + callback, + type, + id, + numCallsToSkip, + numCallsToFail, + takeMutex, + timedInvokeTimeoutMs); + } + + private native void failAtFault( + long chipClusterPtr, + DefaultClusterCallback Callback, + Integer type, + Long id, + Long numCallsToSkip, + Long numCallsToFail, + Boolean takeMutex, + @Nullable Integer timedInvokeTimeoutMs); + + 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 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 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); + } } diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java index fddd0ee7c03216..c61f98c598aa61 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java @@ -220,6 +220,9 @@ public static String clusterIdToName(long clusterId) { if (clusterId == 4294048773L) { return "TestCluster"; } + if (clusterId == 4294048774L) { + return "FaultInjection"; + } return ""; } @@ -3087,6 +3090,24 @@ public static String attributeIdToName(long clusterId, long attributeId) { } return ""; } + if (clusterId == 4294048774L) { + 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 ""; + } return ""; } @@ -3461,6 +3482,9 @@ public static String eventIdToName(long clusterId, long eventId) { } return ""; } + if (clusterId == 4294048774L) { + return ""; + } return ""; } } diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java index 955ae30c67da52..365bee708efccb 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java @@ -7131,6 +7131,78 @@ public void onError(Exception ex) { } } + public static class DelegatedFaultInjectionClusterGeneratedCommandListAttributeCallback + implements ChipClusters.FaultInjectionCluster.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 DelegatedFaultInjectionClusterAcceptedCommandListAttributeCallback + implements ChipClusters.FaultInjectionCluster.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 DelegatedFaultInjectionClusterAttributeListAttributeCallback + implements ChipClusters.FaultInjectionCluster.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 Map getClusterMap() { Map clusterMap = initializeClusterMap(); Map> commandMap = getCommandMap(); @@ -7470,6 +7542,11 @@ public Map initializeClusterMap() { (ptr, endpointId) -> new ChipClusters.TestClusterCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("testCluster", testClusterClusterInfo); + ClusterInfo faultInjectionClusterInfo = + new ClusterInfo( + (ptr, endpointId) -> new ChipClusters.FaultInjectionCluster(ptr, endpointId), + new HashMap<>()); + clusterMap.put("faultInjection", faultInjectionClusterInfo); return clusterMap; } @@ -7562,6 +7639,7 @@ public void combineCommand( destination.get("accountLogin").combineCommands(source.get("accountLogin")); destination.get("electricalMeasurement").combineCommands(source.get("electricalMeasurement")); destination.get("testCluster").combineCommands(source.get("testCluster")); + destination.get("faultInjection").combineCommands(source.get("faultInjection")); } @SuppressWarnings("unchecked") @@ -12001,6 +12079,51 @@ public Map> getCommandMap() { testClusterClusterInteractionInfoMap.put( "testEmitTestEventRequest", testClustertestEmitTestEventRequestInteractionInfo); commandMap.put("testCluster", testClusterClusterInteractionInfoMap); + Map faultInjectionClusterInteractionInfoMap = new LinkedHashMap<>(); + Map faultInjectionfailAtFaultCommandParams = + new LinkedHashMap(); + CommandParameterInfo faultInjectionfailAtFaulttypeCommandParameterInfo = + new CommandParameterInfo("type", Integer.class, Integer.class); + faultInjectionfailAtFaultCommandParams.put( + "type", faultInjectionfailAtFaulttypeCommandParameterInfo); + + CommandParameterInfo faultInjectionfailAtFaultidCommandParameterInfo = + new CommandParameterInfo("id", Long.class, Long.class); + faultInjectionfailAtFaultCommandParams.put( + "id", faultInjectionfailAtFaultidCommandParameterInfo); + + CommandParameterInfo faultInjectionfailAtFaultnumCallsToSkipCommandParameterInfo = + new CommandParameterInfo("numCallsToSkip", Long.class, Long.class); + faultInjectionfailAtFaultCommandParams.put( + "numCallsToSkip", faultInjectionfailAtFaultnumCallsToSkipCommandParameterInfo); + + CommandParameterInfo faultInjectionfailAtFaultnumCallsToFailCommandParameterInfo = + new CommandParameterInfo("numCallsToFail", Long.class, Long.class); + faultInjectionfailAtFaultCommandParams.put( + "numCallsToFail", faultInjectionfailAtFaultnumCallsToFailCommandParameterInfo); + + CommandParameterInfo faultInjectionfailAtFaulttakeMutexCommandParameterInfo = + new CommandParameterInfo("takeMutex", Boolean.class, Boolean.class); + faultInjectionfailAtFaultCommandParams.put( + "takeMutex", faultInjectionfailAtFaulttakeMutexCommandParameterInfo); + + InteractionInfo faultInjectionfailAtFaultInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.FaultInjectionCluster) cluster) + .failAtFault( + (DefaultClusterCallback) callback, + (Integer) commandArguments.get("type"), + (Long) commandArguments.get("id"), + (Long) commandArguments.get("numCallsToSkip"), + (Long) commandArguments.get("numCallsToFail"), + (Boolean) commandArguments.get("takeMutex")); + }, + () -> new DelegatedDefaultClusterCallback(), + faultInjectionfailAtFaultCommandParams); + faultInjectionClusterInteractionInfoMap.put( + "failAtFault", faultInjectionfailAtFaultInteractionInfo); + commandMap.put("faultInjection", faultInjectionClusterInteractionInfoMap); return commandMap; } } diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java index b56a5d2d0e01ef..bb881021b50feb 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java @@ -12422,6 +12422,81 @@ public Map> getReadAttributeMap() { readTestClusterInteractionInfo.put( "readClusterRevisionAttribute", readTestClusterClusterRevisionAttributeInteractionInfo); readAttributeMap.put("testCluster", readTestClusterInteractionInfo); + Map readFaultInjectionInteractionInfo = new LinkedHashMap<>(); + Map readFaultInjectionGeneratedCommandListCommandParams = + new LinkedHashMap(); + InteractionInfo readFaultInjectionGeneratedCommandListAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.FaultInjectionCluster) cluster) + .readGeneratedCommandListAttribute( + (ChipClusters.FaultInjectionCluster.GeneratedCommandListAttributeCallback) + callback); + }, + () -> + new ClusterInfoMapping + .DelegatedFaultInjectionClusterGeneratedCommandListAttributeCallback(), + readFaultInjectionGeneratedCommandListCommandParams); + readFaultInjectionInteractionInfo.put( + "readGeneratedCommandListAttribute", + readFaultInjectionGeneratedCommandListAttributeInteractionInfo); + Map readFaultInjectionAcceptedCommandListCommandParams = + new LinkedHashMap(); + InteractionInfo readFaultInjectionAcceptedCommandListAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.FaultInjectionCluster) cluster) + .readAcceptedCommandListAttribute( + (ChipClusters.FaultInjectionCluster.AcceptedCommandListAttributeCallback) + callback); + }, + () -> + new ClusterInfoMapping + .DelegatedFaultInjectionClusterAcceptedCommandListAttributeCallback(), + readFaultInjectionAcceptedCommandListCommandParams); + readFaultInjectionInteractionInfo.put( + "readAcceptedCommandListAttribute", + readFaultInjectionAcceptedCommandListAttributeInteractionInfo); + Map readFaultInjectionAttributeListCommandParams = + new LinkedHashMap(); + InteractionInfo readFaultInjectionAttributeListAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.FaultInjectionCluster) cluster) + .readAttributeListAttribute( + (ChipClusters.FaultInjectionCluster.AttributeListAttributeCallback) callback); + }, + () -> + new ClusterInfoMapping + .DelegatedFaultInjectionClusterAttributeListAttributeCallback(), + readFaultInjectionAttributeListCommandParams); + readFaultInjectionInteractionInfo.put( + "readAttributeListAttribute", readFaultInjectionAttributeListAttributeInteractionInfo); + Map readFaultInjectionFeatureMapCommandParams = + new LinkedHashMap(); + InteractionInfo readFaultInjectionFeatureMapAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.FaultInjectionCluster) cluster) + .readFeatureMapAttribute((ChipClusters.LongAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readFaultInjectionFeatureMapCommandParams); + readFaultInjectionInteractionInfo.put( + "readFeatureMapAttribute", readFaultInjectionFeatureMapAttributeInteractionInfo); + Map readFaultInjectionClusterRevisionCommandParams = + new LinkedHashMap(); + InteractionInfo readFaultInjectionClusterRevisionAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.FaultInjectionCluster) cluster) + .readClusterRevisionAttribute((ChipClusters.IntegerAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readFaultInjectionClusterRevisionCommandParams); + readFaultInjectionInteractionInfo.put( + "readClusterRevisionAttribute", readFaultInjectionClusterRevisionAttributeInteractionInfo); + readAttributeMap.put("faultInjection", readFaultInjectionInteractionInfo); return readAttributeMap; } } diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java index 95414b21f13d0e..7a2eb30d7bc107 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java @@ -2837,6 +2837,8 @@ public Map> getWriteAttributeMap() { "writeNullableRangeRestrictedInt16sAttribute", writeTestClusterNullableRangeRestrictedInt16sAttributeInteractionInfo); writeAttributeMap.put("testCluster", writeTestClusterInteractionInfo); + Map writeFaultInjectionInteractionInfo = new LinkedHashMap<>(); + writeAttributeMap.put("faultInjection", writeFaultInjectionInteractionInfo); return writeAttributeMap; } } diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 4513a38a25ae45..474e44c941c097 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -7502,6 +7502,55 @@ class ChipClusters: }, }, } + _FAULT_INJECTION_CLUSTER_INFO = { + "clusterName": "FaultInjection", + "clusterId": 0xFFF1FC06, + "commands": { + 0x00000000: { + "commandId": 0x00000000, + "commandName": "FailAtFault", + "args": { + "type": "int", + "id": "int", + "numCallsToSkip": "int", + "numCallsToFail": "int", + "takeMutex": "bool", + }, + }, + }, + "attributes": { + 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, + }, + }, + } _CLUSTER_ID_DICT = { 0x00000003: _IDENTIFY_CLUSTER_INFO, @@ -7569,6 +7618,7 @@ class ChipClusters: 0x0000050E: _ACCOUNT_LOGIN_CLUSTER_INFO, 0x00000B04: _ELECTRICAL_MEASUREMENT_CLUSTER_INFO, 0xFFF1FC05: _TEST_CLUSTER_CLUSTER_INFO, + 0xFFF1FC06: _FAULT_INJECTION_CLUSTER_INFO, } _CLUSTER_NAME_DICT = { @@ -7637,6 +7687,7 @@ class ChipClusters: "AccountLogin": _ACCOUNT_LOGIN_CLUSTER_INFO, "ElectricalMeasurement": _ELECTRICAL_MEASUREMENT_CLUSTER_INFO, "TestCluster": _TEST_CLUSTER_CLUSTER_INFO, + "FaultInjection": _FAULT_INJECTION_CLUSTER_INFO, } def __init__(self, chipstack): diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index b13159384185e8..4397258fed9dcb 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -28985,3 +28985,142 @@ def descriptor(cls) -> ClusterObjectDescriptor: fabricIndex: 'uint' = 0 +@dataclass +class FaultInjection(Cluster): + id: typing.ClassVar[int] = 0xFFF1FC06 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="featureMap", Tag=0x0000FFFC, Type=uint), + ClusterObjectFieldDescriptor(Label="clusterRevision", Tag=0x0000FFFD, Type=uint), + ]) + + generatedCommandList: 'typing.List[uint]' = None + acceptedCommandList: 'typing.List[uint]' = None + attributeList: 'typing.List[uint]' = None + featureMap: 'uint' = None + clusterRevision: 'uint' = None + + class Enums: + class FaultType(IntEnum): + kUnspecified = 0x00 + kSystemFault = 0x01 + kInetFault = 0x02 + kChipFault = 0x03 + kCertFault = 0x04 + + + + class Commands: + @dataclass + class FailAtFault(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0xFFF1FC06 + command_id: typing.ClassVar[int] = 0x0000 + is_client: typing.ClassVar[bool] = True + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="type", Tag=0, Type=FaultInjection.Enums.FaultType), + ClusterObjectFieldDescriptor(Label="id", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="numCallsToSkip", Tag=2, Type=uint), + ClusterObjectFieldDescriptor(Label="numCallsToFail", Tag=3, Type=uint), + ClusterObjectFieldDescriptor(Label="takeMutex", Tag=4, Type=bool), + ]) + + type: 'FaultInjection.Enums.FaultType' = 0 + id: 'uint' = 0 + numCallsToSkip: 'uint' = 0 + numCallsToFail: 'uint' = 0 + takeMutex: 'bool' = False + + + class Attributes: + @dataclass + class GeneratedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0xFFF1FC06 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF8 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class AcceptedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0xFFF1FC06 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF9 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class AttributeList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0xFFF1FC06 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFB + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class FeatureMap(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0xFFF1FC06 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFC + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class ClusterRevision(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0xFFF1FC06 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFD + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + + diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 3bd3d70a8e3de3..671a368001c51d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -17553,6 +17553,115 @@ id MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader & } break; } + case Clusters::FaultInjection::Id: { + using namespace Clusters::FaultInjection; + switch (aPath.mAttributeId) { + 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; + } default: { *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; break; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index fcd359ef6e62ad..43e1ddc4bf0516 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -21986,6 +21986,115 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Fault Injection + * + */ +@interface MTRBaseClusterFaultInjection : MTRCluster + +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device + endpoint:(uint16_t)endpoint + queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; + +- (void)failAtFaultWithParams:(MTRFaultInjectionClusterFailAtFaultParams *)params + completionHandler:(StatusCompletion)completionHandler; + +- (void)readAttributeGeneratedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, + NSError * _Nullable error))completionHandler; +/** + * This API does not support setting autoResubscribe to NO in the + * MTRSubscribeParams. + */ +- (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished: + (SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler; ++ (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler; + +- (void)readAttributeAcceptedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, + NSError * _Nullable error))completionHandler; +/** + * This API does not support setting autoResubscribe to NO in the + * MTRSubscribeParams. + */ +- (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished: + (SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler; ++ (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler; + +- (void)readAttributeAttributeListWithCompletionHandler:(void (^)( + NSArray * _Nullable value, NSError * _Nullable error))completionHandler; +/** + * This API does not support setting autoResubscribe to NO in the + * MTRSubscribeParams. + */ +- (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler; ++ (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler; + +- (void)readAttributeFeatureMapWithCompletionHandler:(void (^)( + NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; +/** + * This API does not support setting autoResubscribe to NO in the + * MTRSubscribeParams. + */ +- (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler; ++ (void)readAttributeFeatureMapWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; + +- (void)readAttributeClusterRevisionWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler; +/** + * This API does not support setting autoResubscribe to NO in the + * MTRSubscribeParams. + */ +- (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler; ++ (void)readAttributeClusterRevisionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + typedef NS_ENUM(uint8_t, MTRIdentifyEffectIdentifier) { MTRIdentifyEffectIdentifierBlink = 0x00, MTRIdentifyEffectIdentifierBreathe = 0x01, @@ -23413,4 +23522,12 @@ typedef NS_OPTIONS(uint8_t, MTRTestClusterSimpleBitmap) { MTRTestClusterSimpleBitmapValueC = 0x4, }; +typedef NS_ENUM(uint8_t, MTRFaultInjectionFaultType) { + MTRFaultInjectionFaultTypeUnspecified = 0x00, + MTRFaultInjectionFaultTypeSystemFault = 0x01, + MTRFaultInjectionFaultTypeInetFault = 0x02, + MTRFaultInjectionFaultTypeChipFault = 0x03, + MTRFaultInjectionFaultTypeCertFault = 0x04, +}; + NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 2802b6e31b55c2..e043a252d51acc 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -93568,4 +93568,405 @@ new MTRInt16uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * su @end +@implementation MTRBaseClusterFaultInjection + +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +{ + if (self = [super initWithQueue:queue]) { + if (device == nil) { + return nil; + } + + _device = device; + _endpoint = endpoint; + } + return self; +} + +- (void)failAtFaultWithParams:(MTRFaultInjectionClusterFailAtFaultParams *)params + completionHandler:(StatusCompletion)completionHandler +{ + // Make a copy of params before we go async. + params = [params copy]; + new MTRCommandSuccessCallbackBridge( + self.callbackQueue, self.device, + ^(id _Nullable value, NSError * _Nullable error) { + completionHandler(error); + }, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + chip::Optional timedInvokeTimeoutMs; + ListFreer listFreer; + FaultInjection::Commands::FailAtFault::Type request; + if (params != nil) { + if (params.timedInvokeTimeoutMs != nil) { + timedInvokeTimeoutMs.SetValue(params.timedInvokeTimeoutMs.unsignedShortValue); + } + } + request.type = static_cast>(params.type.unsignedCharValue); + request.id = params.id.unsignedIntValue; + request.numCallsToSkip = params.numCallsToSkip.unsignedIntValue; + request.numCallsToFail = params.numCallsToFail.unsignedIntValue; + request.takeMutex = params.takeMutex.boolValue; + + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + chip::Controller::FaultInjectionCluster cppCluster(exchangeManager, session, self->_endpoint); + return cppCluster.InvokeCommand(request, successFn->mContext, successFn->mCall, failureFn->mCall, timedInvokeTimeoutMs); + }); +} + +- (void)readAttributeGeneratedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, + NSError * _Nullable error))completionHandler +{ + new MTRFaultInjectionGeneratedCommandListListAttributeCallbackBridge(self.callbackQueue, self.device, completionHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + using TypeInfo = FaultInjection::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + chip::Controller::FaultInjectionCluster cppCluster(exchangeManager, session, self->_endpoint); + return cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished: + (SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + // Make a copy of params before we go async. + minInterval = [minInterval copy]; + maxInterval = [maxInterval copy]; + params = [params copy]; + new MTRFaultInjectionGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FaultInjection::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::FaultInjectionCluster cppCluster(exchangeManager, session, self->_endpoint); + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRFaultInjectionGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); +} + ++ (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +{ + new MTRFaultInjectionGeneratedCommandListListAttributeCallbackBridge( + queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + if (attributeCacheContainer.cppAttributeCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = FaultInjection::Attributes::GeneratedCommandList::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); + auto successFn = Callback::FromCancelable(success); + if (err == CHIP_NO_ERROR) { + successFn->mCall(successFn->mContext, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +- (void)readAttributeAcceptedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, + NSError * _Nullable error))completionHandler +{ + new MTRFaultInjectionAcceptedCommandListListAttributeCallbackBridge(self.callbackQueue, self.device, completionHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + using TypeInfo = FaultInjection::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + chip::Controller::FaultInjectionCluster cppCluster(exchangeManager, session, self->_endpoint); + return cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished: + (SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + // Make a copy of params before we go async. + minInterval = [minInterval copy]; + maxInterval = [maxInterval copy]; + params = [params copy]; + new MTRFaultInjectionAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FaultInjection::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::FaultInjectionCluster cppCluster(exchangeManager, session, self->_endpoint); + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRFaultInjectionAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); +} + ++ (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +{ + new MTRFaultInjectionAcceptedCommandListListAttributeCallbackBridge( + queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + if (attributeCacheContainer.cppAttributeCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = FaultInjection::Attributes::AcceptedCommandList::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); + auto successFn = Callback::FromCancelable(success); + if (err == CHIP_NO_ERROR) { + successFn->mCall(successFn->mContext, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +- (void)readAttributeAttributeListWithCompletionHandler:(void (^)( + NSArray * _Nullable value, NSError * _Nullable error))completionHandler +{ + new MTRFaultInjectionAttributeListListAttributeCallbackBridge(self.callbackQueue, self.device, completionHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + using TypeInfo = FaultInjection::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + chip::Controller::FaultInjectionCluster cppCluster(exchangeManager, session, self->_endpoint); + return cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + // Make a copy of params before we go async. + minInterval = [minInterval copy]; + maxInterval = [maxInterval copy]; + params = [params copy]; + new MTRFaultInjectionAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FaultInjection::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::FaultInjectionCluster cppCluster(exchangeManager, session, self->_endpoint); + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRFaultInjectionAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); +} + ++ (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +{ + new MTRFaultInjectionAttributeListListAttributeCallbackBridge( + queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + if (attributeCacheContainer.cppAttributeCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = FaultInjection::Attributes::AttributeList::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); + auto successFn = Callback::FromCancelable(success); + if (err == CHIP_NO_ERROR) { + successFn->mCall(successFn->mContext, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +- (void)readAttributeFeatureMapWithCompletionHandler:(void (^)( + NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + new MTRInt32uAttributeCallbackBridge(self.callbackQueue, self.device, completionHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + using TypeInfo = FaultInjection::Attributes::FeatureMap::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + chip::Controller::FaultInjectionCluster cppCluster(exchangeManager, session, self->_endpoint); + return cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + // Make a copy of params before we go async. + minInterval = [minInterval copy]; + maxInterval = [maxInterval copy]; + params = [params copy]; + new MTRInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FaultInjection::Attributes::FeatureMap::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::FaultInjectionCluster cppCluster(exchangeManager, session, self->_endpoint); + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); +} + ++ (void)readAttributeFeatureMapWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + new MTRInt32uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + if (attributeCacheContainer.cppAttributeCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = FaultInjection::Attributes::FeatureMap::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); + auto successFn = Callback::FromCancelable(success); + if (err == CHIP_NO_ERROR) { + successFn->mCall(successFn->mContext, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +- (void)readAttributeClusterRevisionWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler +{ + new MTRInt16uAttributeCallbackBridge(self.callbackQueue, self.device, completionHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + using TypeInfo = FaultInjection::Attributes::ClusterRevision::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + chip::Controller::FaultInjectionCluster cppCluster(exchangeManager, session, self->_endpoint); + return cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + // Make a copy of params before we go async. + minInterval = [minInterval copy]; + maxInterval = [maxInterval copy]; + params = [params copy]; + new MTRInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FaultInjection::Attributes::ClusterRevision::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::FaultInjectionCluster cppCluster(exchangeManager, session, self->_endpoint); + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); +} + ++ (void)readAttributeClusterRevisionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + new MTRInt16uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + if (attributeCacheContainer.cppAttributeCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = FaultInjection::Attributes::ClusterRevision::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); + auto successFn = Callback::FromCancelable(success); + if (err == CHIP_NO_ERROR) { + successFn->mCall(successFn->mContext, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +@end + // NOLINTEND(clang-analyzer-cplusplus.NewDeleteLeaks) diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters_internal.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters_internal.h index 359f771f5b8910..9c3afd19a23a4d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters_internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters_internal.h @@ -348,3 +348,8 @@ @property (nonatomic, strong, readonly) MTRBaseDevice * device; @property (nonatomic, assign, readonly) chip::EndpointId endpoint; @end + +@interface MTRBaseClusterFaultInjection () +@property (nonatomic, strong, readonly) MTRBaseDevice * device; +@property (nonatomic, assign, readonly) chip::EndpointId endpoint; +@end diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm index 4c82f32c8365f6..70a58543255418 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm @@ -11563,6 +11563,123 @@ } } +void MTRFaultInjectionGeneratedCommandListListAttributeCallbackBridge::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 MTRFaultInjectionGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) +{ + auto * self = static_cast(context); + if (!self->mQueue) { + return; + } + + if (self->mEstablishedHandler != nil) { + dispatch_async(self->mQueue, self->mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + self->mEstablishedHandler = nil; + } +} + +void MTRFaultInjectionAcceptedCommandListListAttributeCallbackBridge::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 MTRFaultInjectionAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) +{ + auto * self = static_cast(context); + if (!self->mQueue) { + return; + } + + if (self->mEstablishedHandler != nil) { + dispatch_async(self->mQueue, self->mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + self->mEstablishedHandler = nil; + } +} + +void MTRFaultInjectionAttributeListListAttributeCallbackBridge::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 MTRFaultInjectionAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) +{ + auto * self = static_cast(context); + if (!self->mQueue) { + return; + } + + if (self->mEstablishedHandler != nil) { + dispatch_async(self->mQueue, self->mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + self->mEstablishedHandler = nil; + } +} + void MTRGroupsClusterAddGroupResponseCallbackBridge::OnSuccessFn( void * context, const chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType & data) { @@ -19339,3 +19456,55 @@ self->mEstablishedHandler = nil; } } + +void MTRFaultInjectionClusterFaultTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::FaultInjection::FaultType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void MTRFaultInjectionClusterFaultTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) +{ + auto * self = static_cast(context); + if (!self->mQueue) { + return; + } + + if (self->mEstablishedHandler != nil) { + dispatch_async(self->mQueue, self->mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + self->mEstablishedHandler = nil; + } +} + +void MTRNullableFaultInjectionClusterFaultTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void MTRNullableFaultInjectionClusterFaultTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) +{ + auto * self = static_cast(context); + if (!self->mQueue) { + return; + } + + if (self->mEstablishedHandler != nil) { + dispatch_async(self->mQueue, self->mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + self->mEstablishedHandler = nil; + } +} diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge_internal.h b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge_internal.h index 36ef0831588eb6..c4f9a9ea72702e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge_internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge_internal.h @@ -532,6 +532,9 @@ typedef void (*NullableApplicationBasicClusterApplicationStatusEnumAttributeCall typedef void (*TestClusterClusterSimpleEnumAttributeCallback)(void *, chip::app::Clusters::TestCluster::SimpleEnum); typedef void (*NullableTestClusterClusterSimpleEnumAttributeCallback)( void *, const chip::app::DataModel::Nullable &); +typedef void (*FaultInjectionClusterFaultTypeAttributeCallback)(void *, chip::app::Clusters::FaultInjection::FaultType); +typedef void (*NullableFaultInjectionClusterFaultTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); typedef void (*IdentifyGeneratedCommandListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); @@ -1109,6 +1112,12 @@ typedef void (*TestClusterAcceptedCommandListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); typedef void (*TestClusterAttributeListListAttributeCallback)(void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*FaultInjectionGeneratedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*FaultInjectionAcceptedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*FaultInjectionAttributeListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); class MTRDefaultSuccessCallbackBridge : public MTRCallbackBridge { @@ -15142,6 +15151,150 @@ class MTRTestClusterAttributeListListAttributeCallbackSubscriptionBridge SubscriptionEstablishedHandler mEstablishedHandler; }; +class MTRFaultInjectionGeneratedCommandListListAttributeCallbackBridge + : public MTRCallbackBridge +{ +public: + MTRFaultInjectionGeneratedCommandListListAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + MTRLocalActionBlock action, bool keepAlive = false) : + MTRCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + MTRFaultInjectionGeneratedCommandListListAttributeCallbackBridge(dispatch_queue_t queue, chip::NodeId nodeID, + MTRDeviceController * controller, ResponseHandler handler, + MTRActionBlock action, bool keepAlive = false) : + MTRCallbackBridge(queue, nodeID, controller, handler, action, + OnSuccessFn, keepAlive){}; + + MTRFaultInjectionGeneratedCommandListListAttributeCallbackBridge(dispatch_queue_t queue, MTRBaseDevice * device, + ResponseHandler handler, MTRActionBlock action, + bool keepAlive = false) : + MTRCallbackBridge(queue, device, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, const chip::app::DataModel::DecodableList & value); +}; + +class MTRFaultInjectionGeneratedCommandListListAttributeCallbackSubscriptionBridge + : public MTRFaultInjectionGeneratedCommandListListAttributeCallbackBridge +{ +public: + MTRFaultInjectionGeneratedCommandListListAttributeCallbackSubscriptionBridge( + dispatch_queue_t queue, chip::NodeId nodeID, MTRDeviceController * controller, ResponseHandler handler, + MTRActionBlock action, SubscriptionEstablishedHandler establishedHandler) : + MTRFaultInjectionGeneratedCommandListListAttributeCallbackBridge(queue, nodeID, controller, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + MTRFaultInjectionGeneratedCommandListListAttributeCallbackSubscriptionBridge( + dispatch_queue_t queue, MTRBaseDevice * device, ResponseHandler handler, MTRActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + MTRFaultInjectionGeneratedCommandListListAttributeCallbackBridge(queue, device, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + static void OnSubscriptionEstablished(void * context); + +private: + SubscriptionEstablishedHandler mEstablishedHandler; +}; + +class MTRFaultInjectionAcceptedCommandListListAttributeCallbackBridge + : public MTRCallbackBridge +{ +public: + MTRFaultInjectionAcceptedCommandListListAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + MTRLocalActionBlock action, bool keepAlive = false) : + MTRCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + MTRFaultInjectionAcceptedCommandListListAttributeCallbackBridge(dispatch_queue_t queue, chip::NodeId nodeID, + MTRDeviceController * controller, ResponseHandler handler, + MTRActionBlock action, bool keepAlive = false) : + MTRCallbackBridge(queue, nodeID, controller, handler, action, + OnSuccessFn, keepAlive){}; + + MTRFaultInjectionAcceptedCommandListListAttributeCallbackBridge(dispatch_queue_t queue, MTRBaseDevice * device, + ResponseHandler handler, MTRActionBlock action, + bool keepAlive = false) : + MTRCallbackBridge(queue, device, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, const chip::app::DataModel::DecodableList & value); +}; + +class MTRFaultInjectionAcceptedCommandListListAttributeCallbackSubscriptionBridge + : public MTRFaultInjectionAcceptedCommandListListAttributeCallbackBridge +{ +public: + MTRFaultInjectionAcceptedCommandListListAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, chip::NodeId nodeID, + MTRDeviceController * controller, + ResponseHandler handler, MTRActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + MTRFaultInjectionAcceptedCommandListListAttributeCallbackBridge(queue, nodeID, controller, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + MTRFaultInjectionAcceptedCommandListListAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, MTRBaseDevice * device, + ResponseHandler handler, MTRActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + MTRFaultInjectionAcceptedCommandListListAttributeCallbackBridge(queue, device, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + static void OnSubscriptionEstablished(void * context); + +private: + SubscriptionEstablishedHandler mEstablishedHandler; +}; + +class MTRFaultInjectionAttributeListListAttributeCallbackBridge + : public MTRCallbackBridge +{ +public: + MTRFaultInjectionAttributeListListAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + MTRLocalActionBlock action, bool keepAlive = false) : + MTRCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + MTRFaultInjectionAttributeListListAttributeCallbackBridge(dispatch_queue_t queue, chip::NodeId nodeID, + MTRDeviceController * controller, ResponseHandler handler, + MTRActionBlock action, bool keepAlive = false) : + MTRCallbackBridge(queue, nodeID, controller, handler, action, OnSuccessFn, + keepAlive){}; + + MTRFaultInjectionAttributeListListAttributeCallbackBridge(dispatch_queue_t queue, MTRBaseDevice * device, + ResponseHandler handler, MTRActionBlock action, + bool keepAlive = false) : + MTRCallbackBridge(queue, device, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, const chip::app::DataModel::DecodableList & value); +}; + +class MTRFaultInjectionAttributeListListAttributeCallbackSubscriptionBridge + : public MTRFaultInjectionAttributeListListAttributeCallbackBridge +{ +public: + MTRFaultInjectionAttributeListListAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, chip::NodeId nodeID, + MTRDeviceController * controller, ResponseHandler handler, + MTRActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + MTRFaultInjectionAttributeListListAttributeCallbackBridge(queue, nodeID, controller, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + MTRFaultInjectionAttributeListListAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, MTRBaseDevice * device, + ResponseHandler handler, MTRActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + MTRFaultInjectionAttributeListListAttributeCallbackBridge(queue, device, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + static void OnSubscriptionEstablished(void * context); + +private: + SubscriptionEstablishedHandler mEstablishedHandler; +}; + class MTRGroupsClusterAddGroupResponseCallbackBridge : public MTRCallbackBridge { public: @@ -27534,3 +27687,100 @@ class MTRNullableTestClusterClusterSimpleEnumAttributeCallbackSubscriptionBridge private: SubscriptionEstablishedHandler mEstablishedHandler; }; + +class MTRFaultInjectionClusterFaultTypeAttributeCallbackBridge + : public MTRCallbackBridge +{ +public: + MTRFaultInjectionClusterFaultTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + MTRLocalActionBlock action, bool keepAlive = false) : + MTRCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + MTRFaultInjectionClusterFaultTypeAttributeCallbackBridge(dispatch_queue_t queue, chip::NodeId nodeID, + MTRDeviceController * controller, ResponseHandler handler, + MTRActionBlock action, bool keepAlive = false) : + MTRCallbackBridge(queue, nodeID, controller, handler, action, OnSuccessFn, + keepAlive){}; + + MTRFaultInjectionClusterFaultTypeAttributeCallbackBridge(dispatch_queue_t queue, MTRBaseDevice * device, + ResponseHandler handler, MTRActionBlock action, + bool keepAlive = false) : + MTRCallbackBridge(queue, device, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::FaultInjection::FaultType value); +}; + +class MTRFaultInjectionClusterFaultTypeAttributeCallbackSubscriptionBridge + : public MTRFaultInjectionClusterFaultTypeAttributeCallbackBridge +{ +public: + MTRFaultInjectionClusterFaultTypeAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, chip::NodeId nodeID, + MTRDeviceController * controller, ResponseHandler handler, + MTRActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + MTRFaultInjectionClusterFaultTypeAttributeCallbackBridge(queue, nodeID, controller, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + MTRFaultInjectionClusterFaultTypeAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, MTRBaseDevice * device, + ResponseHandler handler, MTRActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + MTRFaultInjectionClusterFaultTypeAttributeCallbackBridge(queue, device, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + static void OnSubscriptionEstablished(void * context); + +private: + SubscriptionEstablishedHandler mEstablishedHandler; +}; + +class MTRNullableFaultInjectionClusterFaultTypeAttributeCallbackBridge + : public MTRCallbackBridge +{ +public: + MTRNullableFaultInjectionClusterFaultTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + MTRLocalActionBlock action, bool keepAlive = false) : + MTRCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + MTRNullableFaultInjectionClusterFaultTypeAttributeCallbackBridge(dispatch_queue_t queue, chip::NodeId nodeID, + MTRDeviceController * controller, ResponseHandler handler, + MTRActionBlock action, bool keepAlive = false) : + MTRCallbackBridge(queue, nodeID, controller, handler, action, + OnSuccessFn, keepAlive){}; + + MTRNullableFaultInjectionClusterFaultTypeAttributeCallbackBridge(dispatch_queue_t queue, MTRBaseDevice * device, + ResponseHandler handler, MTRActionBlock action, + bool keepAlive = false) : + MTRCallbackBridge(queue, device, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class MTRNullableFaultInjectionClusterFaultTypeAttributeCallbackSubscriptionBridge + : public MTRNullableFaultInjectionClusterFaultTypeAttributeCallbackBridge +{ +public: + MTRNullableFaultInjectionClusterFaultTypeAttributeCallbackSubscriptionBridge( + dispatch_queue_t queue, chip::NodeId nodeID, MTRDeviceController * controller, ResponseHandler handler, + MTRActionBlock action, SubscriptionEstablishedHandler establishedHandler) : + MTRNullableFaultInjectionClusterFaultTypeAttributeCallbackBridge(queue, nodeID, controller, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + MTRNullableFaultInjectionClusterFaultTypeAttributeCallbackSubscriptionBridge( + dispatch_queue_t queue, MTRBaseDevice * device, ResponseHandler handler, MTRActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + MTRNullableFaultInjectionClusterFaultTypeAttributeCallbackBridge(queue, device, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + static void OnSubscriptionEstablished(void * context); + +private: + SubscriptionEstablishedHandler mEstablishedHandler; +}; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index e7ee53846f750a..dbcc34b4f7e45f 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -93,6 +93,7 @@ typedef NS_ENUM(uint32_t, MTRClusterIDType) { MTRClusterAccountLoginID = 0x0000050E, MTRClusterElectricalMeasurementID = 0x00000B04, MTRClusterTestClusterID = 0xFFF1FC05, + MTRClusterFaultInjectionID = 0xFFF1FC06, }; #pragma mark - Attributes IDs @@ -1366,6 +1367,13 @@ typedef NS_ENUM(uint32_t, MTRClusterAttributeIDType) { MTRClusterTestClusterAttributeFeatureMapID = MTRClusterGlobalAttributeFeatureMapID, MTRClusterTestClusterAttributeClusterRevisionID = MTRClusterGlobalAttributeClusterRevisionID, + // Cluster FaultInjection attributes + MTRClusterFaultInjectionAttributeGeneratedCommandListID = MTRClusterGlobalAttributeGeneratedCommandListID, + MTRClusterFaultInjectionAttributeAcceptedCommandListID = MTRClusterGlobalAttributeAcceptedCommandListID, + MTRClusterFaultInjectionAttributeAttributeListID = MTRClusterGlobalAttributeAttributeListID, + MTRClusterFaultInjectionAttributeFeatureMapID = MTRClusterGlobalAttributeFeatureMapID, + MTRClusterFaultInjectionAttributeClusterRevisionID = MTRClusterGlobalAttributeClusterRevisionID, + }; #pragma mark - Commands IDs @@ -1692,6 +1700,9 @@ typedef NS_ENUM(uint32_t, MTRClusterCommandIDType) { MTRClusterTestClusterCommandTestEmitTestEventRequestID = 0x00000014, MTRClusterTestClusterCommandTestEmitTestFabricScopedEventRequestID = 0x00000015, + // Cluster FaultInjection commands + MTRClusterFaultInjectionCommandFailAtFaultID = 0x00000000, + }; #pragma mark - Events IDs diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index ef8bc064a5524f..38664c17e71687 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -5283,4 +5283,34 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Fault Injection + * + */ +@interface MTRClusterFaultInjection : MTRCluster + +- (nullable instancetype)initWithDevice:(MTRDevice *)device + endpoint:(uint16_t)endpoint + queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; + +- (void)failAtFaultWithParams:(MTRFaultInjectionClusterFailAtFaultParams *)params + expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries + expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs + completionHandler:(StatusCompletion)completionHandler; + +- (NSDictionary *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params; + +- (NSDictionary *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params; + +- (NSDictionary *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params; + +- (NSDictionary *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params; + +- (NSDictionary *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 9172a6d3b320c2..26f39666023990 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -22036,4 +22036,98 @@ - (void)writeAttributeNullableRangeRestrictedInt16sWithValue:(NSDictionary *> *)expectedValues + expectedValueInterval:(NSNumber *)expectedValueIntervalMs + completionHandler:(StatusCompletion)completionHandler +{ + // Make a copy of params before we go async. + params = [params copy]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; + new MTRCommandSuccessCallbackBridge( + self.callbackQueue, baseDevice, + ^(id _Nullable value, NSError * _Nullable error) { + completionHandler(error); + }, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + chip::Optional timedInvokeTimeoutMs; + ListFreer listFreer; + FaultInjection::Commands::FailAtFault::Type request; + if (params != nil) { + if (params.timedInvokeTimeoutMs != nil) { + timedInvokeTimeoutMs.SetValue(params.timedInvokeTimeoutMs.unsignedShortValue); + } + } + request.type = static_cast>(params.type.unsignedCharValue); + request.id = params.id.unsignedIntValue; + request.numCallsToSkip = params.numCallsToSkip.unsignedIntValue; + request.numCallsToFail = params.numCallsToFail.unsignedIntValue; + request.takeMutex = params.takeMutex.boolValue; + + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + chip::Controller::FaultInjectionCluster cppCluster(exchangeManager, session, self->_endpoint); + return cppCluster.InvokeCommand(request, successFn->mContext, successFn->mCall, failureFn->mCall, timedInvokeTimeoutMs); + }); + + [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; +} + +- (NSDictionary *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(_endpoint) + clusterID:@(MTRClusterFaultInjectionID) + attributeID:@(MTRClusterFaultInjectionAttributeGeneratedCommandListID) + params:params]; +} + +- (NSDictionary *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(_endpoint) + clusterID:@(MTRClusterFaultInjectionID) + attributeID:@(MTRClusterFaultInjectionAttributeAcceptedCommandListID) + params:params]; +} + +- (NSDictionary *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(_endpoint) + clusterID:@(MTRClusterFaultInjectionID) + attributeID:@(MTRClusterFaultInjectionAttributeAttributeListID) + params:params]; +} + +- (NSDictionary *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(_endpoint) + clusterID:@(MTRClusterFaultInjectionID) + attributeID:@(MTRClusterFaultInjectionAttributeFeatureMapID) + params:params]; +} + +- (NSDictionary *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(_endpoint) + clusterID:@(MTRClusterFaultInjectionID) + attributeID:@(MTRClusterFaultInjectionAttributeClusterRevisionID) + params:params]; +} + +@end + // NOLINTEND(clang-analyzer-cplusplus.NewDeleteLeaks) diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters_internal.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters_internal.h index 3bc39dea076933..7db0939f5c1565 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters_internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters_internal.h @@ -349,3 +349,8 @@ @property (nonatomic, readonly) uint16_t endpoint; @property (nonatomic, readonly) MTRDevice * device; @end + +@interface MTRClusterFaultInjection () +@property (nonatomic, readonly) uint16_t endpoint; +@property (nonatomic, readonly) MTRDevice * device; +@end diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index d3043ec6452991..bfdc4a5aecdfb3 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -6045,6 +6045,36 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; +- (instancetype)init; +- (id)copyWithZone:(nullable NSZone *)zone; +@end +@interface MTRFaultInjectionClusterFailAtFaultParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull type; + +@property (nonatomic, copy) NSNumber * _Nonnull id; + +@property (nonatomic, copy) NSNumber * _Nonnull numCallsToSkip; + +@property (nonatomic, copy) NSNumber * _Nonnull numCallsToFail; + +@property (nonatomic, copy) NSNumber * _Nonnull takeMutex; +/** + * 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; + - (instancetype)init; - (id)copyWithZone:(nullable NSZone *)zone; @end diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 6a7c94a88aa7a4..004f2f29070299 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -8115,6 +8115,48 @@ - (NSString *)description return descriptionString; } +@end +@implementation MTRFaultInjectionClusterFailAtFaultParams +- (instancetype)init +{ + if (self = [super init]) { + + _type = @(0); + + _id = @(0); + + _numCallsToSkip = @(0); + + _numCallsToFail = @(0); + + _takeMutex = @(0); + _timedInvokeTimeoutMs = nil; + } + return self; +} + +- (id)copyWithZone:(nullable NSZone *)zone; +{ + auto other = [[MTRFaultInjectionClusterFailAtFaultParams alloc] init]; + + other.type = self.type; + other.id = self.id; + other.numCallsToSkip = self.numCallsToSkip; + other.numCallsToFail = self.numCallsToFail; + other.takeMutex = self.takeMutex; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = + [NSString stringWithFormat:@"<%@: type:%@; id:%@; numCallsToSkip:%@; numCallsToFail:%@; takeMutex:%@; >", + NSStringFromClass([self class]), _type, _id, _numCallsToSkip, _numCallsToFail, _takeMutex]; + return descriptionString; +} + @end NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm index 6ee6ada8dabb0f..92ccbc1751f4d9 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm @@ -2246,6 +2246,16 @@ id MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVReader & aRead } break; } + case Clusters::FaultInjection::Id: { + using namespace Clusters::FaultInjection; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + break; + } + break; + } default: { *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; break; diff --git a/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp index 9f7a13348a8157..411c19ff34c510 100644 --- a/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp @@ -573,6 +573,43 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } // namespace EthernetNetworkDiagnostics +namespace FaultInjection { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::FailAtFault::Id: { + Commands::FailAtFault::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfFaultInjectionClusterFailAtFaultCallback(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 FaultInjection + namespace GeneralCommissioning { void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) @@ -2029,6 +2066,9 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: case Clusters::EthernetNetworkDiagnostics::Id: Clusters::EthernetNetworkDiagnostics::DispatchServerCommand(apCommandObj, aCommandPath, aReader); break; + case Clusters::FaultInjection::Id: + Clusters::FaultInjection::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; case Clusters::GeneralCommissioning::Id: Clusters::GeneralCommissioning::DispatchServerCommand(apCommandObj, aCommandPath, aReader); break; diff --git a/zzz_generated/all-clusters-app/zap-generated/PluginApplicationCallbacks.h b/zzz_generated/all-clusters-app/zap-generated/PluginApplicationCallbacks.h index 91b13ebc3ec0dc..841c63fdb69b0e 100644 --- a/zzz_generated/all-clusters-app/zap-generated/PluginApplicationCallbacks.h +++ b/zzz_generated/all-clusters-app/zap-generated/PluginApplicationCallbacks.h @@ -84,4 +84,5 @@ MatterApplicationBasicPluginServerInitCallback(); \ MatterAccountLoginPluginServerInitCallback(); \ MatterElectricalMeasurementPluginServerInitCallback(); \ - MatterTestClusterPluginServerInitCallback(); + MatterTestClusterPluginServerInitCallback(); \ + MatterFaultInjectionPluginServerInitCallback(); diff --git a/zzz_generated/all-clusters-app/zap-generated/access.h b/zzz_generated/all-clusters-app/zap-generated/access.h index 14751b3beb7416..5c5f1df7633748 100644 --- a/zzz_generated/all-clusters-app/zap-generated/access.h +++ b/zzz_generated/all-clusters-app/zap-generated/access.h @@ -430,6 +430,7 @@ 257, /* Cluster: Door Lock, Command: SetCredential, Privilege: administer */ \ 257, /* Cluster: Door Lock, Command: GetCredentialStatus, Privilege: administer */ \ 257, /* Cluster: Door Lock, Command: ClearCredential, Privilege: administer */ \ + 4294048774, /* Cluster: Fault Injection, Command: FailAtFault, Privilege: manage */ \ } // Parallel array data (cluster, *command*, privilege) for invoke command @@ -480,6 +481,7 @@ 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: Fault Injection, Command: FailAtFault, Privilege: manage */ \ } // Parallel array data (cluster, command, *privilege*) for invoke command @@ -530,6 +532,7 @@ 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: Fault Injection, Command: FailAtFault, Privilege: manage */ \ } //////////////////////////////////////////////////////////////////////////////// diff --git a/zzz_generated/all-clusters-app/zap-generated/callback-stub.cpp b/zzz_generated/all-clusters-app/zap-generated/callback-stub.cpp index ef520e0bd1b5bf..79eb5a24243274 100644 --- a/zzz_generated/all-clusters-app/zap-generated/callback-stub.cpp +++ b/zzz_generated/all-clusters-app/zap-generated/callback-stub.cpp @@ -92,6 +92,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_FAN_CONTROL_CLUSTER_ID: emberAfFanControlClusterInitCallback(endpoint); break; + case ZCL_FAULT_INJECTION_CLUSTER_ID: + emberAfFaultInjectionClusterInitCallback(endpoint); + break; case ZCL_FIXED_LABEL_CLUSTER_ID: emberAfFixedLabelClusterInitCallback(endpoint); break; @@ -329,6 +332,11 @@ void __attribute__((weak)) emberAfFanControlClusterInitCallback(EndpointId endpo // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfFaultInjectionClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfFixedLabelClusterInitCallback(EndpointId endpoint) { // To prevent warning 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 397d0a242bfb45..2ec296db48ed69 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 715 +#define GENERATED_ATTRIBUTE_COUNT 717 #define GENERATED_ATTRIBUTES \ { \ \ @@ -761,6 +761,10 @@ { 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: 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 */ \ + \ /* Endpoint: 1, Cluster: Identify (server) */ \ { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* identify time */ \ { 0x00000001, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x0) }, /* identify type */ \ @@ -1668,13 +1672,17 @@ 0x00000002 /* KeySetReadResponse */, \ 0x00000005 /* KeySetReadAllIndicesResponse */, \ chip::kInvalidCommandId /* end of list */, \ - /* Endpoint: 1, Cluster: Identify (server) */\ + /* Endpoint: 0, Cluster: Fault Injection (server) */\ /* AcceptedCommandList (index=76) */ \ + 0x00000000 /* FailAtFault */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 1, Cluster: Identify (server) */\ + /* AcceptedCommandList (index=78) */ \ 0x00000000 /* Identify */, \ 0x00000040 /* TriggerEffect */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Groups (server) */\ - /* AcceptedCommandList (index=79) */ \ + /* AcceptedCommandList (index=81) */ \ 0x00000000 /* AddGroup */, \ 0x00000001 /* ViewGroup */, \ 0x00000002 /* GetGroupMembership */, \ @@ -1682,14 +1690,14 @@ 0x00000004 /* RemoveAllGroups */, \ 0x00000005 /* AddGroupIfIdentifying */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=86)*/ \ + /* GeneratedCommandList (index=88)*/ \ 0x00000000 /* AddGroupResponse */, \ 0x00000001 /* ViewGroupResponse */, \ 0x00000002 /* GetGroupMembershipResponse */, \ 0x00000003 /* RemoveGroupResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Scenes (server) */\ - /* AcceptedCommandList (index=91) */ \ + /* AcceptedCommandList (index=93) */ \ 0x00000000 /* AddScene */, \ 0x00000001 /* ViewScene */, \ 0x00000002 /* RemoveScene */, \ @@ -1698,7 +1706,7 @@ 0x00000005 /* RecallScene */, \ 0x00000006 /* GetSceneMembership */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=99)*/ \ + /* GeneratedCommandList (index=101)*/ \ 0x00000000 /* AddSceneResponse */, \ 0x00000001 /* ViewSceneResponse */, \ 0x00000002 /* RemoveSceneResponse */, \ @@ -1707,7 +1715,7 @@ 0x00000006 /* GetSceneMembershipResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: On/Off (server) */\ - /* AcceptedCommandList (index=106) */ \ + /* AcceptedCommandList (index=108) */ \ 0x00000000 /* Off */, \ 0x00000001 /* On */, \ 0x00000002 /* Toggle */, \ @@ -1716,7 +1724,7 @@ 0x00000042 /* OnWithTimedOff */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Level Control (server) */\ - /* AcceptedCommandList (index=113) */ \ + /* AcceptedCommandList (index=115) */ \ 0x00000000 /* MoveToLevel */, \ 0x00000001 /* Move */, \ 0x00000002 /* Step */, \ @@ -1727,11 +1735,11 @@ 0x00000007 /* StopWithOnOff */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Mode Select (server) */\ - /* AcceptedCommandList (index=122) */ \ + /* AcceptedCommandList (index=124) */ \ 0x00000000 /* ChangeToMode */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Door Lock (server) */\ - /* AcceptedCommandList (index=124) */ \ + /* AcceptedCommandList (index=126) */ \ 0x00000000 /* LockDoor */, \ 0x00000001 /* UnlockDoor */, \ 0x00000003 /* UnlockWithTimeout */, \ @@ -1747,7 +1755,7 @@ 0x00000024 /* GetCredentialStatus */, \ 0x00000026 /* ClearCredential */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=139)*/ \ + /* GeneratedCommandList (index=141)*/ \ 0x0000000C /* GetWeekDayScheduleResponse */, \ 0x0000000F /* GetYearDayScheduleResponse */, \ 0x0000001C /* GetUserResponse */, \ @@ -1755,7 +1763,7 @@ 0x00000025 /* GetCredentialStatusResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Window Covering (server) */\ - /* AcceptedCommandList (index=145) */ \ + /* AcceptedCommandList (index=147) */ \ 0x00000000 /* UpOrOpen */, \ 0x00000001 /* DownOrClose */, \ 0x00000002 /* StopMotion */, \ @@ -1765,16 +1773,16 @@ 0x00000008 /* GoToTiltPercentage */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Barrier Control (server) */\ - /* AcceptedCommandList (index=153) */ \ + /* AcceptedCommandList (index=155) */ \ 0x00000000 /* BarrierControlGoToPercent */, \ 0x00000001 /* BarrierControlStop */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Thermostat (server) */\ - /* AcceptedCommandList (index=156) */ \ + /* AcceptedCommandList (index=158) */ \ 0x00000000 /* SetpointRaiseLower */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Color Control (server) */\ - /* AcceptedCommandList (index=158) */ \ + /* AcceptedCommandList (index=160) */ \ 0x00000000 /* MoveToHue */, \ 0x00000001 /* MoveHue */, \ 0x00000002 /* StepHue */, \ @@ -1796,32 +1804,32 @@ 0x0000004C /* StepColorTemperature */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Target Navigator (server) */\ - /* AcceptedCommandList (index=178) */ \ + /* AcceptedCommandList (index=180) */ \ 0x00000000 /* NavigateTarget */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=180)*/ \ + /* GeneratedCommandList (index=182)*/ \ 0x00000001 /* NavigateTargetResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Media Input (server) */\ - /* AcceptedCommandList (index=182) */ \ + /* AcceptedCommandList (index=184) */ \ 0x00000000 /* SelectInput */, \ 0x00000001 /* ShowInputStatus */, \ 0x00000002 /* HideInputStatus */, \ 0x00000003 /* RenameInput */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Low Power (server) */\ - /* AcceptedCommandList (index=187) */ \ + /* AcceptedCommandList (index=189) */ \ 0x00000000 /* Sleep */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Keypad Input (server) */\ - /* AcceptedCommandList (index=189) */ \ + /* AcceptedCommandList (index=191) */ \ 0x00000000 /* SendKey */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=191)*/ \ + /* GeneratedCommandList (index=193)*/ \ 0x00000001 /* SendKeyResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Test Cluster (server) */\ - /* AcceptedCommandList (index=193) */ \ + /* AcceptedCommandList (index=195) */ \ 0x00000000 /* Test */, \ 0x00000001 /* TestNotHandled */, \ 0x00000002 /* TestSpecific */, \ @@ -1841,7 +1849,7 @@ 0x00000014 /* TestEmitTestEventRequest */, \ 0x00000015 /* TestEmitTestFabricScopedEventRequest */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=212)*/ \ + /* GeneratedCommandList (index=214)*/ \ 0x00000000 /* TestSpecificResponse */, \ 0x00000001 /* TestAddArgumentsResponse */, \ 0x00000004 /* TestListInt8UReverseResponse */, \ @@ -1853,7 +1861,7 @@ 0x0000000B /* TestEmitTestFabricScopedEventResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 2, Cluster: Groups (server) */\ - /* AcceptedCommandList (index=222) */ \ + /* AcceptedCommandList (index=224) */ \ 0x00000000 /* AddGroup */, \ 0x00000001 /* ViewGroup */, \ 0x00000002 /* GetGroupMembership */, \ @@ -1861,20 +1869,20 @@ 0x00000004 /* RemoveAllGroups */, \ 0x00000005 /* AddGroupIfIdentifying */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=229)*/ \ + /* GeneratedCommandList (index=231)*/ \ 0x00000000 /* AddGroupResponse */, \ 0x00000001 /* ViewGroupResponse */, \ 0x00000002 /* GetGroupMembershipResponse */, \ 0x00000003 /* RemoveGroupResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 2, Cluster: On/Off (server) */\ - /* AcceptedCommandList (index=234) */ \ + /* AcceptedCommandList (index=236) */ \ 0x00000000 /* Off */, \ 0x00000001 /* On */, \ 0x00000002 /* Toggle */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 65534, Cluster: Network Commissioning (server) */\ - /* AcceptedCommandList (index=238) */ \ + /* AcceptedCommandList (index=240) */ \ 0x00000000 /* ScanNetworks */, \ 0x00000002 /* AddOrUpdateWiFiNetwork */, \ 0x00000003 /* AddOrUpdateThreadNetwork */, \ @@ -1882,7 +1890,7 @@ 0x00000006 /* ConnectNetwork */, \ 0x00000008 /* ReorderNetwork */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=245)*/ \ + /* GeneratedCommandList (index=247)*/ \ 0x00000001 /* ScanNetworksResponse */, \ 0x00000005 /* NetworkConfigResponse */, \ 0x00000007 /* ConnectNetworkResponse */, \ @@ -1892,7 +1900,7 @@ // clang-format on #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 77 +#define GENERATED_CLUSTER_COUNT 78 // clang-format off #define GENERATED_CLUSTERS { \ @@ -2193,54 +2201,65 @@ .acceptedCommandList = nullptr ,\ .generatedCommandList = nullptr ,\ },\ + { \ + /* Endpoint: 0, Cluster: Fault Injection (server) */ \ + .clusterId = 0xFFF1FC06, \ + .attributes = ZAP_ATTRIBUTE_INDEX(231), \ + .attributeCount = 2, \ + .clusterSize = 6, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 76 ) ,\ + .generatedCommandList = nullptr ,\ + },\ { \ /* Endpoint: 1, Cluster: Identify (server) */ \ .clusterId = 0x00000003, \ - .attributes = ZAP_ATTRIBUTE_INDEX(231), \ + .attributes = ZAP_ATTRIBUTE_INDEX(233), \ .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( 76 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 78 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Groups (server) */ \ .clusterId = 0x00000004, \ - .attributes = ZAP_ATTRIBUTE_INDEX(235), \ + .attributes = ZAP_ATTRIBUTE_INDEX(237), \ .attributeCount = 3, \ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayGroupsServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 79 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 86 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 81 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 88 ) ,\ },\ { \ /* Endpoint: 1, Cluster: Scenes (server) */ \ .clusterId = 0x00000005, \ - .attributes = ZAP_ATTRIBUTE_INDEX(238), \ + .attributes = ZAP_ATTRIBUTE_INDEX(240), \ .attributeCount = 7, \ .clusterSize = 12, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayScenesServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 91 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 99 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 93 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 101 ) ,\ },\ { \ /* Endpoint: 1, Cluster: On/Off (server) */ \ .clusterId = 0x00000006, \ - .attributes = ZAP_ATTRIBUTE_INDEX(245), \ + .attributes = ZAP_ATTRIBUTE_INDEX(247), \ .attributeCount = 7, \ .clusterSize = 13, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayOnOffServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 106 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 108 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: On/off Switch Configuration (server) */ \ .clusterId = 0x00000007, \ - .attributes = ZAP_ATTRIBUTE_INDEX(252), \ + .attributes = ZAP_ATTRIBUTE_INDEX(254), \ .attributeCount = 4, \ .clusterSize = 8, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2251,18 +2270,18 @@ { \ /* Endpoint: 1, Cluster: Level Control (server) */ \ .clusterId = 0x00000008, \ - .attributes = ZAP_ATTRIBUTE_INDEX(256), \ + .attributes = ZAP_ATTRIBUTE_INDEX(258), \ .attributeCount = 16, \ .clusterSize = 27, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayLevelControlServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 113 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 115 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Binary Input (Basic) (server) */ \ .clusterId = 0x0000000F, \ - .attributes = ZAP_ATTRIBUTE_INDEX(272), \ + .attributes = ZAP_ATTRIBUTE_INDEX(274), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2273,7 +2292,7 @@ { \ /* Endpoint: 1, Cluster: Descriptor (server) */ \ .clusterId = 0x0000001D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(277), \ + .attributes = ZAP_ATTRIBUTE_INDEX(279), \ .attributeCount = 6, \ .clusterSize = 4, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2284,7 +2303,7 @@ { \ /* Endpoint: 1, Cluster: Binding (server) */ \ .clusterId = 0x0000001E, \ - .attributes = ZAP_ATTRIBUTE_INDEX(283), \ + .attributes = ZAP_ATTRIBUTE_INDEX(285), \ .attributeCount = 3, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2295,7 +2314,7 @@ { \ /* Endpoint: 1, Cluster: Actions (server) */ \ .clusterId = 0x00000025, \ - .attributes = ZAP_ATTRIBUTE_INDEX(286), \ + .attributes = ZAP_ATTRIBUTE_INDEX(288), \ .attributeCount = 5, \ .clusterSize = 4, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2306,7 +2325,7 @@ { \ /* Endpoint: 1, Cluster: Power Source (server) */ \ .clusterId = 0x0000002F, \ - .attributes = ZAP_ATTRIBUTE_INDEX(291), \ + .attributes = ZAP_ATTRIBUTE_INDEX(293), \ .attributeCount = 8, \ .clusterSize = 72, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2317,7 +2336,7 @@ { \ /* Endpoint: 1, Cluster: Switch (server) */ \ .clusterId = 0x0000003B, \ - .attributes = ZAP_ATTRIBUTE_INDEX(299), \ + .attributes = ZAP_ATTRIBUTE_INDEX(301), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2328,7 +2347,7 @@ { \ /* Endpoint: 1, Cluster: Fixed Label (server) */ \ .clusterId = 0x00000040, \ - .attributes = ZAP_ATTRIBUTE_INDEX(304), \ + .attributes = ZAP_ATTRIBUTE_INDEX(306), \ .attributeCount = 3, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2339,7 +2358,7 @@ { \ /* Endpoint: 1, Cluster: User Label (server) */ \ .clusterId = 0x00000041, \ - .attributes = ZAP_ATTRIBUTE_INDEX(307), \ + .attributes = ZAP_ATTRIBUTE_INDEX(309), \ .attributeCount = 3, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2350,7 +2369,7 @@ { \ /* Endpoint: 1, Cluster: Boolean State (server) */ \ .clusterId = 0x00000045, \ - .attributes = ZAP_ATTRIBUTE_INDEX(310), \ + .attributes = ZAP_ATTRIBUTE_INDEX(312), \ .attributeCount = 3, \ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2361,51 +2380,51 @@ { \ /* Endpoint: 1, Cluster: Mode Select (server) */ \ .clusterId = 0x00000050, \ - .attributes = ZAP_ATTRIBUTE_INDEX(313), \ + .attributes = ZAP_ATTRIBUTE_INDEX(315), \ .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( 122 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 124 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Door Lock (server) */ \ .clusterId = 0x00000101, \ - .attributes = ZAP_ATTRIBUTE_INDEX(322), \ + .attributes = ZAP_ATTRIBUTE_INDEX(324), \ .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( 124 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 139 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 126 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 141 ) ,\ },\ { \ /* Endpoint: 1, Cluster: Window Covering (server) */ \ .clusterId = 0x00000102, \ - .attributes = ZAP_ATTRIBUTE_INDEX(355), \ + .attributes = ZAP_ATTRIBUTE_INDEX(357), \ .attributeCount = 24, \ .clusterSize = 43, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayWindowCoveringServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 145 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 147 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Barrier Control (server) */ \ .clusterId = 0x00000103, \ - .attributes = ZAP_ATTRIBUTE_INDEX(379), \ + .attributes = ZAP_ATTRIBUTE_INDEX(381), \ .attributeCount = 6, \ .clusterSize = 11, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 153 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 155 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Pump Configuration and Control (server) */ \ .clusterId = 0x00000200, \ - .attributes = ZAP_ATTRIBUTE_INDEX(385), \ + .attributes = ZAP_ATTRIBUTE_INDEX(387), \ .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), \ @@ -2416,18 +2435,18 @@ { \ /* Endpoint: 1, Cluster: Thermostat (server) */ \ .clusterId = 0x00000201, \ - .attributes = ZAP_ATTRIBUTE_INDEX(410), \ + .attributes = ZAP_ATTRIBUTE_INDEX(412), \ .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( 156 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 158 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Fan Control (server) */ \ .clusterId = 0x00000202, \ - .attributes = ZAP_ATTRIBUTE_INDEX(426), \ + .attributes = ZAP_ATTRIBUTE_INDEX(428), \ .attributeCount = 13, \ .clusterSize = 17, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ @@ -2438,7 +2457,7 @@ { \ /* Endpoint: 1, Cluster: Thermostat User Interface Configuration (server) */ \ .clusterId = 0x00000204, \ - .attributes = ZAP_ATTRIBUTE_INDEX(439), \ + .attributes = ZAP_ATTRIBUTE_INDEX(441), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ @@ -2449,18 +2468,18 @@ { \ /* Endpoint: 1, Cluster: Color Control (server) */ \ .clusterId = 0x00000300, \ - .attributes = ZAP_ATTRIBUTE_INDEX(444), \ + .attributes = ZAP_ATTRIBUTE_INDEX(446), \ .attributeCount = 54, \ .clusterSize = 345, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayColorControlServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 158 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 160 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Illuminance Measurement (server) */ \ .clusterId = 0x00000400, \ - .attributes = ZAP_ATTRIBUTE_INDEX(498), \ + .attributes = ZAP_ATTRIBUTE_INDEX(500), \ .attributeCount = 7, \ .clusterSize = 15, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2471,7 +2490,7 @@ { \ /* Endpoint: 1, Cluster: Temperature Measurement (server) */ \ .clusterId = 0x00000402, \ - .attributes = ZAP_ATTRIBUTE_INDEX(505), \ + .attributes = ZAP_ATTRIBUTE_INDEX(507), \ .attributeCount = 6, \ .clusterSize = 14, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2482,7 +2501,7 @@ { \ /* Endpoint: 1, Cluster: Pressure Measurement (server) */ \ .clusterId = 0x00000403, \ - .attributes = ZAP_ATTRIBUTE_INDEX(511), \ + .attributes = ZAP_ATTRIBUTE_INDEX(513), \ .attributeCount = 5, \ .clusterSize = 12, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2493,7 +2512,7 @@ { \ /* Endpoint: 1, Cluster: Flow Measurement (server) */ \ .clusterId = 0x00000404, \ - .attributes = ZAP_ATTRIBUTE_INDEX(516), \ + .attributes = ZAP_ATTRIBUTE_INDEX(518), \ .attributeCount = 6, \ .clusterSize = 14, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2504,7 +2523,7 @@ { \ /* Endpoint: 1, Cluster: Relative Humidity Measurement (server) */ \ .clusterId = 0x00000405, \ - .attributes = ZAP_ATTRIBUTE_INDEX(522), \ + .attributes = ZAP_ATTRIBUTE_INDEX(524), \ .attributeCount = 6, \ .clusterSize = 14, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2515,7 +2534,7 @@ { \ /* Endpoint: 1, Cluster: Occupancy Sensing (server) */ \ .clusterId = 0x00000406, \ - .attributes = ZAP_ATTRIBUTE_INDEX(528), \ + .attributes = ZAP_ATTRIBUTE_INDEX(530), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -2526,7 +2545,7 @@ { \ /* Endpoint: 1, Cluster: Wake on LAN (server) */ \ .clusterId = 0x00000503, \ - .attributes = ZAP_ATTRIBUTE_INDEX(533), \ + .attributes = ZAP_ATTRIBUTE_INDEX(535), \ .attributeCount = 3, \ .clusterSize = 39, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2537,7 +2556,7 @@ { \ /* Endpoint: 1, Cluster: Channel (server) */ \ .clusterId = 0x00000504, \ - .attributes = ZAP_ATTRIBUTE_INDEX(536), \ + .attributes = ZAP_ATTRIBUTE_INDEX(538), \ .attributeCount = 3, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2548,18 +2567,18 @@ { \ /* Endpoint: 1, Cluster: Target Navigator (server) */ \ .clusterId = 0x00000505, \ - .attributes = ZAP_ATTRIBUTE_INDEX(539), \ + .attributes = ZAP_ATTRIBUTE_INDEX(541), \ .attributeCount = 4, \ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 178 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 180 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 180 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 182 ) ,\ },\ { \ /* Endpoint: 1, Cluster: Media Playback (server) */ \ .clusterId = 0x00000506, \ - .attributes = ZAP_ATTRIBUTE_INDEX(543), \ + .attributes = ZAP_ATTRIBUTE_INDEX(545), \ .attributeCount = 8, \ .clusterSize = 43, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2570,40 +2589,40 @@ { \ /* Endpoint: 1, Cluster: Media Input (server) */ \ .clusterId = 0x00000507, \ - .attributes = ZAP_ATTRIBUTE_INDEX(551), \ + .attributes = ZAP_ATTRIBUTE_INDEX(553), \ .attributeCount = 4, \ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 182 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 184 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Low Power (server) */ \ .clusterId = 0x00000508, \ - .attributes = ZAP_ATTRIBUTE_INDEX(555), \ + .attributes = ZAP_ATTRIBUTE_INDEX(557), \ .attributeCount = 2, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 187 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 189 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Keypad Input (server) */ \ .clusterId = 0x00000509, \ - .attributes = ZAP_ATTRIBUTE_INDEX(557), \ + .attributes = ZAP_ATTRIBUTE_INDEX(559), \ .attributeCount = 2, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 189 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 191 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 191 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 193 ) ,\ },\ { \ /* Endpoint: 1, Cluster: Content Launcher (server) */ \ .clusterId = 0x0000050A, \ - .attributes = ZAP_ATTRIBUTE_INDEX(559), \ + .attributes = ZAP_ATTRIBUTE_INDEX(561), \ .attributeCount = 4, \ .clusterSize = 10, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2614,7 +2633,7 @@ { \ /* Endpoint: 1, Cluster: Audio Output (server) */ \ .clusterId = 0x0000050B, \ - .attributes = ZAP_ATTRIBUTE_INDEX(563), \ + .attributes = ZAP_ATTRIBUTE_INDEX(565), \ .attributeCount = 4, \ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2625,7 +2644,7 @@ { \ /* Endpoint: 1, Cluster: Application Launcher (server) */ \ .clusterId = 0x0000050C, \ - .attributes = ZAP_ATTRIBUTE_INDEX(567), \ + .attributes = ZAP_ATTRIBUTE_INDEX(569), \ .attributeCount = 3, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2636,7 +2655,7 @@ { \ /* Endpoint: 1, Cluster: Application Basic (server) */ \ .clusterId = 0x0000050D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(570), \ + .attributes = ZAP_ATTRIBUTE_INDEX(572), \ .attributeCount = 9, \ .clusterSize = 110, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2647,7 +2666,7 @@ { \ /* Endpoint: 1, Cluster: Account Login (server) */ \ .clusterId = 0x0000050E, \ - .attributes = ZAP_ATTRIBUTE_INDEX(579), \ + .attributes = ZAP_ATTRIBUTE_INDEX(581), \ .attributeCount = 2, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2658,7 +2677,7 @@ { \ /* Endpoint: 1, Cluster: Electrical Measurement (server) */ \ .clusterId = 0x00000B04, \ - .attributes = ZAP_ATTRIBUTE_INDEX(581), \ + .attributes = ZAP_ATTRIBUTE_INDEX(583), \ .attributeCount = 13, \ .clusterSize = 32, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2669,40 +2688,40 @@ { \ /* Endpoint: 1, Cluster: Test Cluster (server) */ \ .clusterId = 0xFFF1FC05, \ - .attributes = ZAP_ATTRIBUTE_INDEX(594), \ + .attributes = ZAP_ATTRIBUTE_INDEX(596), \ .attributeCount = 82, \ .clusterSize = 2289, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 193 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 212 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 195 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 214 ) ,\ },\ { \ /* Endpoint: 2, Cluster: Groups (server) */ \ .clusterId = 0x00000004, \ - .attributes = ZAP_ATTRIBUTE_INDEX(676), \ + .attributes = ZAP_ATTRIBUTE_INDEX(678), \ .attributeCount = 3, \ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayGroupsServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 222 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 229 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 224 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 231 ) ,\ },\ { \ /* Endpoint: 2, Cluster: On/Off (server) */ \ .clusterId = 0x00000006, \ - .attributes = ZAP_ATTRIBUTE_INDEX(679), \ + .attributes = ZAP_ATTRIBUTE_INDEX(681), \ .attributeCount = 7, \ .clusterSize = 13, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayOnOffServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 234 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 236 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 2, Cluster: Descriptor (server) */ \ .clusterId = 0x0000001D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(686), \ + .attributes = ZAP_ATTRIBUTE_INDEX(688), \ .attributeCount = 6, \ .clusterSize = 4, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2713,7 +2732,7 @@ { \ /* Endpoint: 2, Cluster: Power Source (server) */ \ .clusterId = 0x0000002F, \ - .attributes = ZAP_ATTRIBUTE_INDEX(692), \ + .attributes = ZAP_ATTRIBUTE_INDEX(694), \ .attributeCount = 8, \ .clusterSize = 72, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2724,7 +2743,7 @@ { \ /* Endpoint: 2, Cluster: Occupancy Sensing (server) */ \ .clusterId = 0x00000406, \ - .attributes = ZAP_ATTRIBUTE_INDEX(700), \ + .attributes = ZAP_ATTRIBUTE_INDEX(702), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -2735,13 +2754,13 @@ { \ /* Endpoint: 65534, Cluster: Network Commissioning (server) */ \ .clusterId = 0x00000031, \ - .attributes = ZAP_ATTRIBUTE_INDEX(705), \ + .attributes = ZAP_ATTRIBUTE_INDEX(707), \ .attributeCount = 10, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 238 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 245 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 240 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 247 ) ,\ },\ } @@ -2749,13 +2768,13 @@ #define ZAP_CLUSTER_INDEX(index) (&generatedClusters[index]) -#define ZAP_FIXED_ENDPOINT_DATA_VERSION_COUNT 76 +#define ZAP_FIXED_ENDPOINT_DATA_VERSION_COUNT 77 // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 27, 355 }, { ZAP_CLUSTER_INDEX(27), 44, 3459 }, { ZAP_CLUSTER_INDEX(71), 5, 105 }, \ - { ZAP_CLUSTER_INDEX(76), 1, 0 }, \ + { ZAP_CLUSTER_INDEX(0), 28, 361 }, { ZAP_CLUSTER_INDEX(28), 44, 3459 }, { ZAP_CLUSTER_INDEX(72), 5, 105 }, \ + { ZAP_CLUSTER_INDEX(77), 1, 0 }, \ } // Largest attribute size is needed for various buffers @@ -2767,7 +2786,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 (3919) +#define ATTRIBUTE_MAX_SIZE (3925) // 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 a5e29aced289a2..a80439e03c9b04 100644 --- a/zzz_generated/all-clusters-app/zap-generated/gen_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/gen_config.h @@ -92,6 +92,7 @@ #define EMBER_AF_ACCOUNT_LOGIN_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_ELECTRICAL_MEASUREMENT_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_TEST_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_FAULT_INJECTION_CLUSTER_SERVER_ENDPOINT_COUNT (1) /**** Cluster Plugins ****/ @@ -428,3 +429,8 @@ #define ZCL_USING_TEST_CLUSTER_SERVER #define EMBER_AF_PLUGIN_TEST_CLUSTER_SERVER #define EMBER_AF_PLUGIN_TEST_CLUSTER + +// Use this macro to check if the server side of the Fault Injection cluster is included +#define ZCL_USING_FAULT_INJECTION_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_FAULT_INJECTION_SERVER +#define EMBER_AF_PLUGIN_FAULT_INJECTION diff --git a/zzz_generated/app-common/app-common/zap-generated/attribute-id.h b/zzz_generated/app-common/app-common/zap-generated/attribute-id.h index aa7fbc1afd08ab..ab7abb68c6bc5c 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attribute-id.h +++ b/zzz_generated/app-common/app-common/zap-generated/attribute-id.h @@ -1219,3 +1219,9 @@ #define ZCL_NULLABLE_RANGE_RESTRICTED_INT8S_ATTRIBUTE_ID (0x4027) #define ZCL_NULLABLE_RANGE_RESTRICTED_INT16_U_ATTRIBUTE_ID (0x4028) #define ZCL_NULLABLE_RANGE_RESTRICTED_INT16_S_ATTRIBUTE_ID (0x4029) + +// Attribute ids for cluster: Fault Injection + +// Client attributes + +// Server attributes diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index 9fa1281d38db4f..d1b8ec87b5220a 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -30735,6 +30735,74 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) } // namespace Attributes } // namespace TestCluster +namespace FaultInjection { +namespace Attributes { + +namespace FeatureMap { + +EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::FaultInjection::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteServerAttribute(endpoint, Clusters::FaultInjection::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); +} + +} // namespace FeatureMap + +namespace ClusterRevision { + +EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::FaultInjection::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteServerAttribute(endpoint, Clusters::FaultInjection::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); +} + +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace FaultInjection + } // namespace Clusters } // namespace app } // namespace chip diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index 239360ac366b9a..d26576e7723a10 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -5108,6 +5108,22 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); } // namespace Attributes } // namespace TestCluster +namespace FaultInjection { +namespace Attributes { + +namespace FeatureMap { +EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 +EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace FaultInjection + } // namespace Clusters } // namespace app } // namespace chip 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 02c2a59c511de5..26c16148347095 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -605,6 +605,14 @@ void emberAfElectricalMeasurementClusterInitCallback(chip::EndpointId endpoint); */ void emberAfTestClusterClusterInitCallback(chip::EndpointId endpoint); +/** @brief Fault Injection Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfFaultInjectionClusterInitCallback(chip::EndpointId endpoint); + // Cluster Server/Client Init Functions // @@ -7354,6 +7362,104 @@ void emberAfTestClusterClusterServerTickCallback(chip::EndpointId endpoint); */ void emberAfTestClusterClusterClientTickCallback(chip::EndpointId endpoint); +// +// Fault Injection Cluster +// + +/** @brief Fault Injection Cluster Server Init + * + * Server Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfFaultInjectionClusterServerInitCallback(chip::EndpointId endpoint); + +/** @brief Fault Injection Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfFaultInjectionClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Fault Injection Cluster Server Attribute Changed + * + * Server Attribute Changed + * + * @param attributePath Concrete attribute path that changed + */ +void MatterFaultInjectionClusterServerAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath); + +/** @brief Fault Injection Cluster Server Message Sent + * + * Server Message Sent + * + * @param destination The destination to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfFaultInjectionClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Fault Injection Cluster Client Message Sent + * + * Client Message Sent + * + * @param destination The destination to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfFaultInjectionClusterClientMessageSentCallback(const chip::MessageSendDestination & destination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Fault Injection Cluster Server Pre Attribute Changed + * + * Server Pre Attribute Changed + * + * @param attributePath Concrete attribute path to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +chip::Protocols::InteractionModel::Status +MatterFaultInjectionClusterServerPreAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath, + EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); + +/** @brief Fault Injection Cluster Client Pre Attribute Changed + * + * Client Pre Attribute Changed + * + * @param attributePath Concrete attribute path to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +chip::Protocols::InteractionModel::Status +MatterFaultInjectionClusterClientPreAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath, + EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); + +/** @brief Fault Injection Cluster Server Tick + * + * Server Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfFaultInjectionClusterServerTickCallback(chip::EndpointId endpoint); + +/** @brief Fault Injection Cluster Client Tick + * + * Client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfFaultInjectionClusterClientTickCallback(chip::EndpointId endpoint); + // Cluster Commands Callback /** @@ -8807,6 +8913,12 @@ bool emberAfTestClusterClusterTestEmitTestEventRequestCallback( bool emberAfTestClusterClusterTestEmitTestFabricScopedEventRequestCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::TestCluster::Commands::TestEmitTestFabricScopedEventRequest::DecodableType & commandData); +/** + * @brief Fault Injection Cluster FailAtFault Command callback (from client) + */ +bool emberAfFaultInjectionClusterFailAtFaultCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::FaultInjection::Commands::FailAtFault::DecodableType & commandData); /** @brief Add To Current App Tasks * diff --git a/zzz_generated/app-common/app-common/zap-generated/callbacks/PluginCallbacks.h b/zzz_generated/app-common/app-common/zap-generated/callbacks/PluginCallbacks.h index 8fb031e6b583c8..fbc1968cc73d06 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callbacks/PluginCallbacks.h +++ b/zzz_generated/app-common/app-common/zap-generated/callbacks/PluginCallbacks.h @@ -159,3 +159,5 @@ void __attribute__((weak)) MatterElectricalMeasurementPluginClientInitCallback() void MatterElectricalMeasurementPluginServerInitCallback(); void __attribute__((weak)) MatterTestClusterPluginClientInitCallback() {} void MatterTestClusterPluginServerInitCallback(); +void __attribute__((weak)) MatterFaultInjectionPluginClientInitCallback() {} +void MatterFaultInjectionPluginServerInitCallback(); diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h index 64d9c1da0ff753..df67872fcb78ed 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h @@ -2096,6 +2096,22 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(TestCluster::SimpleEnum } } +static auto __attribute__((unused)) EnsureKnownEnumValue(FaultInjection::FaultType val) +{ + using EnumType = FaultInjection::FaultType; + switch (val) + { + case EnumType::kUnspecified: + case EnumType::kSystemFault: + case EnumType::kInetFault: + case EnumType::kChipFault: + case EnumType::kCertFault: + return val; + default: + return static_cast(5); + } +} + } // namespace Clusters } // namespace app } // namespace chip diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index 08e5853c7d3ead..70a3f843d43583 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -2306,6 +2306,20 @@ enum class SimpleBitmap : uint8_t }; } // namespace TestCluster +namespace FaultInjection { + +// Enum for FaultType +enum class FaultType : uint8_t +{ + kUnspecified = 0x00, + kSystemFault = 0x01, + kInetFault = 0x02, + kChipFault = 0x03, + kCertFault = 0x04, + kUnknownEnumValue = 5, +}; +} // namespace FaultInjection + } // namespace Clusters } // namespace app } // namespace chip diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-id.h b/zzz_generated/app-common/app-common/zap-generated/cluster-id.h index 65c4bc484a460b..c587107bd3b10f 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-id.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-id.h @@ -231,3 +231,6 @@ static constexpr chip::ClusterId ZCL_ELECTRICAL_MEASUREMENT_CLUSTER_ID = 0x0B04; // Definitions for cluster: Test Cluster static constexpr chip::ClusterId ZCL_TEST_CLUSTER_ID = 0xFFF1FC05; + +// Definitions for cluster: Fault Injection +static constexpr chip::ClusterId ZCL_FAULT_INJECTION_CLUSTER_ID = 0xFFF1FC06; 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 f3971342a281ad..ec0eb5147c7f97 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 @@ -20883,6 +20883,96 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace Events } // namespace TestCluster +namespace FaultInjection { + +namespace Commands { +namespace FailAtFault { +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::kType)), type)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kId)), id)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kNumCallsToSkip)), numCallsToSkip)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kNumCallsToFail)), numCallsToFail)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kTakeMutex)), takeMutex)); + 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::kType): + ReturnErrorOnFailure(DataModel::Decode(reader, type)); + break; + case to_underlying(Fields::kId): + ReturnErrorOnFailure(DataModel::Decode(reader, id)); + break; + case to_underlying(Fields::kNumCallsToSkip): + ReturnErrorOnFailure(DataModel::Decode(reader, numCallsToSkip)); + break; + case to_underlying(Fields::kNumCallsToFail): + ReturnErrorOnFailure(DataModel::Decode(reader, numCallsToFail)); + break; + case to_underlying(Fields::kTakeMutex): + ReturnErrorOnFailure(DataModel::Decode(reader, takeMutex)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace FailAtFault. +} // namespace Commands + +namespace Attributes { +CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path) +{ + switch (path.mAttributeId) + { + case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); + break; + case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); + break; + case Attributes::AttributeList::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); + break; + case Attributes::FeatureMap::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); + break; + case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); + break; + default: + break; + } + + return CHIP_NO_ERROR; +} +} // namespace Attributes + +namespace Events { +} // namespace Events + +} // namespace FaultInjection } // namespace Clusters @@ -21270,6 +21360,13 @@ bool CommandIsFabricScoped(ClusterId aCluster, CommandId aCommand) return false; } } + case Clusters::FaultInjection::Id: { + switch (aCommand) + { + default: + return false; + } + } } return false; } 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 7aba9ed714c63e..17019d9d8b12a5 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 @@ -28085,6 +28085,115 @@ struct DecodableType } // namespace TestFabricScopedEvent } // namespace Events } // namespace TestCluster +namespace FaultInjection { + +namespace Commands { +// Forward-declarations so we can reference these later. + +namespace FailAtFault { +struct Type; +struct DecodableType; +} // namespace FailAtFault + +} // namespace Commands + +namespace Commands { +namespace FailAtFault { +enum class Fields +{ + kType = 0, + kId = 1, + kNumCallsToSkip = 2, + kNumCallsToFail = 3, + kTakeMutex = 4, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::FailAtFault::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::FaultInjection::Id; } + + FaultType type = static_cast(0); + uint32_t id = static_cast(0); + uint32_t numCallsToSkip = static_cast(0); + uint32_t numCallsToFail = static_cast(0); + bool takeMutex = 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::FailAtFault::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::FaultInjection::Id; } + + FaultType type = static_cast(0); + uint32_t id = static_cast(0); + uint32_t numCallsToSkip = static_cast(0); + uint32_t numCallsToFail = static_cast(0); + bool takeMutex = static_cast(0); + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace FailAtFault +} // namespace Commands + +namespace Attributes { + +namespace GeneratedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::FaultInjection::Id; } +}; +} // namespace GeneratedCommandList +namespace AcceptedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::AcceptedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::FaultInjection::Id; } +}; +} // namespace AcceptedCommandList +namespace AttributeList { +struct TypeInfo : public Clusters::Globals::Attributes::AttributeList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::FaultInjection::Id; } +}; +} // namespace AttributeList +namespace FeatureMap { +struct TypeInfo : public Clusters::Globals::Attributes::FeatureMap::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::FaultInjection::Id; } +}; +} // namespace FeatureMap +namespace ClusterRevision { +struct TypeInfo : public Clusters::Globals::Attributes::ClusterRevision::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::FaultInjection::Id; } +}; +} // namespace ClusterRevision + +struct TypeInfo +{ + struct DecodableType + { + static constexpr ClusterId GetClusterId() { return Clusters::FaultInjection::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); + + Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; + Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; + Attributes::AttributeList::TypeInfo::DecodableType attributeList; + Attributes::FeatureMap::TypeInfo::DecodableType featureMap = static_cast(0); + Attributes::ClusterRevision::TypeInfo::DecodableType clusterRevision = static_cast(0); + }; +}; +} // namespace Attributes +} // namespace FaultInjection } // namespace Clusters 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 502843e55b69b8..95b03a5e717fa4 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 @@ -352,3 +352,6 @@ #define ZCL_TEST_SIMPLE_OPTIONAL_ARGUMENT_REQUEST_COMMAND_ID (0x13) #define ZCL_TEST_EMIT_TEST_EVENT_REQUEST_COMMAND_ID (0x14) #define ZCL_TEST_EMIT_TEST_FABRIC_SCOPED_EVENT_REQUEST_COMMAND_ID (0x15) + +// Commands for cluster: Fault Injection +#define ZCL_FAIL_AT_FAULT_COMMAND_ID (0x00) diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h index 3c07637a654a29..d56fbc9210279e 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h @@ -4955,6 +4955,32 @@ static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; } // namespace Attributes } // namespace TestCluster +namespace FaultInjection { +namespace Attributes { + +namespace GeneratedCommandList { +static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; +} // namespace GeneratedCommandList + +namespace AcceptedCommandList { +static constexpr AttributeId Id = Globals::Attributes::AcceptedCommandList::Id; +} // namespace AcceptedCommandList + +namespace AttributeList { +static constexpr AttributeId Id = Globals::Attributes::AttributeList::Id; +} // namespace AttributeList + +namespace FeatureMap { +static constexpr AttributeId Id = Globals::Attributes::FeatureMap::Id; +} // namespace FeatureMap + +namespace ClusterRevision { +static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace FaultInjection + } // namespace Clusters } // namespace app } // namespace chip diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h b/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h index 9fb0221c98f1d4..1ac3f6831081e6 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h @@ -235,6 +235,9 @@ static constexpr ClusterId Id = 0x00000B04; namespace TestCluster { static constexpr ClusterId Id = 0xFFF1FC05; } // namespace TestCluster +namespace FaultInjection { +static constexpr ClusterId Id = 0xFFF1FC06; +} // namespace FaultInjection } // namespace Clusters } // namespace app 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 b2575ebb67f9e2..cf911dedc35e02 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 @@ -1233,6 +1233,16 @@ static constexpr CommandId Id = 0x00000015; } // namespace Commands } // namespace TestCluster +namespace FaultInjection { +namespace Commands { + +namespace FailAtFault { +static constexpr CommandId Id = 0x00000000; +} // namespace FailAtFault + +} // namespace Commands +} // namespace FaultInjection + } // namespace Clusters } // namespace app } // namespace chip diff --git a/zzz_generated/app-common/app-common/zap-generated/print-cluster.h b/zzz_generated/app-common/app-common/zap-generated/print-cluster.h index f3c9e801570922..89aa6ee258eb45 100644 --- a/zzz_generated/app-common/app-common/zap-generated/print-cluster.h +++ b/zzz_generated/app-common/app-common/zap-generated/print-cluster.h @@ -452,6 +452,12 @@ #define CHIP_PRINTCLUSTER_TEST_CLUSTER #endif +#if defined(ZCL_USING_FAULT_INJECTION_CLUSTER_SERVER) || defined(ZCL_USING_FAULT_INJECTION_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_FAULT_INJECTION_CLUSTER { ZCL_FAULT_INJECTION_CLUSTER_ID, "Fault Injection" }, +#else +#define CHIP_PRINTCLUSTER_FAULT_INJECTION_CLUSTER +#endif + #define CLUSTER_IDS_TO_NAMES \ CHIP_PRINTCLUSTER_IDENTIFY_CLUSTER \ CHIP_PRINTCLUSTER_GROUPS_CLUSTER \ @@ -522,6 +528,7 @@ CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER \ CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER \ CHIP_PRINTCLUSTER_ELECTRICAL_MEASUREMENT_CLUSTER \ - CHIP_PRINTCLUSTER_TEST_CLUSTER + CHIP_PRINTCLUSTER_TEST_CLUSTER \ + CHIP_PRINTCLUSTER_FAULT_INJECTION_CLUSTER #define MAX_CLUSTER_NAME_LENGTH 39 diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index fc77b7c93e1fc8..5c25721dfc3bdd 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -103,6 +103,7 @@ | AccountLogin | 0x050E | | ElectricalMeasurement | 0x0B04 | | TestCluster | 0xFFF1FC05| +| FaultInjection | 0xFFF1FC06| \*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*\ @@ -8143,6 +8144,56 @@ class TestClusterTestEmitTestFabricScopedEventRequest : public ClusterCommand chip::app::Clusters::TestCluster::Commands::TestEmitTestFabricScopedEventRequest::Type mRequest; }; +/*----------------------------------------------------------------------------*\ +| Cluster FaultInjection | 0xFFF1FC06| +|------------------------------------------------------------------------------| +| Commands: | | +| * FailAtFault | 0x00 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + +/* + * Command FailAtFault + */ +class FaultInjectionFailAtFault : public ClusterCommand +{ +public: + FaultInjectionFailAtFault(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("fail-at-fault", credsIssuerConfig) + { + AddArgument("Type", 0, UINT8_MAX, &mRequest.type); + AddArgument("Id", 0, UINT32_MAX, &mRequest.id); + AddArgument("NumCallsToSkip", 0, UINT32_MAX, &mRequest.numCallsToSkip); + AddArgument("NumCallsToFail", 0, UINT32_MAX, &mRequest.numCallsToFail); + AddArgument("TakeMutex", 0, 1, &mRequest.takeMutex); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC06) command (0x00000000) on endpoint %u", endpointIds.at(0)); + + return ClusterCommand::SendCommand(device, endpointIds.at(0), 0xFFF1FC06, 0x00000000, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC06) command (0x00000000) on Group %u", groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, 0xFFF1FC06, 0x00000000, mRequest); + } + +private: + chip::app::Clusters::FaultInjection::Commands::FailAtFault::Type mRequest; +}; + /*----------------------------------------------------------------------------*\ | Register all Clusters commands | \*----------------------------------------------------------------------------*/ @@ -13205,6 +13256,43 @@ void registerClusterTestCluster(Commands & commands, CredentialIssuerCommands * commands.Register(clusterName, clusterCommands); } +void registerClusterFaultInjection(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) +{ + using namespace chip::app::Clusters::FaultInjection; + + const char * clusterName = "FaultInjection"; + + commands_list clusterCommands = { + // + // Commands + // + make_unique(Id, credsIssuerConfig), // + make_unique(credsIssuerConfig), // + // + // Attributes + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + make_unique>(Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + // + // Events + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + }; + + commands.Register(clusterName, clusterCommands); +} void registerClusterAny(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -13297,5 +13385,6 @@ void registerClusters(Commands & commands, CredentialIssuerCommands * credsIssue registerClusterAccountLogin(commands, credsIssuerConfig); registerClusterElectricalMeasurement(commands, credsIssuerConfig); registerClusterTestCluster(commands, credsIssuerConfig); + registerClusterFaultInjection(commands, credsIssuerConfig); registerClusterSubscriptions(commands, credsIssuerConfig); } 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 f2031dd1c3b7d6..3c74e880afe835 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -10002,6 +10002,37 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP } break; } + case FaultInjection::Id: { + switch (path.mAttributeId) + { + case FaultInjection::Attributes::GeneratedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + } + case FaultInjection::Attributes::AcceptedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + } + case FaultInjection::Attributes::AttributeList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AttributeList", 1, value); + } + case FaultInjection::Attributes::FeatureMap::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("FeatureMap", 1, value); + } + case FaultInjection::Attributes::ClusterRevision::Id: { + uint16_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ClusterRevision", 1, value); + } + } + break; + } default: break; } diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 3b2a0ea71e7199..93aea4dc646cd1 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -56238,7 +56238,9 @@ class TestDescriptorClusterSuite : public TestCommand VerifyOrReturn(CheckValue("serverList[24]", iter_0.GetValue(), 65UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 25)); VerifyOrReturn(CheckValue("serverList[25]", iter_0.GetValue(), 1029UL)); - VerifyOrReturn(CheckNoMoreListItems("serverList", iter_0, 26)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 26)); + VerifyOrReturn(CheckValue("serverList[26]", iter_0.GetValue(), 4294048774UL)); + VerifyOrReturn(CheckNoMoreListItems("serverList", iter_0, 27)); } } break; diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h index 63a1b997dd5b6c..5850925843b055 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h @@ -519,3 +519,9 @@ typedef void (*TestClusterAcceptedCommandListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); typedef void (*TestClusterAttributeListListAttributeCallback)(void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*FaultInjectionGeneratedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*FaultInjectionAcceptedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*FaultInjectionAttributeListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h index 96283a05033cd6..6762d44ce16409 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h @@ -631,5 +631,14 @@ class DLL_EXPORT TestClusterCluster : public ClusterBase ~TestClusterCluster() {} }; +class DLL_EXPORT FaultInjectionCluster : public ClusterBase +{ +public: + FaultInjectionCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : + ClusterBase(exchangeManager, session, app::Clusters::FaultInjection::Id, endpoint) + {} + ~FaultInjectionCluster() {} +}; + } // namespace Controller } // namespace chip diff --git a/zzz_generated/controller-clusters/zap-generated/PluginApplicationCallbacks.h b/zzz_generated/controller-clusters/zap-generated/PluginApplicationCallbacks.h index 0b55a4004fc6ec..f11dc67564f01d 100644 --- a/zzz_generated/controller-clusters/zap-generated/PluginApplicationCallbacks.h +++ b/zzz_generated/controller-clusters/zap-generated/PluginApplicationCallbacks.h @@ -86,4 +86,5 @@ MatterApplicationBasicPluginClientInitCallback(); \ MatterAccountLoginPluginClientInitCallback(); \ MatterElectricalMeasurementPluginClientInitCallback(); \ - MatterTestClusterPluginClientInitCallback(); + MatterTestClusterPluginClientInitCallback(); \ + MatterFaultInjectionPluginClientInitCallback(); diff --git a/zzz_generated/controller-clusters/zap-generated/callback-stub.cpp b/zzz_generated/controller-clusters/zap-generated/callback-stub.cpp index 8258822775bbef..5522f84665c1e7 100644 --- a/zzz_generated/controller-clusters/zap-generated/callback-stub.cpp +++ b/zzz_generated/controller-clusters/zap-generated/callback-stub.cpp @@ -98,6 +98,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_FAN_CONTROL_CLUSTER_ID: emberAfFanControlClusterInitCallback(endpoint); break; + case ZCL_FAULT_INJECTION_CLUSTER_ID: + emberAfFaultInjectionClusterInitCallback(endpoint); + break; case ZCL_FIXED_LABEL_CLUSTER_ID: emberAfFixedLabelClusterInitCallback(endpoint); break; @@ -345,6 +348,11 @@ void __attribute__((weak)) emberAfFanControlClusterInitCallback(EndpointId endpo // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfFaultInjectionClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfFixedLabelClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/zzz_generated/controller-clusters/zap-generated/endpoint_config.h b/zzz_generated/controller-clusters/zap-generated/endpoint_config.h index 02e8566c7cd596..730a7fb6a32cf6 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 { \ @@ -798,6 +798,17 @@ .acceptedCommandList = nullptr ,\ .generatedCommandList = nullptr ,\ },\ + { \ + /* Endpoint: 1, Cluster: Fault Injection (client) */ \ + .clusterId = 0xFFF1FC06, \ + .attributes = ZAP_ATTRIBUTE_INDEX(0), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(CLIENT), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ } // clang-format on @@ -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 0653ff31923019..ce1b5279cc45b9 100644 --- a/zzz_generated/controller-clusters/zap-generated/gen_config.h +++ b/zzz_generated/controller-clusters/zap-generated/gen_config.h @@ -94,6 +94,7 @@ #define EMBER_AF_ACCOUNT_LOGIN_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_ELECTRICAL_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_TEST_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_FAULT_INJECTION_CLUSTER_CLIENT_ENDPOINT_COUNT (1) /**** Cluster Plugins ****/ @@ -356,3 +357,7 @@ // Use this macro to check if the client side of the Test Cluster cluster is included #define ZCL_USING_TEST_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_TEST_CLUSTER_CLIENT + +// Use this macro to check if the client side of the Fault Injection cluster is included +#define ZCL_USING_FAULT_INJECTION_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_FAULT_INJECTION_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 fb2dc70021bd18..b29a4a8455674d 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -105,6 +105,7 @@ | AccountLogin | 0x050E | | ElectricalMeasurement | 0x0B04 | | TestCluster | 0xFFF1FC05| +| FaultInjection | 0xFFF1FC06| \*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*\ @@ -93048,6 +93049,406 @@ class SubscribeAttributeTestClusterClusterRevision : public SubscribeAttribute { } }; +/*----------------------------------------------------------------------------*\ +| Cluster FaultInjection | 0xFFF1FC06| +|------------------------------------------------------------------------------| +| Commands: | | +| * FailAtFault | 0x00 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + +/* + * Command FailAtFault + */ +class FaultInjectionFailAtFault : public ClusterCommand { +public: + FaultInjectionFailAtFault() + : ClusterCommand("fail-at-fault") + { + AddArgument("Type", 0, UINT8_MAX, &mRequest.type); + AddArgument("Id", 0, UINT32_MAX, &mRequest.id); + AddArgument("NumCallsToSkip", 0, UINT32_MAX, &mRequest.numCallsToSkip); + AddArgument("NumCallsToFail", 0, UINT32_MAX, &mRequest.numCallsToFail); + AddArgument("TakeMutex", 0, 1, &mRequest.takeMutex); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC06) command (0x00000000) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + MTRBaseClusterFaultInjection * cluster = [[MTRBaseClusterFaultInjection alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + __auto_type * params = [[MTRFaultInjectionClusterFailAtFaultParams alloc] init]; + params.timedInvokeTimeoutMs + = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + params.type = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.type)]; + params.id = [NSNumber numberWithUnsignedInt:mRequest.id]; + params.numCallsToSkip = [NSNumber numberWithUnsignedInt:mRequest.numCallsToSkip]; + params.numCallsToFail = [NSNumber numberWithUnsignedInt:mRequest.numCallsToFail]; + params.takeMutex = [NSNumber numberWithBool:mRequest.takeMutex]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster failAtFaultWithParams:params + completionHandler:^(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::FaultInjection::Commands::FailAtFault::Type mRequest; +}; + +/* + * Attribute GeneratedCommandList + */ +class ReadFaultInjectionGeneratedCommandList : public ReadAttribute { +public: + ReadFaultInjectionGeneratedCommandList() + : ReadAttribute("generated-command-list") + { + } + + ~ReadFaultInjectionGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC06) ReadAttribute (0x0000FFF8) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + MTRBaseClusterFaultInjection * cluster = [[MTRBaseClusterFaultInjection alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"FaultInjection.GeneratedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("FaultInjection GeneratedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeFaultInjectionGeneratedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeFaultInjectionGeneratedCommandList() + : SubscribeAttribute("generated-command-list") + { + } + + ~SubscribeAttributeFaultInjectionGeneratedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC06) ReportAttribute (0x0000FFF8) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + MTRBaseClusterFaultInjection * cluster = [[MTRBaseClusterFaultInjection alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + MTRSubscribeParams * params = [[MTRSubscribeParams alloc] init]; + params.keepPreviousSubscriptions + = mKeepSubscriptions.HasValue() ? [NSNumber numberWithBool:mKeepSubscriptions.Value()] : nil; + params.fabricFiltered = mFabricFiltered.HasValue() ? [NSNumber numberWithBool:mFabricFiltered.Value()] : nil; + [cluster subscribeAttributeGeneratedCommandListWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"FaultInjection.GeneratedCommandList response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute AcceptedCommandList + */ +class ReadFaultInjectionAcceptedCommandList : public ReadAttribute { +public: + ReadFaultInjectionAcceptedCommandList() + : ReadAttribute("accepted-command-list") + { + } + + ~ReadFaultInjectionAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC06) ReadAttribute (0x0000FFF9) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + MTRBaseClusterFaultInjection * cluster = [[MTRBaseClusterFaultInjection alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"FaultInjection.AcceptedCommandList response %@", [value description]); + if (error != nil) { + LogNSError("FaultInjection AcceptedCommandList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeFaultInjectionAcceptedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeFaultInjectionAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") + { + } + + ~SubscribeAttributeFaultInjectionAcceptedCommandList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC06) ReportAttribute (0x0000FFF9) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + MTRBaseClusterFaultInjection * cluster = [[MTRBaseClusterFaultInjection alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + MTRSubscribeParams * params = [[MTRSubscribeParams alloc] init]; + params.keepPreviousSubscriptions + = mKeepSubscriptions.HasValue() ? [NSNumber numberWithBool:mKeepSubscriptions.Value()] : nil; + params.fabricFiltered = mFabricFiltered.HasValue() ? [NSNumber numberWithBool:mFabricFiltered.Value()] : nil; + [cluster subscribeAttributeAcceptedCommandListWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"FaultInjection.AcceptedCommandList response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute AttributeList + */ +class ReadFaultInjectionAttributeList : public ReadAttribute { +public: + ReadFaultInjectionAttributeList() + : ReadAttribute("attribute-list") + { + } + + ~ReadFaultInjectionAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC06) ReadAttribute (0x0000FFFB) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + MTRBaseClusterFaultInjection * cluster = [[MTRBaseClusterFaultInjection alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"FaultInjection.AttributeList response %@", [value description]); + if (error != nil) { + LogNSError("FaultInjection AttributeList read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeFaultInjectionAttributeList : public SubscribeAttribute { +public: + SubscribeAttributeFaultInjectionAttributeList() + : SubscribeAttribute("attribute-list") + { + } + + ~SubscribeAttributeFaultInjectionAttributeList() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC06) ReportAttribute (0x0000FFFB) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + MTRBaseClusterFaultInjection * cluster = [[MTRBaseClusterFaultInjection alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + MTRSubscribeParams * params = [[MTRSubscribeParams alloc] init]; + params.keepPreviousSubscriptions + = mKeepSubscriptions.HasValue() ? [NSNumber numberWithBool:mKeepSubscriptions.Value()] : nil; + params.fabricFiltered = mFabricFiltered.HasValue() ? [NSNumber numberWithBool:mFabricFiltered.Value()] : nil; + [cluster subscribeAttributeAttributeListWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"FaultInjection.AttributeList response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute FeatureMap + */ +class ReadFaultInjectionFeatureMap : public ReadAttribute { +public: + ReadFaultInjectionFeatureMap() + : ReadAttribute("feature-map") + { + } + + ~ReadFaultInjectionFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC06) ReadAttribute (0x0000FFFC) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + MTRBaseClusterFaultInjection * cluster = [[MTRBaseClusterFaultInjection alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"FaultInjection.FeatureMap response %@", [value description]); + if (error != nil) { + LogNSError("FaultInjection FeatureMap read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeFaultInjectionFeatureMap : public SubscribeAttribute { +public: + SubscribeAttributeFaultInjectionFeatureMap() + : SubscribeAttribute("feature-map") + { + } + + ~SubscribeAttributeFaultInjectionFeatureMap() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC06) ReportAttribute (0x0000FFFC) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + MTRBaseClusterFaultInjection * cluster = [[MTRBaseClusterFaultInjection alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + MTRSubscribeParams * params = [[MTRSubscribeParams alloc] init]; + params.keepPreviousSubscriptions + = mKeepSubscriptions.HasValue() ? [NSNumber numberWithBool:mKeepSubscriptions.Value()] : nil; + params.fabricFiltered = mFabricFiltered.HasValue() ? [NSNumber numberWithBool:mFabricFiltered.Value()] : nil; + [cluster subscribeAttributeFeatureMapWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"FaultInjection.FeatureMap response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +/* + * Attribute ClusterRevision + */ +class ReadFaultInjectionClusterRevision : public ReadAttribute { +public: + ReadFaultInjectionClusterRevision() + : ReadAttribute("cluster-revision") + { + } + + ~ReadFaultInjectionClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC06) ReadAttribute (0x0000FFFD) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + MTRBaseClusterFaultInjection * cluster = [[MTRBaseClusterFaultInjection alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"FaultInjection.ClusterRevision response %@", [value description]); + if (error != nil) { + LogNSError("FaultInjection ClusterRevision read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeFaultInjectionClusterRevision : public SubscribeAttribute { +public: + SubscribeAttributeFaultInjectionClusterRevision() + : SubscribeAttribute("cluster-revision") + { + } + + ~SubscribeAttributeFaultInjectionClusterRevision() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC06) ReportAttribute (0x0000FFFD) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + MTRBaseClusterFaultInjection * cluster = [[MTRBaseClusterFaultInjection alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + MTRSubscribeParams * params = [[MTRSubscribeParams alloc] init]; + params.keepPreviousSubscriptions + = mKeepSubscriptions.HasValue() ? [NSNumber numberWithBool:mKeepSubscriptions.Value()] : nil; + params.fabricFiltered = mFabricFiltered.HasValue() ? [NSNumber numberWithBool:mFabricFiltered.Value()] : nil; + [cluster subscribeAttributeClusterRevisionWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"FaultInjection.ClusterRevision response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + /*----------------------------------------------------------------------------*\ | Register all Clusters commands | \*----------------------------------------------------------------------------*/ @@ -96608,6 +97009,32 @@ void registerClusterTestCluster(Commands & commands) commands.Register(clusterName, clusterCommands); } +void registerClusterFaultInjection(Commands & commands) +{ + using namespace chip::app::Clusters::FaultInjection; + + const char * clusterName = "FaultInjection"; + + commands_list clusterCommands = { + make_unique(Id), // + 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(), // + }; + + commands.Register(clusterName, clusterCommands); +} void registerClusterAny(Commands & commands) { @@ -96692,4 +97119,5 @@ void registerClusters(Commands & commands) registerClusterAccountLogin(commands); registerClusterElectricalMeasurement(commands); registerClusterTestCluster(commands); + registerClusterFaultInjection(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 f53567df8ac080..7f5059b72519be 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -93557,7 +93557,7 @@ class TestDescriptorCluster : public TestCommandBridge { { id actualValue = value; - VerifyOrReturn(CheckValue("server list", [actualValue count], static_cast(26))); + VerifyOrReturn(CheckValue("server list", [actualValue count], static_cast(27))); VerifyOrReturn(CheckValue("", actualValue[0], 3UL)); VerifyOrReturn(CheckValue("", actualValue[1], 4UL)); VerifyOrReturn(CheckValue("", actualValue[2], 29UL)); @@ -93584,6 +93584,7 @@ class TestDescriptorCluster : public TestCommandBridge { VerifyOrReturn(CheckValue("", actualValue[23], 64UL)); VerifyOrReturn(CheckValue("", actualValue[24], 65UL)); VerifyOrReturn(CheckValue("", actualValue[25], 1029UL)); + VerifyOrReturn(CheckValue("", actualValue[26], 4294048774UL)); } NextTest();