From c9d21481eafc861969f47416e133d8c977ed54a7 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Thu, 18 Aug 2022 15:51:42 -0700 Subject: [PATCH] Add FailRandomlyAtFault command to Fault Injection cluster (#22008) * Add FailRandomlyAtFault command to Fault Injection cluster * Run codegen * Address review comments --- .../all-clusters-app.matter | 7 ++ .../all-clusters-common/all-clusters-app.zap | 8 ++ .../fault-injection-server.cpp | 82 ++++++++++--- .../chip/fault-injection-cluster.xml | 7 ++ .../python/chip/clusters/Objects.py | 19 +++ .../CHIP/zap-generated/MTRBaseClusters.h | 2 + .../CHIP/zap-generated/MTRBaseClusters.mm | 30 +++++ .../CHIP/zap-generated/MTRClusterConstants.h | 1 + .../CHIP/zap-generated/MTRClusters.h | 4 + .../CHIP/zap-generated/MTRClusters.mm | 35 ++++++ .../zap-generated/MTRCommandPayloadsObjc.h | 26 +++++ .../zap-generated/MTRCommandPayloadsObjc.mm | 35 ++++++ .../zap-generated/IMClusterCommandHandler.cpp | 9 ++ .../all-clusters-app/zap-generated/access.h | 3 + .../zap-generated/endpoint_config.h | 109 +++++++++--------- .../app-common/zap-generated/callback.h | 6 + .../zap-generated/cluster-objects.cpp | 45 ++++++++ .../zap-generated/cluster-objects.h | 43 +++++++ .../app-common/zap-generated/command-id.h | 1 + .../app-common/zap-generated/ids/Commands.h | 4 + .../zap-generated/cluster/Commands.h | 39 ++++++- .../zap-generated/cluster/Commands.h | 52 +++++++++ 22 files changed, 498 insertions(+), 69 deletions(-) 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 ba13b42667e261..18d7c48c099ad3 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 @@ -3850,7 +3850,14 @@ server cluster FaultInjection = 4294048774 { BOOLEAN takeMutex = 4; } + request struct FailRandomlyAtFaultRequest { + FaultType type = 0; + INT32U id = 1; + INT8U percentage = 2; + } + command access(invoke: manage) FailAtFault(FailAtFaultRequest): DefaultSuccess = 0; + command access(invoke: manage) FailRandomlyAtFault(FailRandomlyAtFaultRequest): DefaultSuccess = 1; } endpoint 0 { 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 baefdc4cf4a07c..a77c6e149bdbb6 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 @@ -8461,6 +8461,14 @@ "source": "client", "incoming": 1, "outgoing": 1 + }, + { + "name": "FailRandomlyAtFault", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 } ], "attributes": [ diff --git a/src/app/clusters/fault-injection-server/fault-injection-server.cpp b/src/app/clusters/fault-injection-server/fault-injection-server.cpp index 83e1e678f8e8e2..925640c8ce8d00 100644 --- a/src/app/clusters/fault-injection-server/fault-injection-server.cpp +++ b/src/app/clusters/fault-injection-server/fault-injection-server.cpp @@ -36,21 +36,14 @@ 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; - } +namespace { #if CHIP_WITH_NLFAULTINJECTION - Status returnStatus = Status::Success; +nl::FaultInjection::Manager * GetFaultInjectionManager(FaultType type) +{ nl::FaultInjection::Manager * faultInjectionMgr = nullptr; - switch (commandData.type) + switch (type) { case FaultType::kSystemFault: faultInjectionMgr = &chip::System::FaultInjection::GetManager(); @@ -62,11 +55,29 @@ bool emberAfFaultInjectionClusterFailAtFaultCallback(CommandHandler * commandObj faultInjectionMgr = &chip::FaultInjection::GetManager(); break; default: - ChipLogError(Zcl, "FaultInjection: Unsupported Fault type received"); - returnStatus = Status::InvalidCommand; break; } + return faultInjectionMgr; +} +#endif + +} // anonymous namespace + +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 = GetFaultInjectionManager(commandData.type); + if (faultInjectionMgr != nullptr) { ChipLogProgress(Zcl, "FaultInjection: Configure a fault of type: %d and Id: %d to be triggered deterministically", @@ -93,4 +104,49 @@ bool emberAfFaultInjectionClusterFailAtFaultCallback(CommandHandler * commandObj return true; } +bool emberAfFaultInjectionClusterFailRandomlyAtFaultCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Commands::FailRandomlyAtFault::DecodableType & commandData) +{ + if (commandPath.mClusterId != Clusters::FaultInjection::Id) + { + // We shouldn't have been called at all. + commandObj->AddStatus(commandPath, Status::UnsupportedCluster); + return true; + } + + if (commandData.percentage > 100) + { + commandObj->AddStatus(commandPath, Status::InvalidCommand); + return true; + } + +#if CHIP_WITH_NLFAULTINJECTION + Status returnStatus = Status::Success; + nl::FaultInjection::Manager * faultInjectionMgr = GetFaultInjectionManager(commandData.type); + + if (faultInjectionMgr != nullptr) + { + ChipLogProgress(Zcl, "FaultInjection: Configure a fault of type: %d and Id: %d to be triggered randomly", + static_cast(commandData.type), commandData.id); + int32_t err = faultInjectionMgr->FailRandomlyAtFault(commandData.id, commandData.percentage); + + 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/zap-templates/zcl/data-model/chip/fault-injection-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/fault-injection-cluster.xml index f8c764d8e139c6..e4e92aee68ea0c 100644 --- 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 @@ -39,5 +39,12 @@ limitations under the License. + + Configure a fault to be triggered randomly, with a given probability defined as a percentage + + + + + diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 4397258fed9dcb..d8032d8f508063 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -29040,6 +29040,25 @@ def descriptor(cls) -> ClusterObjectDescriptor: numCallsToFail: 'uint' = 0 takeMutex: 'bool' = False + @dataclass + class FailRandomlyAtFault(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0xFFF1FC06 + command_id: typing.ClassVar[int] = 0x0001 + 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="percentage", Tag=2, Type=uint), + ]) + + type: 'FaultInjection.Enums.FaultType' = 0 + id: 'uint' = 0 + percentage: 'uint' = 0 + class Attributes: @dataclass diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 43e1ddc4bf0516..201b0844d66305 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -21998,6 +21998,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)failAtFaultWithParams:(MTRFaultInjectionClusterFailAtFaultParams *)params completionHandler:(StatusCompletion)completionHandler; +- (void)failRandomlyAtFaultWithParams:(MTRFaultInjectionClusterFailRandomlyAtFaultParams *)params + completionHandler:(StatusCompletion)completionHandler; - (void)readAttributeGeneratedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index e043a252d51acc..1d1c90e8e4359c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -93615,6 +93615,36 @@ new MTRCommandSuccessCallbackBridge( }); } +- (void)failRandomlyAtFaultWithParams:(MTRFaultInjectionClusterFailRandomlyAtFaultParams *)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::FailRandomlyAtFault::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.percentage = params.percentage.unsignedCharValue; + + 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 { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index dbcc34b4f7e45f..869f034e3b2b92 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -1702,6 +1702,7 @@ typedef NS_ENUM(uint32_t, MTRClusterCommandIDType) { // Cluster FaultInjection commands MTRClusterFaultInjectionCommandFailAtFaultID = 0x00000000, + MTRClusterFaultInjectionCommandFailRandomlyAtFaultID = 0x00000001, }; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 38664c17e71687..bd815031aa0bc2 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -5297,6 +5297,10 @@ NS_ASSUME_NONNULL_BEGIN expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completionHandler:(StatusCompletion)completionHandler; +- (void)failRandomlyAtFaultWithParams:(MTRFaultInjectionClusterFailRandomlyAtFaultParams *)params + expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries + expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs + completionHandler:(StatusCompletion)completionHandler; - (NSDictionary *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 26f39666023990..32d77c731b7dc3 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -22088,6 +22088,41 @@ new MTRCommandSuccessCallbackBridge( [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; } +- (void)failRandomlyAtFaultWithParams:(MTRFaultInjectionClusterFailRandomlyAtFaultParams *)params + expectedValues:(NSArray *> *)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::FailRandomlyAtFault::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.percentage = params.percentage.unsignedCharValue; + + 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) diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index bfdc4a5aecdfb3..bdd49c7c83214c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -6075,6 +6075,32 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; +- (instancetype)init; +- (id)copyWithZone:(nullable NSZone *)zone; +@end +@interface MTRFaultInjectionClusterFailRandomlyAtFaultParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull type; + +@property (nonatomic, copy) NSNumber * _Nonnull id; + +@property (nonatomic, copy) NSNumber * _Nonnull percentage; +/** + * 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 004f2f29070299..9ea1ae5cf02d39 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -8157,6 +8157,41 @@ - (NSString *)description return descriptionString; } +@end +@implementation MTRFaultInjectionClusterFailRandomlyAtFaultParams +- (instancetype)init +{ + if (self = [super init]) { + + _type = @(0); + + _id = @(0); + + _percentage = @(0); + _timedInvokeTimeoutMs = nil; + } + return self; +} + +- (id)copyWithZone:(nullable NSZone *)zone; +{ + auto other = [[MTRFaultInjectionClusterFailRandomlyAtFaultParams alloc] init]; + + other.type = self.type; + other.id = self.id; + other.percentage = self.percentage; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString + stringWithFormat:@"<%@: type:%@; id:%@; percentage:%@; >", NSStringFromClass([self class]), _type, _id, _percentage]; + return descriptionString; +} + @end NS_ASSUME_NONNULL_END diff --git a/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp index 411c19ff34c510..5d65d8f8775339 100644 --- a/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp @@ -591,6 +591,15 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } break; } + case Commands::FailRandomlyAtFault::Id: { + Commands::FailRandomlyAtFault::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfFaultInjectionClusterFailRandomlyAtFaultCallback(apCommandObj, aCommandPath, commandData); + } + break; + } default: { // Unrecognized command ID, error status will apply. apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); diff --git a/zzz_generated/all-clusters-app/zap-generated/access.h b/zzz_generated/all-clusters-app/zap-generated/access.h index 5c5f1df7633748..5c6aba484890ac 100644 --- a/zzz_generated/all-clusters-app/zap-generated/access.h +++ b/zzz_generated/all-clusters-app/zap-generated/access.h @@ -431,6 +431,7 @@ 257, /* Cluster: Door Lock, Command: GetCredentialStatus, Privilege: administer */ \ 257, /* Cluster: Door Lock, Command: ClearCredential, Privilege: administer */ \ 4294048774, /* Cluster: Fault Injection, Command: FailAtFault, Privilege: manage */ \ + 4294048774, /* Cluster: Fault Injection, Command: FailRandomlyAtFault, Privilege: manage */ \ } // Parallel array data (cluster, *command*, privilege) for invoke command @@ -482,6 +483,7 @@ 36, /* Cluster: Door Lock, Command: GetCredentialStatus, Privilege: administer */ \ 38, /* Cluster: Door Lock, Command: ClearCredential, Privilege: administer */ \ 0, /* Cluster: Fault Injection, Command: FailAtFault, Privilege: manage */ \ + 1, /* Cluster: Fault Injection, Command: FailRandomlyAtFault, Privilege: manage */ \ } // Parallel array data (cluster, command, *privilege*) for invoke command @@ -533,6 +535,7 @@ kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: GetCredentialStatus, Privilege: administer */ \ kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: ClearCredential, Privilege: administer */ \ kMatterAccessPrivilegeManage, /* Cluster: Fault Injection, Command: FailAtFault, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Fault Injection, Command: FailRandomlyAtFault, Privilege: manage */ \ } //////////////////////////////////////////////////////////////////////////////// diff --git a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h index 2ec296db48ed69..64446dd4aec170 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -1675,14 +1675,15 @@ /* Endpoint: 0, Cluster: Fault Injection (server) */\ /* AcceptedCommandList (index=76) */ \ 0x00000000 /* FailAtFault */, \ + 0x00000001 /* FailRandomlyAtFault */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Identify (server) */\ - /* AcceptedCommandList (index=78) */ \ + /* AcceptedCommandList (index=79) */ \ 0x00000000 /* Identify */, \ 0x00000040 /* TriggerEffect */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Groups (server) */\ - /* AcceptedCommandList (index=81) */ \ + /* AcceptedCommandList (index=82) */ \ 0x00000000 /* AddGroup */, \ 0x00000001 /* ViewGroup */, \ 0x00000002 /* GetGroupMembership */, \ @@ -1690,14 +1691,14 @@ 0x00000004 /* RemoveAllGroups */, \ 0x00000005 /* AddGroupIfIdentifying */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=88)*/ \ + /* GeneratedCommandList (index=89)*/ \ 0x00000000 /* AddGroupResponse */, \ 0x00000001 /* ViewGroupResponse */, \ 0x00000002 /* GetGroupMembershipResponse */, \ 0x00000003 /* RemoveGroupResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Scenes (server) */\ - /* AcceptedCommandList (index=93) */ \ + /* AcceptedCommandList (index=94) */ \ 0x00000000 /* AddScene */, \ 0x00000001 /* ViewScene */, \ 0x00000002 /* RemoveScene */, \ @@ -1706,7 +1707,7 @@ 0x00000005 /* RecallScene */, \ 0x00000006 /* GetSceneMembership */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=101)*/ \ + /* GeneratedCommandList (index=102)*/ \ 0x00000000 /* AddSceneResponse */, \ 0x00000001 /* ViewSceneResponse */, \ 0x00000002 /* RemoveSceneResponse */, \ @@ -1715,7 +1716,7 @@ 0x00000006 /* GetSceneMembershipResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: On/Off (server) */\ - /* AcceptedCommandList (index=108) */ \ + /* AcceptedCommandList (index=109) */ \ 0x00000000 /* Off */, \ 0x00000001 /* On */, \ 0x00000002 /* Toggle */, \ @@ -1724,7 +1725,7 @@ 0x00000042 /* OnWithTimedOff */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Level Control (server) */\ - /* AcceptedCommandList (index=115) */ \ + /* AcceptedCommandList (index=116) */ \ 0x00000000 /* MoveToLevel */, \ 0x00000001 /* Move */, \ 0x00000002 /* Step */, \ @@ -1735,11 +1736,11 @@ 0x00000007 /* StopWithOnOff */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Mode Select (server) */\ - /* AcceptedCommandList (index=124) */ \ + /* AcceptedCommandList (index=125) */ \ 0x00000000 /* ChangeToMode */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Door Lock (server) */\ - /* AcceptedCommandList (index=126) */ \ + /* AcceptedCommandList (index=127) */ \ 0x00000000 /* LockDoor */, \ 0x00000001 /* UnlockDoor */, \ 0x00000003 /* UnlockWithTimeout */, \ @@ -1755,7 +1756,7 @@ 0x00000024 /* GetCredentialStatus */, \ 0x00000026 /* ClearCredential */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=141)*/ \ + /* GeneratedCommandList (index=142)*/ \ 0x0000000C /* GetWeekDayScheduleResponse */, \ 0x0000000F /* GetYearDayScheduleResponse */, \ 0x0000001C /* GetUserResponse */, \ @@ -1763,7 +1764,7 @@ 0x00000025 /* GetCredentialStatusResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Window Covering (server) */\ - /* AcceptedCommandList (index=147) */ \ + /* AcceptedCommandList (index=148) */ \ 0x00000000 /* UpOrOpen */, \ 0x00000001 /* DownOrClose */, \ 0x00000002 /* StopMotion */, \ @@ -1773,16 +1774,16 @@ 0x00000008 /* GoToTiltPercentage */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Barrier Control (server) */\ - /* AcceptedCommandList (index=155) */ \ + /* AcceptedCommandList (index=156) */ \ 0x00000000 /* BarrierControlGoToPercent */, \ 0x00000001 /* BarrierControlStop */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Thermostat (server) */\ - /* AcceptedCommandList (index=158) */ \ + /* AcceptedCommandList (index=159) */ \ 0x00000000 /* SetpointRaiseLower */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Color Control (server) */\ - /* AcceptedCommandList (index=160) */ \ + /* AcceptedCommandList (index=161) */ \ 0x00000000 /* MoveToHue */, \ 0x00000001 /* MoveHue */, \ 0x00000002 /* StepHue */, \ @@ -1804,32 +1805,32 @@ 0x0000004C /* StepColorTemperature */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Target Navigator (server) */\ - /* AcceptedCommandList (index=180) */ \ + /* AcceptedCommandList (index=181) */ \ 0x00000000 /* NavigateTarget */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=182)*/ \ + /* GeneratedCommandList (index=183)*/ \ 0x00000001 /* NavigateTargetResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Media Input (server) */\ - /* AcceptedCommandList (index=184) */ \ + /* AcceptedCommandList (index=185) */ \ 0x00000000 /* SelectInput */, \ 0x00000001 /* ShowInputStatus */, \ 0x00000002 /* HideInputStatus */, \ 0x00000003 /* RenameInput */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Low Power (server) */\ - /* AcceptedCommandList (index=189) */ \ + /* AcceptedCommandList (index=190) */ \ 0x00000000 /* Sleep */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Keypad Input (server) */\ - /* AcceptedCommandList (index=191) */ \ + /* AcceptedCommandList (index=192) */ \ 0x00000000 /* SendKey */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=193)*/ \ + /* GeneratedCommandList (index=194)*/ \ 0x00000001 /* SendKeyResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Test Cluster (server) */\ - /* AcceptedCommandList (index=195) */ \ + /* AcceptedCommandList (index=196) */ \ 0x00000000 /* Test */, \ 0x00000001 /* TestNotHandled */, \ 0x00000002 /* TestSpecific */, \ @@ -1849,7 +1850,7 @@ 0x00000014 /* TestEmitTestEventRequest */, \ 0x00000015 /* TestEmitTestFabricScopedEventRequest */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=214)*/ \ + /* GeneratedCommandList (index=215)*/ \ 0x00000000 /* TestSpecificResponse */, \ 0x00000001 /* TestAddArgumentsResponse */, \ 0x00000004 /* TestListInt8UReverseResponse */, \ @@ -1861,7 +1862,7 @@ 0x0000000B /* TestEmitTestFabricScopedEventResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 2, Cluster: Groups (server) */\ - /* AcceptedCommandList (index=224) */ \ + /* AcceptedCommandList (index=225) */ \ 0x00000000 /* AddGroup */, \ 0x00000001 /* ViewGroup */, \ 0x00000002 /* GetGroupMembership */, \ @@ -1869,20 +1870,20 @@ 0x00000004 /* RemoveAllGroups */, \ 0x00000005 /* AddGroupIfIdentifying */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=231)*/ \ + /* GeneratedCommandList (index=232)*/ \ 0x00000000 /* AddGroupResponse */, \ 0x00000001 /* ViewGroupResponse */, \ 0x00000002 /* GetGroupMembershipResponse */, \ 0x00000003 /* RemoveGroupResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 2, Cluster: On/Off (server) */\ - /* AcceptedCommandList (index=236) */ \ + /* AcceptedCommandList (index=237) */ \ 0x00000000 /* Off */, \ 0x00000001 /* On */, \ 0x00000002 /* Toggle */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 65534, Cluster: Network Commissioning (server) */\ - /* AcceptedCommandList (index=240) */ \ + /* AcceptedCommandList (index=241) */ \ 0x00000000 /* ScanNetworks */, \ 0x00000002 /* AddOrUpdateWiFiNetwork */, \ 0x00000003 /* AddOrUpdateThreadNetwork */, \ @@ -1890,7 +1891,7 @@ 0x00000006 /* ConnectNetwork */, \ 0x00000008 /* ReorderNetwork */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=247)*/ \ + /* GeneratedCommandList (index=248)*/ \ 0x00000001 /* ScanNetworksResponse */, \ 0x00000005 /* NetworkConfigResponse */, \ 0x00000007 /* ConnectNetworkResponse */, \ @@ -2220,7 +2221,7 @@ .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( 78 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 79 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ @@ -2231,8 +2232,8 @@ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayGroupsServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 81 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 88 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 82 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 89 ) ,\ },\ { \ /* Endpoint: 1, Cluster: Scenes (server) */ \ @@ -2242,8 +2243,8 @@ .clusterSize = 12, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayScenesServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 93 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 101 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 94 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 102 ) ,\ },\ { \ /* Endpoint: 1, Cluster: On/Off (server) */ \ @@ -2253,7 +2254,7 @@ .clusterSize = 13, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayOnOffServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 108 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 109 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ @@ -2275,7 +2276,7 @@ .clusterSize = 27, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayLevelControlServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 115 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 116 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ @@ -2385,7 +2386,7 @@ .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( 124 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 125 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ @@ -2396,8 +2397,8 @@ .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( 126 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 141 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 127 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 142 ) ,\ },\ { \ /* Endpoint: 1, Cluster: Window Covering (server) */ \ @@ -2407,7 +2408,7 @@ .clusterSize = 43, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayWindowCoveringServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 147 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 148 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ @@ -2418,7 +2419,7 @@ .clusterSize = 11, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 155 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 156 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ @@ -2440,7 +2441,7 @@ .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( 158 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 159 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ @@ -2473,7 +2474,7 @@ .clusterSize = 345, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayColorControlServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 160 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 161 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ @@ -2572,8 +2573,8 @@ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 180 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 182 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 181 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 183 ) ,\ },\ { \ /* Endpoint: 1, Cluster: Media Playback (server) */ \ @@ -2594,7 +2595,7 @@ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 184 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 185 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ @@ -2605,7 +2606,7 @@ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 189 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 190 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ @@ -2616,8 +2617,8 @@ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 191 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 193 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 192 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 194 ) ,\ },\ { \ /* Endpoint: 1, Cluster: Content Launcher (server) */ \ @@ -2693,8 +2694,8 @@ .clusterSize = 2289, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 195 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 214 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 196 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 215 ) ,\ },\ { \ /* Endpoint: 2, Cluster: Groups (server) */ \ @@ -2704,8 +2705,8 @@ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayGroupsServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 224 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 231 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 225 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 232 ) ,\ },\ { \ /* Endpoint: 2, Cluster: On/Off (server) */ \ @@ -2715,7 +2716,7 @@ .clusterSize = 13, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayOnOffServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 236 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 237 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ @@ -2759,8 +2760,8 @@ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 240 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 247 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 241 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 248 ) ,\ },\ } 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 26c16148347095..8a674cd17d6c30 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -8919,6 +8919,12 @@ bool emberAfTestClusterClusterTestEmitTestFabricScopedEventRequestCallback( bool emberAfFaultInjectionClusterFailAtFaultCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::FaultInjection::Commands::FailAtFault::DecodableType & commandData); +/** + * @brief Fault Injection Cluster FailRandomlyAtFault Command callback (from client) + */ +bool emberAfFaultInjectionClusterFailRandomlyAtFaultCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::FaultInjection::Commands::FailRandomlyAtFault::DecodableType & commandData); /** @brief Add To Current App Tasks * 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 ec0eb5147c7f97..1c0bf9098cda3e 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 @@ -20939,6 +20939,51 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) return CHIP_NO_ERROR; } } // namespace FailAtFault. +namespace FailRandomlyAtFault { +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::kPercentage)), percentage)); + 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::kPercentage): + ReturnErrorOnFailure(DataModel::Decode(reader, percentage)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace FailRandomlyAtFault. } // namespace Commands namespace Attributes { 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 17019d9d8b12a5..5500c0d3c8ce28 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 @@ -28095,6 +28095,11 @@ struct Type; struct DecodableType; } // namespace FailAtFault +namespace FailRandomlyAtFault { +struct Type; +struct DecodableType; +} // namespace FailRandomlyAtFault + } // namespace Commands namespace Commands { @@ -28142,6 +28147,44 @@ struct DecodableType CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace FailAtFault +namespace FailRandomlyAtFault { +enum class Fields +{ + kType = 0, + kId = 1, + kPercentage = 2, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::FailRandomlyAtFault::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::FaultInjection::Id; } + + FaultType type = static_cast(0); + uint32_t id = static_cast(0); + uint8_t percentage = 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::FailRandomlyAtFault::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::FaultInjection::Id; } + + FaultType type = static_cast(0); + uint32_t id = static_cast(0); + uint8_t percentage = static_cast(0); + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace FailRandomlyAtFault } // namespace Commands namespace Attributes { 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 95b03a5e717fa4..9dea02553be7cb 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 @@ -355,3 +355,4 @@ // Commands for cluster: Fault Injection #define ZCL_FAIL_AT_FAULT_COMMAND_ID (0x00) +#define ZCL_FAIL_RANDOMLY_AT_FAULT_COMMAND_ID (0x01) 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 cf911dedc35e02..41c5ed62ddb1f0 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 @@ -1240,6 +1240,10 @@ namespace FailAtFault { static constexpr CommandId Id = 0x00000000; } // namespace FailAtFault +namespace FailRandomlyAtFault { +static constexpr CommandId Id = 0x00000001; +} // namespace FailRandomlyAtFault + } // namespace Commands } // namespace FaultInjection diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 5c25721dfc3bdd..897d45dff7d486 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -8149,6 +8149,7 @@ class TestClusterTestEmitTestFabricScopedEventRequest : public ClusterCommand |------------------------------------------------------------------------------| | Commands: | | | * FailAtFault | 0x00 | +| * FailRandomlyAtFault | 0x01 | |------------------------------------------------------------------------------| | Attributes: | | | * GeneratedCommandList | 0xFFF8 | @@ -8194,6 +8195,39 @@ class FaultInjectionFailAtFault : public ClusterCommand chip::app::Clusters::FaultInjection::Commands::FailAtFault::Type mRequest; }; +/* + * Command FailRandomlyAtFault + */ +class FaultInjectionFailRandomlyAtFault : public ClusterCommand +{ +public: + FaultInjectionFailRandomlyAtFault(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("fail-randomly-at-fault", credsIssuerConfig) + { + AddArgument("Type", 0, UINT8_MAX, &mRequest.type); + AddArgument("Id", 0, UINT32_MAX, &mRequest.id); + AddArgument("Percentage", 0, UINT8_MAX, &mRequest.percentage); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC06) command (0x00000001) on endpoint %u", endpointIds.at(0)); + + return ClusterCommand::SendCommand(device, endpointIds.at(0), 0xFFF1FC06, 0x00000001, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC06) command (0x00000001) on Group %u", groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, 0xFFF1FC06, 0x00000001, mRequest); + } + +private: + chip::app::Clusters::FaultInjection::Commands::FailRandomlyAtFault::Type mRequest; +}; + /*----------------------------------------------------------------------------*\ | Register all Clusters commands | \*----------------------------------------------------------------------------*/ @@ -13266,8 +13300,9 @@ void registerClusterFaultInjection(Commands & commands, CredentialIssuerCommands // // Commands // - make_unique(Id, credsIssuerConfig), // - make_unique(credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // // // Attributes // 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 b29a4a8455674d..59a1a11c980eb2 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -93054,6 +93054,7 @@ class SubscribeAttributeTestClusterClusterRevision : public SubscribeAttribute { |------------------------------------------------------------------------------| | Commands: | | | * FailAtFault | 0x00 | +| * FailRandomlyAtFault | 0x01 | |------------------------------------------------------------------------------| | Attributes: | | | * GeneratedCommandList | 0xFFF8 | @@ -93119,6 +93120,56 @@ class FaultInjectionFailAtFault : public ClusterCommand { chip::app::Clusters::FaultInjection::Commands::FailAtFault::Type mRequest; }; +/* + * Command FailRandomlyAtFault + */ +class FaultInjectionFailRandomlyAtFault : public ClusterCommand { +public: + FaultInjectionFailRandomlyAtFault() + : ClusterCommand("fail-randomly-at-fault") + { + AddArgument("Type", 0, UINT8_MAX, &mRequest.type); + AddArgument("Id", 0, UINT32_MAX, &mRequest.id); + AddArgument("Percentage", 0, UINT8_MAX, &mRequest.percentage); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0xFFF1FC06) command (0x00000001) 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 = [[MTRFaultInjectionClusterFailRandomlyAtFaultParams 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.percentage = [NSNumber numberWithUnsignedChar:mRequest.percentage]; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster failRandomlyAtFaultWithParams: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::FailRandomlyAtFault::Type mRequest; +}; + /* * Attribute GeneratedCommandList */ @@ -97018,6 +97069,7 @@ void registerClusterFaultInjection(Commands & commands) commands_list clusterCommands = { make_unique(Id), // make_unique(), // + make_unique(), // make_unique(Id), // make_unique(), // make_unique(Id), //