diff --git a/src/darwin/Framework/CHIP/MTRBaseDevice.mm b/src/darwin/Framework/CHIP/MTRBaseDevice.mm index 9026e91aacfc71..ac9b0f9e3ad056 100644 --- a/src/darwin/Framework/CHIP/MTRBaseDevice.mm +++ b/src/darwin/Framework/CHIP/MTRBaseDevice.mm @@ -475,7 +475,7 @@ - (void)subscribeWithQueue:(dispatch_queue_t)queue } // Convert TLV data into data-value dictionary as described in MTRDeviceResponseHandler -id _Nullable MTRDecodeDataValueDictionaryFromCHIPTLV(chip::TLV::TLVReader * data) +NSDictionary * _Nullable MTRDecodeDataValueDictionaryFromCHIPTLV(chip::TLV::TLVReader * data) { chip::TLV::TLVType dataTLVType = data->GetType(); switch (dataTLVType) { @@ -1208,6 +1208,28 @@ - (void)invokeCommandWithEndpointID:(NSNumber *)endpointID timedInvokeTimeout:(NSNumber * _Nullable)timeoutMs queue:(dispatch_queue_t)queue completion:(MTRDeviceResponseHandler)completion +{ + // We don't have a way to communicate a non-default invoke timeout + // here for now. + // TODO: https://github.com/project-chip/connectedhomeip/issues/24563 + [self _invokeCommandWithEndpointID:endpointID + clusterID:clusterID + commandID:commandID + commandFields:commandFields + timedInvokeTimeout:timeoutMs + serverSideProcessingTimeout:nil + queue:queue + completion:completion]; +} + +- (void)_invokeCommandWithEndpointID:(NSNumber *)endpointID + clusterID:(NSNumber *)clusterID + commandID:(NSNumber *)commandID + commandFields:(id)commandFields + timedInvokeTimeout:(NSNumber * _Nullable)timeoutMs + serverSideProcessingTimeout:(NSNumber * _Nullable)serverSideProcessingTimeout + queue:(dispatch_queue_t)queue + completion:(MTRDeviceResponseHandler)completion { endpointID = (endpointID == nil) ? nil : [endpointID copy]; clusterID = (clusterID == nil) ? nil : [clusterID copy]; @@ -1215,7 +1237,16 @@ - (void)invokeCommandWithEndpointID:(NSNumber *)endpointID // TODO: This is not going to deep-copy the NSArray instances in // commandFields. We need to do something smarter here. commandFields = (commandFields == nil) ? nil : [commandFields copy]; - timeoutMs = (timeoutMs == nil) ? nil : [timeoutMs copy]; + + serverSideProcessingTimeout = [serverSideProcessingTimeout copy]; + if (serverSideProcessingTimeout != nil) { + serverSideProcessingTimeout = MTRClampedNumber(serverSideProcessingTimeout, @(0), @(UINT16_MAX)); + } + + timeoutMs = [timeoutMs copy]; + if (timeoutMs != nil) { + timeoutMs = MTRClampedNumber(timeoutMs, @(1), @(UINT16_MAX)); + } auto * bridge = new MTRDataValueDictionaryCallbackBridge(queue, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, MTRDataValueDictionaryCallback successCb, @@ -1261,10 +1292,14 @@ - (void)invokeCommandWithEndpointID:(NSNumber *)endpointID ReturnErrorOnFailure(commandSender->AddRequestData(commandPath, MTRDataValueDictionaryDecodableType(commandFields), (timeoutMs == nil) ? NullOptional : Optional([timeoutMs unsignedShortValue]))); - // We don't have a way to communicate a non-default invoke timeout - // here for now. - // TODO: https://github.com/project-chip/connectedhomeip/issues/24563 - ReturnErrorOnFailure(commandSender->SendCommandRequest(session, NullOptional)); + Optional invokeTimeout; + if (serverSideProcessingTimeout != nil) { + // Clamp to a number of seconds that will not overflow 32-bit + // int when converted to ms. + auto serverTimeoutInSeconds = System::Clock::Seconds16(serverSideProcessingTimeout.unsignedShortValue); + invokeTimeout.SetValue(session->ComputeRoundTripTimeout(serverTimeoutInSeconds)); + } + ReturnErrorOnFailure(commandSender->SendCommandRequest(session, invokeTimeout)); decoder.release(); commandSender.release(); diff --git a/src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h b/src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h index 4853d60be88471..4033ff77ef12b3 100644 --- a/src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h +++ b/src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h @@ -97,6 +97,20 @@ static inline MTRTransportType MTRMakeTransportType(chip::Transport::Type type) clusterID:(chip::ClusterId)clusterID commandID:(chip::CommandId)commandID error:(NSError * __autoreleasing *)error; + +/** + * Like the public invokeCommandWithEndpointID but allows passing through a + * serverSideProcessingTimeout. + */ +- (void)_invokeCommandWithEndpointID:(NSNumber *)endpointID + clusterID:(NSNumber *)clusterID + commandID:(NSNumber *)commandID + commandFields:(id)commandFields + timedInvokeTimeout:(NSNumber * _Nullable)timeoutMs + serverSideProcessingTimeout:(NSNumber * _Nullable)serverSideProcessingTimeout + queue:(dispatch_queue_t)queue + completion:(MTRDeviceResponseHandler)completion; + @end @interface MTRClusterPath () @@ -140,6 +154,6 @@ static inline MTRTransportType MTRMakeTransportType(chip::Transport::Type type) // Exported utility function // Convert TLV data into data-value dictionary as described in MTRDeviceResponseHandler -id _Nullable MTRDecodeDataValueDictionaryFromCHIPTLV(chip::TLV::TLVReader * data); +NSDictionary * _Nullable MTRDecodeDataValueDictionaryFromCHIPTLV(chip::TLV::TLVReader * data); NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/MTRCluster.mm b/src/darwin/Framework/CHIP/MTRCluster.mm index dae2acc9d57f62..55c36ec04dbd72 100644 --- a/src/darwin/Framework/CHIP/MTRCluster.mm +++ b/src/darwin/Framework/CHIP/MTRCluster.mm @@ -34,15 +34,6 @@ - (instancetype)initWithEndpointID:(NSNumber *)endpointID queue:(dispatch_queue_ return self; } -- (chip::ByteSpan)asByteSpan:(NSData *)value -{ - return AsByteSpan(value); -} - -- (chip::CharSpan)asCharSpan:(NSString *)value -{ - return AsCharSpan(value); -} @end @implementation MTRWriteParams diff --git a/src/darwin/Framework/CHIP/MTRCluster_Internal.h b/src/darwin/Framework/CHIP/MTRCluster_Internal.h index f3fd0f2722e323..fa9ad17586027f 100644 --- a/src/darwin/Framework/CHIP/MTRCluster_Internal.h +++ b/src/darwin/Framework/CHIP/MTRCluster_Internal.h @@ -33,8 +33,6 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly) chip::EndpointId endpoint; - (instancetype)initWithEndpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue; -- (chip::ByteSpan)asByteSpan:(NSData *)value; -- (chip::CharSpan)asCharSpan:(NSString *)value; @end @interface MTRReadParams () diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index 2ed4a67c4e6bd7..28874a560b287f 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -29,6 +29,7 @@ #import "MTRError_Internal.h" #import "MTREventTLVValueDecoder_Internal.h" #import "MTRLogging_Internal.h" +#import "zap-generated/MTRCommandPayloads_Internal.h" #include "lib/core/CHIPError.h" #include "lib/core/DataModelTypes.h" @@ -1056,17 +1057,44 @@ - (void)invokeCommandWithEndpointID:(NSNumber *)endpointID timedInvokeTimeout:(NSNumber * _Nullable)timeout queue:(dispatch_queue_t)queue completion:(MTRDeviceResponseHandler)completion +{ + // We don't have a way to communicate a non-default invoke timeout + // here for now. + // TODO: https://github.com/project-chip/connectedhomeip/issues/24563 + + [self _invokeCommandWithEndpointID:endpointID + clusterID:clusterID + commandID:commandID + commandFields:commandFields + expectedValues:expectedValues + expectedValueInterval:expectedValueInterval + timedInvokeTimeout:timeout + serverSideProcessingTimeout:nil + queue:queue + completion:completion]; +} + +- (void)_invokeCommandWithEndpointID:(NSNumber *)endpointID + clusterID:(NSNumber *)clusterID + commandID:(NSNumber *)commandID + commandFields:(id)commandFields + expectedValues:(NSArray *> * _Nullable)expectedValues + expectedValueInterval:(NSNumber * _Nullable)expectedValueInterval + timedInvokeTimeout:(NSNumber * _Nullable)timeout + serverSideProcessingTimeout:(NSNumber * _Nullable)serverSideProcessingTimeout + queue:(dispatch_queue_t)queue + completion:(MTRDeviceResponseHandler)completion { NSString * logPrefix = [NSString stringWithFormat:@"%@ command %@ %@ %@", self, endpointID, clusterID, commandID]; - if (timeout) { - timeout = MTRClampedNumber(timeout, @(1), @(UINT16_MAX)); - } if (!expectedValueInterval || ([expectedValueInterval compare:@(0)] == NSOrderedAscending)) { expectedValues = nil; } else { expectedValueInterval = MTRClampedNumber(expectedValueInterval, @(1), @(UINT32_MAX)); } + serverSideProcessingTimeout = [serverSideProcessingTimeout copy]; + timeout = [timeout copy]; + uint64_t expectedValueID = 0; NSMutableArray * attributePaths = nil; if (expectedValues) { @@ -1087,30 +1115,83 @@ - (void)invokeCommandWithEndpointID:(NSNumber *)endpointID MTR_LOG_DEFAULT("%@ dequeueWorkItem %@", logPrefix, self->_asyncWorkQueue); MTRBaseDevice * baseDevice = [self newBaseDevice]; [baseDevice - invokeCommandWithEndpointID:endpointID - clusterID:clusterID - commandID:commandID - commandFields:commandFields - timedInvokeTimeout:timeout - queue:self.queue - completion:^(NSArray *> * _Nullable values, NSError * _Nullable error) { - // Log the data at the INFO level (not usually persisted permanently), - // but make sure we log the work completion at the DEFAULT level. - MTR_LOG_INFO("%@ received response: %@ error: %@", logPrefix, values, error); - dispatch_async(queue, ^{ - completion(values, error); - }); - if (error && expectedValues) { - [self removeExpectedValuesForAttributePaths:attributePaths expectedValueID:expectedValueID]; - } - MTR_LOG_DEFAULT("%@ endWork", logPrefix); - workCompletion(MTRAsyncWorkComplete); - }]; + _invokeCommandWithEndpointID:endpointID + clusterID:clusterID + commandID:commandID + commandFields:commandFields + timedInvokeTimeout:timeout + serverSideProcessingTimeout:serverSideProcessingTimeout + queue:self.queue + completion:^(NSArray *> * _Nullable values, NSError * _Nullable error) { + // Log the data at the INFO level (not usually persisted permanently), + // but make sure we log the work completion at the DEFAULT level. + MTR_LOG_INFO("%@ received response: %@ error: %@", logPrefix, values, error); + dispatch_async(queue, ^{ + completion(values, error); + }); + if (error && expectedValues) { + [self removeExpectedValuesForAttributePaths:attributePaths expectedValueID:expectedValueID]; + } + MTR_LOG_DEFAULT("%@ endWork", logPrefix); + workCompletion(MTRAsyncWorkComplete); + }]; }]; MTR_LOG_DEFAULT("%@ enqueueWorkItem %@", logPrefix, _asyncWorkQueue); [_asyncWorkQueue enqueueWorkItem:workItem]; } +- (void)_invokeKnownCommandWithEndpointID:(NSNumber *)endpointID + clusterID:(NSNumber *)clusterID + commandID:(NSNumber *)commandID + commandPayload:(id)commandPayload + expectedValues:(NSArray *> * _Nullable)expectedValues + expectedValueInterval:(NSNumber * _Nullable)expectedValueInterval + timedInvokeTimeout:(NSNumber * _Nullable)timeout + serverSideProcessingTimeout:(NSNumber * _Nullable)serverSideProcessingTimeout + responseClass:(Class _Nullable)responseClass + queue:(dispatch_queue_t)queue + completion:(void (^)(id _Nullable response, NSError * _Nullable error))completion +{ + if (![commandPayload respondsToSelector:@selector(_encodeAsDataValue:)]) { + dispatch_async(queue, ^{ + completion(nil, [MTRError errorForCHIPErrorCode:CHIP_ERROR_INVALID_ARGUMENT]); + }); + return; + } + + NSError * encodingError; + auto * commandFields = [commandPayload _encodeAsDataValue:&encodingError]; + if (commandFields == nil) { + dispatch_async(queue, ^{ + completion(nil, encodingError); + }); + return; + } + + auto responseHandler = ^(NSArray *> * _Nullable values, NSError * _Nullable error) { + id _Nullable response = nil; + if (error == nil) { + if (values.count != 1) { + error = [NSError errorWithDomain:MTRErrorDomain code:MTRErrorCodeSchemaMismatch userInfo:nil]; + } else if (responseClass != nil) { + response = [[responseClass alloc] initWithResponseValue:values[0] error:&error]; + } + } + completion(response, error); + }; + + [self _invokeCommandWithEndpointID:endpointID + clusterID:clusterID + commandID:commandID + commandFields:commandFields + expectedValues:expectedValues + expectedValueInterval:expectedValueInterval + timedInvokeTimeout:timeout + serverSideProcessingTimeout:serverSideProcessingTimeout + queue:queue + completion:responseHandler]; +} + - (void)openCommissioningWindowWithSetupPasscode:(NSNumber *)setupPasscode discriminator:(NSNumber *)discriminator duration:(NSNumber *)duration diff --git a/src/darwin/Framework/CHIP/MTRDevice_Internal.h b/src/darwin/Framework/CHIP/MTRDevice_Internal.h index cd94bfbb673d52..2840ecaa31596d 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDevice_Internal.h @@ -44,6 +44,26 @@ typedef void (^MTRDevicePerformAsyncBlock)(MTRBaseDevice * baseDevice); // false-positives, for example due to compressed fabric id collisions. - (void)nodeMayBeAdvertisingOperational; +/** + * Like the public invokeCommandWithEndpointID but: + * + * 1) Allows passing through a serverSideProcessingTimeout. + * 2) Expects one of the command payload structs as commandPayload + * 3) On success, returns an instance of responseClass via the completion (or + * nil if there is no responseClass, which indicates a status-only command). + */ +- (void)_invokeKnownCommandWithEndpointID:(NSNumber *)endpointID + clusterID:(NSNumber *)clusterID + commandID:(NSNumber *)commandID + commandPayload:(id)commandPayload + expectedValues:(NSArray *> * _Nullable)expectedValues + expectedValueInterval:(NSNumber * _Nullable)expectedValueInterval + timedInvokeTimeout:(NSNumber * _Nullable)timeout + serverSideProcessingTimeout:(NSNumber * _Nullable)serverSideProcessingTimeout + responseClass:(Class _Nullable)responseClass + queue:(dispatch_queue_t)queue + completion:(void (^)(id _Nullable response, NSError * _Nullable error))completion; + @property (nonatomic, readonly) MTRDeviceController * deviceController; @property (nonatomic, readonly, copy) NSNumber * nodeID; // Queue used for various internal bookkeeping work. diff --git a/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt b/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt index bd903274e66fbf..1e0cf5eca4fe80 100644 --- a/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt @@ -11,6 +11,8 @@ #import "MTRCommandPayloadsObjc.h" #import "MTRDevice_Internal.h" #import "MTRStructsObjc.h" +#import "NSStringSpanConversion.h" +#import "NSDataSpanConversion.h" #include #include diff --git a/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt b/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt index d33c75124c462a..6a715541a7f4e0 100644 --- a/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt @@ -1,21 +1,16 @@ {{> header excludeZapComment=true}} #import -#import +#import -#import "MTRAsyncWorkQueue.h" -#import "MTRBaseClusterUtils.h" -#import "MTRBaseDevice_Internal.h" #import "MTRClusterConstants.h" #import "MTRClusters_Internal.h" #import "MTRDevice_Internal.h" -#import "MTRCallbackBridge.h" #import "MTRCluster_Internal.h" #import "MTRStructsObjc.h" #import "MTRCommandPayloadsObjc.h" #import "MTRLogging_Internal.h" -#include #include #include @@ -28,21 +23,6 @@ using chip::Optional; using chip::System::Clock::Timeout; using chip::System::Clock::Seconds16; -static void MTRClustersLogEnqueue(NSString *logPrefix, MTRAsyncWorkQueue *workQueue) { - MTR_LOG_DEFAULT("%@ enqueueWorkItem %@", logPrefix, workQueue); -} - -static void MTRClustersLogDequeue(NSString *logPrefix, MTRAsyncWorkQueue *workQueue) { - MTR_LOG_DEFAULT("%@ dequeueWorkItem %@", logPrefix, workQueue); -} - -static void MTRClustersLogCompletion(NSString *logPrefix, id value, NSError *error) { - // Log the data at the INFO level (not usually persisted permanently), - // but make sure we log the work completion at the DEFAULT level. - MTR_LOG_INFO("%@ received response: %@ error: %@", logPrefix, value, error); - MTR_LOG_DEFAULT("%@ endWork", logPrefix); -} - // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks): Linter is unable to locate the delete on these objects. {{#zcl_clusters}} {{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} @@ -88,20 +68,6 @@ MTRClusterIDType{{cluster}}ID MTRCommandIDTypeCluster{{cluster}}Command{{command}}ID {{/unless}} {{/inline}} -{{#*inline "baseCluster"}} -{{#if (isSupported cluster command=command)}} -MTRBaseCluster{{cluster}} -{{else}} -MTRBaseCluster{{compatClusterNameRemapping parent.name}} -{{/if}} -{{/inline}} -{{#*inline "completionName"}} -{{#if (isSupported cluster command=command)}} -completion -{{else}} -completionHandler -{{/if}} -{{/inline}} {{#unless hasArguments}} - (void){{asLowerCamelCase name}}WithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion { @@ -110,50 +76,40 @@ completionHandler {{/unless}} - (void){{asLowerCamelCase name}}WithParams: ({{> paramsType}} * {{#unless commandHasRequiredField}}_Nullable{{/unless}})params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int){{> clusterId}}, (unsigned int){{> commandId}}]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[{{> baseCluster}} alloc] initWithDevice:baseDevice endpointID:@(self.endpoint) queue:self.device.queue]; - [cluster {{asLowerCamelCase name}}WithParams:params {{> completionName}}: + if (params == nil) { + params = [[{{> paramsType}} alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { {{#if hasSpecificResponse}} - ^(MTR{{cluster}}Cluster{{asUpperCamelCase responseName preserveAcronyms=true}}Params * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - {{! This treats completion as taking an id for the data. This is - not great from a type-safety perspective, of course. }} - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - } + completion(response, error); {{else}} - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - {{! For now, don't change the bridge API; instead just use an adapter - to invoke our completion handler. This is not great from a - type-safety perspective, of course. }} - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - } + completion(error); {{/if}} - ]; }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + {{#if mustUseTimedInvoke}} + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(10000); } + {{/if}} + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@({{> clusterId}}) + commandID:@({{> commandId}}) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout +{{#if hasSpecificResponse}} + responseClass:MTR{{cluster}}Cluster{{asUpperCamelCase responseName preserveAcronyms=true}}Params.class +{{else}} + responseClass:nil +{{/if}} + queue:self.callbackQueue + completion:responseHandler]; } {{/if}} {{/inline}} @@ -186,7 +142,7 @@ completionHandler - (void)write{{>attribute}}WithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params { NSNumber *timedWriteTimeout = params.timedWriteTimeout; - {{#if mustUseTimedInvoke}} + {{#if mustUseTimedWrite}} if (!timedWriteTimeout) { timedWriteTimeout = @(10000); } diff --git a/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt b/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt index 5797e470a524ce..960e15a392407a 100644 --- a/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt @@ -9,8 +9,11 @@ #import "NSDataSpanConversion.h" #import "MTRBackwardsCompatShims.h" -#include #include +#include +#include +#include +#include NS_ASSUME_NONNULL_BEGIN @@ -134,10 +137,10 @@ NS_ASSUME_NONNULL_BEGIN {{> completeImpl cluster=(asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true) includeRenamedProperties=false}} -{{#if (isStrEqual source "server")}} @implementation MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}Params (InternalMethods) +{{#if (isStrEqual source "server")}} - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::DecodableType &)decodableStruct { {{#zcl_command_arguments}} @@ -147,8 +150,58 @@ NS_ASSUME_NONNULL_BEGIN {{/zcl_command_arguments}} return CHIP_NO_ERROR; } -@end {{/if}} + +{{#if (isStrEqual source "client")}} +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::Type encodableStruct; + ListFreer listFreer; + {{#zcl_command_arguments}} + { + {{>encode_value target=(concat "encodableStruct." (asLowerCamelCase label)) source=(concat "self." (asStructPropertyName label)) cluster=parent.parent.name errorCode="return CHIP_ERROR_INVALID_ARGUMENT;" depth=0}} + } + {{/zcl_command_arguments}} + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +{{/if}} +@end + {{#if (or (not (isStrEqual (asUpperCamelCase parent.name preserveAcronyms=true) (compatClusterNameRemapping parent.name))) (not (isStrEqual (asUpperCamelCase name preserveAcronyms=true) (compatCommandNameRemapping parent.name name))))}} {{> oldNameImpl cluster=(compatClusterNameRemapping parent.name) @@ -177,4 +230,16 @@ NS_ASSUME_NONNULL_BEGIN {{/zcl_commands}} {{/zcl_clusters}} +// MTRBasicClusterMfgSpecificPingParams doesn't need to actually work. +@implementation MTRBasicClusterMfgSpecificPingParams (InternalMethods) +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + return nil; +} +@end + + NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/templates/MTRCommandPayloads_Internal.zapt b/src/darwin/Framework/CHIP/templates/MTRCommandPayloads_Internal.zapt index b17994a5da6502..83a6d1c44b5bc1 100644 --- a/src/darwin/Framework/CHIP/templates/MTRCommandPayloads_Internal.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRCommandPayloads_Internal.zapt @@ -12,19 +12,31 @@ NS_ASSUME_NONNULL_BEGIN {{#zcl_clusters}} {{#zcl_commands}} -{{! We only need to generate conversion functions for the server-generated commands }} -{{#if (isStrEqual source "server")}} {{#if (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true) isForCommandPayload=true)}} @interface MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}Params (InternalMethods) +{{! We only need to generate conversion from decodable structs for the server-generated commands }} +{{#if (isStrEqual source "server")}} - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::DecodableType &)decodableStruct; +{{/if}} + +{{! We only need to generate encoding to data value for client-generated commands }} +{{#if (isStrEqual source "client")}} +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; +{{/if}} @end -{{/if}} + + {{/if}} {{/zcl_commands}} {{/zcl_clusters}} +// Make sure that MTRBasicClusterMfgSpecificPingParams has _encodeAsDataValue just so it compiles. +@interface MTRBasicClusterMfgSpecificPingParams (InternalMethods) +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; +@end + NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/src/darwin/Framework/CHIP/templates/partials/encode_value.zapt b/src/darwin/Framework/CHIP/templates/partials/encode_value.zapt index 8c2cee7f23c7c9..f2f4d076b72bfc 100644 --- a/src/darwin/Framework/CHIP/templates/partials/encode_value.zapt +++ b/src/darwin/Framework/CHIP/templates/partials/encode_value.zapt @@ -40,9 +40,9 @@ } } {{else if (isOctetString type)}} - {{target}} = [self asByteSpan:{{source}}]; + {{target}} = AsByteSpan({{source}}); {{else if (isCharString type)}} - {{target}} = [self asCharSpan:{{source}}]; + {{target}} = AsCharSpan({{source}}); {{else}} {{#if_is_struct type}} {{#zcl_struct_items_by_struct_and_cluster_name type cluster}} diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 5ad02e36b99362..8a75b4105b7876 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -26,6 +26,8 @@ #import "MTRCommandPayloadsObjc.h" #import "MTRDevice_Internal.h" #import "MTRStructsObjc.h" +#import "NSDataSpanConversion.h" +#import "NSStringSpanConversion.h" #include #include @@ -780,7 +782,7 @@ - (void)addGroupWithParams:(MTRGroupsClusterAddGroupParams *)params completion:( } } request.groupID = params.groupID.unsignedShortValue; - request.groupName = [self asCharSpan:params.groupName]; + request.groupName = AsCharSpan(params.groupName); return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); }); @@ -966,7 +968,7 @@ - (void)addGroupIfIdentifyingWithParams:(MTRGroupsClusterAddGroupIfIdentifyingPa } } request.groupID = params.groupID.unsignedShortValue; - request.groupName = [self asCharSpan:params.groupName]; + request.groupName = AsCharSpan(params.groupName); return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); }); @@ -1550,7 +1552,7 @@ - (void)addSceneWithParams:(MTRScenesClusterAddSceneParams *)params completion:( request.groupID = params.groupID.unsignedShortValue; request.sceneID = params.sceneID.unsignedCharValue; request.transitionTime = params.transitionTime.unsignedShortValue; - request.sceneName = [self asCharSpan:params.sceneName]; + request.sceneName = AsCharSpan(params.sceneName); { using ListType_0 = std::remove_reference_t; using ListMemberType_0 = ListMemberTypeGetter::Type; @@ -1831,7 +1833,7 @@ - (void)enhancedAddSceneWithParams:(MTRScenesClusterEnhancedAddSceneParams *)par request.groupID = params.groupID.unsignedShortValue; request.sceneID = params.sceneID.unsignedCharValue; request.transitionTime = params.transitionTime.unsignedShortValue; - request.sceneName = [self asCharSpan:params.sceneName]; + request.sceneName = AsCharSpan(params.sceneName); { using ListType_0 = std::remove_reference_t; using ListMemberType_0 = ListMemberTypeGetter::Type; @@ -6992,7 +6994,7 @@ - (void)writeAttributeActiveTextWithValue:(NSString * _Nonnull)value params:(MTR ListFreer listFreer; using TypeInfo = BinaryInputBasic::Attributes::ActiveText::TypeInfo; TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; + cppValue = AsCharSpan(value); chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); @@ -7064,7 +7066,7 @@ - (void)writeAttributeDescriptionWithValue:(NSString * _Nonnull)value params:(MT ListFreer listFreer; using TypeInfo = BinaryInputBasic::Attributes::Description::TypeInfo; TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; + cppValue = AsCharSpan(value); chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); @@ -7136,7 +7138,7 @@ - (void)writeAttributeInactiveTextWithValue:(NSString * _Nonnull)value params:(M ListFreer listFreer; using TypeInfo = BinaryInputBasic::Attributes::InactiveText::TypeInfo; TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; + cppValue = AsCharSpan(value); chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); @@ -10098,7 +10100,7 @@ - (void)writeAttributeExtensionWithValue:(NSArray * _Nonnull)value params:(MTRWr return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (MTRAccessControlClusterAccessControlExtensionStruct *) value[i_0]; - listHolder_0->mList[i_0].data = [self asByteSpan:element_0.data]; + listHolder_0->mList[i_0].data = AsByteSpan(element_0.data); listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; } cppValue = ListType_0(listHolder_0->mList, value.count); @@ -12310,7 +12312,7 @@ - (void)writeAttributeNodeLabelWithValue:(NSString * _Nonnull)value params:(MTRW ListFreer listFreer; using TypeInfo = BasicInformation::Attributes::NodeLabel::TypeInfo; TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; + cppValue = AsCharSpan(value); chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); @@ -12382,7 +12384,7 @@ - (void)writeAttributeLocationWithValue:(NSString * _Nonnull)value params:(MTRWr ListFreer listFreer; using TypeInfo = BasicInformation::Attributes::Location::TypeInfo; TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; + cppValue = AsCharSpan(value); chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); @@ -14207,7 +14209,7 @@ - (void)queryImageWithParams:(MTROTASoftwareUpdateProviderClusterQueryImageParam } if (params.location != nil) { auto & definedValue_0 = request.location.Emplace(); - definedValue_0 = [self asCharSpan:params.location]; + definedValue_0 = AsCharSpan(params.location); } if (params.requestorCanConsent != nil) { auto & definedValue_0 = request.requestorCanConsent.Emplace(); @@ -14215,7 +14217,7 @@ - (void)queryImageWithParams:(MTROTASoftwareUpdateProviderClusterQueryImageParam } if (params.metadataForProvider != nil) { auto & definedValue_0 = request.metadataForProvider.Emplace(); - definedValue_0 = [self asByteSpan:params.metadataForProvider]; + definedValue_0 = AsByteSpan(params.metadataForProvider); } return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); @@ -14247,7 +14249,7 @@ - (void)applyUpdateRequestWithParams:(MTROTASoftwareUpdateProviderClusterApplyUp invokeTimeout.SetValue(Seconds16(serverSideProcessingTimeout.unsignedShortValue)); } } - request.updateToken = [self asByteSpan:params.updateToken]; + request.updateToken = AsByteSpan(params.updateToken); request.newVersion = params.newVersion.unsignedIntValue; return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); @@ -14282,7 +14284,7 @@ - (void)notifyUpdateAppliedWithParams:(MTROTASoftwareUpdateProviderClusterNotify invokeTimeout.SetValue(Seconds16(serverSideProcessingTimeout.unsignedShortValue)); } } - request.updateToken = [self asByteSpan:params.updateToken]; + request.updateToken = AsByteSpan(params.updateToken); request.softwareVersion = params.softwareVersion.unsignedIntValue; return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); @@ -14777,7 +14779,7 @@ - (void)announceOTAProviderWithParams:(MTROTASoftwareUpdateRequestorClusterAnnou request.announcementReason = static_cast>(params.announcementReason.unsignedCharValue); if (params.metadataForNode != nil) { auto & definedValue_0 = request.metadataForNode.Emplace(); - definedValue_0 = [self asByteSpan:params.metadataForNode]; + definedValue_0 = AsByteSpan(params.metadataForNode); } request.endpoint = params.endpoint.unsignedShortValue; @@ -15617,7 +15619,7 @@ - (void)writeAttributeActiveLocaleWithValue:(NSString * _Nonnull)value params:(M ListFreer listFreer; using TypeInfo = LocalizationConfiguration::Attributes::ActiveLocale::TypeInfo; TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; + cppValue = AsCharSpan(value); chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); @@ -20769,7 +20771,7 @@ - (void)setRegulatoryConfigWithParams:(MTRGeneralCommissioningClusterSetRegulato } } request.newRegulatoryConfig = static_cast>(params.newRegulatoryConfig.unsignedCharValue); - request.countryCode = [self asCharSpan:params.countryCode]; + request.countryCode = AsCharSpan(params.countryCode); request.breadcrumb = params.breadcrumb.unsignedLongLongValue; return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); @@ -21708,7 +21710,7 @@ - (void)scanNetworksWithParams:(MTRNetworkCommissioningClusterScanNetworksParams definedValue_0.SetNull(); } else { auto & nonNullValue_1 = definedValue_0.SetNonNull(); - nonNullValue_1 = [self asByteSpan:params.ssid]; + nonNullValue_1 = AsByteSpan(params.ssid); } } if (params.breadcrumb != nil) { @@ -21746,8 +21748,8 @@ - (void)addOrUpdateWiFiNetworkWithParams:(MTRNetworkCommissioningClusterAddOrUpd invokeTimeout.SetValue(Seconds16(serverSideProcessingTimeout.unsignedShortValue)); } } - request.ssid = [self asByteSpan:params.ssid]; - request.credentials = [self asByteSpan:params.credentials]; + request.ssid = AsByteSpan(params.ssid); + request.credentials = AsByteSpan(params.credentials); if (params.breadcrumb != nil) { auto & definedValue_0 = request.breadcrumb.Emplace(); definedValue_0 = params.breadcrumb.unsignedLongLongValue; @@ -21782,7 +21784,7 @@ - (void)addOrUpdateThreadNetworkWithParams:(MTRNetworkCommissioningClusterAddOrU invokeTimeout.SetValue(Seconds16(serverSideProcessingTimeout.unsignedShortValue)); } } - request.operationalDataset = [self asByteSpan:params.operationalDataset]; + request.operationalDataset = AsByteSpan(params.operationalDataset); if (params.breadcrumb != nil) { auto & definedValue_0 = request.breadcrumb.Emplace(); definedValue_0 = params.breadcrumb.unsignedLongLongValue; @@ -21817,7 +21819,7 @@ - (void)removeNetworkWithParams:(MTRNetworkCommissioningClusterRemoveNetworkPara invokeTimeout.SetValue(Seconds16(serverSideProcessingTimeout.unsignedShortValue)); } } - request.networkID = [self asByteSpan:params.networkID]; + request.networkID = AsByteSpan(params.networkID); if (params.breadcrumb != nil) { auto & definedValue_0 = request.breadcrumb.Emplace(); definedValue_0 = params.breadcrumb.unsignedLongLongValue; @@ -21852,7 +21854,7 @@ - (void)connectNetworkWithParams:(MTRNetworkCommissioningClusterConnectNetworkPa invokeTimeout.SetValue(Seconds16(serverSideProcessingTimeout.unsignedShortValue)); } } - request.networkID = [self asByteSpan:params.networkID]; + request.networkID = AsByteSpan(params.networkID); if (params.breadcrumb != nil) { auto & definedValue_0 = request.breadcrumb.Emplace(); definedValue_0 = params.breadcrumb.unsignedLongLongValue; @@ -21887,7 +21889,7 @@ - (void)reorderNetworkWithParams:(MTRNetworkCommissioningClusterReorderNetworkPa invokeTimeout.SetValue(Seconds16(serverSideProcessingTimeout.unsignedShortValue)); } } - request.networkID = [self asByteSpan:params.networkID]; + request.networkID = AsByteSpan(params.networkID); request.networkIndex = params.networkIndex.unsignedCharValue; if (params.breadcrumb != nil) { auto & definedValue_0 = request.breadcrumb.Emplace(); @@ -23032,7 +23034,7 @@ - (void)retrieveLogsRequestWithParams:(MTRDiagnosticLogsClusterRetrieveLogsReque request.requestedProtocol = static_cast>(params.requestedProtocol.unsignedCharValue); if (params.transferFileDesignator != nil) { auto & definedValue_0 = request.transferFileDesignator.Emplace(); - definedValue_0 = [self asCharSpan:params.transferFileDesignator]; + definedValue_0 = AsCharSpan(params.transferFileDesignator); } return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); @@ -23506,7 +23508,7 @@ - (void)testEventTriggerWithParams:(MTRGeneralDiagnosticsClusterTestEventTrigger invokeTimeout.SetValue(Seconds16(serverSideProcessingTimeout.unsignedShortValue)); } } - request.enableKey = [self asByteSpan:params.enableKey]; + request.enableKey = AsByteSpan(params.enableKey); request.eventTrigger = params.eventTrigger.unsignedLongLongValue; return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); @@ -33172,7 +33174,7 @@ - (void)setTimeZoneWithParams:(MTRTimeSynchronizationClusterSetTimeZoneParams *) listHolder_0->mList[i_0].validAt = element_0.validAt.unsignedLongLongValue; if (element_0.name != nil) { auto & definedValue_2 = listHolder_0->mList[i_0].name.Emplace(); - definedValue_2 = [self asCharSpan:element_0.name]; + definedValue_2 = AsCharSpan(element_0.name); } } request.timeZone = ListType_0(listHolder_0->mList, params.timeZone.count); @@ -33279,7 +33281,7 @@ - (void)setDefaultNTPWithParams:(MTRTimeSynchronizationClusterSetDefaultNTPParam request.defaultNTP.SetNull(); } else { auto & nonNullValue_0 = request.defaultNTP.SetNonNull(); - nonNullValue_0 = [self asCharSpan:params.defaultNTP]; + nonNullValue_0 = AsCharSpan(params.defaultNTP); } return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); @@ -34174,7 +34176,7 @@ - (void)writeAttributeNodeLabelWithValue:(NSString * _Nonnull)value params:(MTRW ListFreer listFreer; using TypeInfo = BridgedDeviceBasicInformation::Attributes::NodeLabel::TypeInfo; TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; + cppValue = AsCharSpan(value); chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); @@ -36313,10 +36315,10 @@ - (void)openCommissioningWindowWithParams:(MTRAdministratorCommissioningClusterO timedInvokeTimeoutMs.SetValue(10000); } request.commissioningTimeout = params.commissioningTimeout.unsignedShortValue; - request.PAKEPasscodeVerifier = [self asByteSpan:params.pakePasscodeVerifier]; + request.PAKEPasscodeVerifier = AsByteSpan(params.pakePasscodeVerifier); request.discriminator = params.discriminator.unsignedShortValue; request.iterations = params.iterations.unsignedIntValue; - request.salt = [self asByteSpan:params.salt]; + request.salt = AsByteSpan(params.salt); return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); }); @@ -37093,7 +37095,7 @@ - (void)attestationRequestWithParams:(MTROperationalCredentialsClusterAttestatio invokeTimeout.SetValue(Seconds16(serverSideProcessingTimeout.unsignedShortValue)); } } - request.attestationNonce = [self asByteSpan:params.attestationNonce]; + request.attestationNonce = AsByteSpan(params.attestationNonce); return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); }); @@ -37155,7 +37157,7 @@ - (void)CSRRequestWithParams:(MTROperationalCredentialsClusterCSRRequestParams * invokeTimeout.SetValue(Seconds16(serverSideProcessingTimeout.unsignedShortValue)); } } - request.CSRNonce = [self asByteSpan:params.csrNonce]; + request.CSRNonce = AsByteSpan(params.csrNonce); if (params.isForUpdateNOC != nil) { auto & definedValue_0 = request.isForUpdateNOC.Emplace(); definedValue_0 = params.isForUpdateNOC.boolValue; @@ -37190,12 +37192,12 @@ - (void)addNOCWithParams:(MTROperationalCredentialsClusterAddNOCParams *)params invokeTimeout.SetValue(Seconds16(serverSideProcessingTimeout.unsignedShortValue)); } } - request.NOCValue = [self asByteSpan:params.nocValue]; + request.NOCValue = AsByteSpan(params.nocValue); if (params.icacValue != nil) { auto & definedValue_0 = request.ICACValue.Emplace(); - definedValue_0 = [self asByteSpan:params.icacValue]; + definedValue_0 = AsByteSpan(params.icacValue); } - request.IPKValue = [self asByteSpan:params.ipkValue]; + request.IPKValue = AsByteSpan(params.ipkValue); request.caseAdminSubject = params.caseAdminSubject.unsignedLongLongValue; request.adminVendorId = static_cast>(params.adminVendorId.unsignedShortValue); @@ -37228,10 +37230,10 @@ - (void)updateNOCWithParams:(MTROperationalCredentialsClusterUpdateNOCParams *)p invokeTimeout.SetValue(Seconds16(serverSideProcessingTimeout.unsignedShortValue)); } } - request.NOCValue = [self asByteSpan:params.nocValue]; + request.NOCValue = AsByteSpan(params.nocValue); if (params.icacValue != nil) { auto & definedValue_0 = request.ICACValue.Emplace(); - definedValue_0 = [self asByteSpan:params.icacValue]; + definedValue_0 = AsByteSpan(params.icacValue); } return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); @@ -37263,7 +37265,7 @@ - (void)updateFabricLabelWithParams:(MTROperationalCredentialsClusterUpdateFabri invokeTimeout.SetValue(Seconds16(serverSideProcessingTimeout.unsignedShortValue)); } } - request.label = [self asCharSpan:params.label]; + request.label = AsCharSpan(params.label); return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); }); @@ -37328,7 +37330,7 @@ - (void)addTrustedRootCertificateWithParams:(MTROperationalCredentialsClusterAdd invokeTimeout.SetValue(Seconds16(serverSideProcessingTimeout.unsignedShortValue)); } } - request.rootCACertificate = [self asByteSpan:params.rootCACertificate]; + request.rootCACertificate = AsByteSpan(params.rootCACertificate); return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); }); @@ -38298,7 +38300,7 @@ - (void)keySetWriteWithParams:(MTRGroupKeyManagementClusterKeySetWriteParams *)p request.groupKeySet.epochKey0.SetNull(); } else { auto & nonNullValue_1 = request.groupKeySet.epochKey0.SetNonNull(); - nonNullValue_1 = [self asByteSpan:params.groupKeySet.epochKey0]; + nonNullValue_1 = AsByteSpan(params.groupKeySet.epochKey0); } if (params.groupKeySet.epochStartTime0 == nil) { request.groupKeySet.epochStartTime0.SetNull(); @@ -38310,7 +38312,7 @@ - (void)keySetWriteWithParams:(MTRGroupKeyManagementClusterKeySetWriteParams *)p request.groupKeySet.epochKey1.SetNull(); } else { auto & nonNullValue_1 = request.groupKeySet.epochKey1.SetNonNull(); - nonNullValue_1 = [self asByteSpan:params.groupKeySet.epochKey1]; + nonNullValue_1 = AsByteSpan(params.groupKeySet.epochKey1); } if (params.groupKeySet.epochStartTime1 == nil) { request.groupKeySet.epochStartTime1.SetNull(); @@ -38322,7 +38324,7 @@ - (void)keySetWriteWithParams:(MTRGroupKeyManagementClusterKeySetWriteParams *)p request.groupKeySet.epochKey2.SetNull(); } else { auto & nonNullValue_1 = request.groupKeySet.epochKey2.SetNonNull(); - nonNullValue_1 = [self asByteSpan:params.groupKeySet.epochKey2]; + nonNullValue_1 = AsByteSpan(params.groupKeySet.epochKey2); } if (params.groupKeySet.epochStartTime2 == nil) { request.groupKeySet.epochStartTime2.SetNull(); @@ -39802,8 +39804,8 @@ - (void)writeAttributeLabelListWithValue:(NSArray * _Nonnull)value params:(MTRWr return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (MTRUserLabelClusterLabelStruct *) value[i_0]; - listHolder_0->mList[i_0].label = [self asCharSpan:element_0.label]; - listHolder_0->mList[i_0].value = [self asCharSpan:element_0.value]; + listHolder_0->mList[i_0].label = AsCharSpan(element_0.label); + listHolder_0->mList[i_0].value = AsCharSpan(element_0.value); } cppValue = ListType_0(listHolder_0->mList, value.count); } else { @@ -40848,10 +40850,10 @@ - (void)registerClientWithParams:(MTRICDManagementClusterRegisterClientParams *) } request.checkInNodeID = params.checkInNodeID.unsignedLongLongValue; request.monitoredSubject = params.monitoredSubject.unsignedLongLongValue; - request.key = [self asByteSpan:params.key]; + request.key = AsByteSpan(params.key); if (params.verificationKey != nil) { auto & definedValue_0 = request.verificationKey.Emplace(); - definedValue_0 = [self asByteSpan:params.verificationKey]; + definedValue_0 = AsByteSpan(params.verificationKey); } return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); @@ -40889,7 +40891,7 @@ - (void)unregisterClientWithParams:(MTRICDManagementClusterUnregisterClientParam request.checkInNodeID = params.checkInNodeID.unsignedLongLongValue; if (params.verificationKey != nil) { auto & definedValue_0 = request.verificationKey.Emplace(); - definedValue_0 = [self asByteSpan:params.verificationKey]; + definedValue_0 = AsByteSpan(params.verificationKey); } return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); @@ -50175,7 +50177,7 @@ - (void)lockDoorWithParams:(MTRDoorLockClusterLockDoorParams * _Nullable)params if (params != nil) { if (params.pinCode != nil) { auto & definedValue_0 = request.PINCode.Emplace(); - definedValue_0 = [self asByteSpan:params.pinCode]; + definedValue_0 = AsByteSpan(params.pinCode); } } @@ -50217,7 +50219,7 @@ - (void)unlockDoorWithParams:(MTRDoorLockClusterUnlockDoorParams * _Nullable)par if (params != nil) { if (params.pinCode != nil) { auto & definedValue_0 = request.PINCode.Emplace(); - definedValue_0 = [self asByteSpan:params.pinCode]; + definedValue_0 = AsByteSpan(params.pinCode); } } @@ -50259,7 +50261,7 @@ - (void)unlockWithTimeoutWithParams:(MTRDoorLockClusterUnlockWithTimeoutParams * request.timeout = params.timeout.unsignedShortValue; if (params.pinCode != nil) { auto & definedValue_0 = request.PINCode.Emplace(); - definedValue_0 = [self asByteSpan:params.pinCode]; + definedValue_0 = AsByteSpan(params.pinCode); } return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); @@ -50616,7 +50618,7 @@ - (void)setUserWithParams:(MTRDoorLockClusterSetUserParams *)params completion:( request.userName.SetNull(); } else { auto & nonNullValue_0 = request.userName.SetNonNull(); - nonNullValue_0 = [self asCharSpan:params.userName]; + nonNullValue_0 = AsCharSpan(params.userName); } if (params.userUniqueID == nil) { request.userUniqueID.SetNull(); @@ -50746,7 +50748,7 @@ - (void)setCredentialWithParams:(MTRDoorLockClusterSetCredentialParams *)params request.operationType = static_cast>(params.operationType.unsignedCharValue); request.credential.credentialType = static_cast>(params.credential.credentialType.unsignedCharValue); request.credential.credentialIndex = params.credential.credentialIndex.unsignedShortValue; - request.credentialData = [self asByteSpan:params.credentialData]; + request.credentialData = AsByteSpan(params.credentialData); if (params.userIndex == nil) { request.userIndex.SetNull(); } else { @@ -50879,7 +50881,7 @@ - (void)unboltDoorWithParams:(MTRDoorLockClusterUnboltDoorParams * _Nullable)par if (params != nil) { if (params.pinCode != nil) { auto & definedValue_0 = request.PINCode.Emplace(); - definedValue_0 = [self asByteSpan:params.pinCode]; + definedValue_0 = AsByteSpan(params.pinCode); } } @@ -51747,7 +51749,7 @@ - (void)writeAttributeLanguageWithValue:(NSString * _Nonnull)value params:(MTRWr ListFreer listFreer; using TypeInfo = DoorLock::Attributes::Language::TypeInfo; TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; + cppValue = AsCharSpan(value); chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); @@ -74802,7 +74804,7 @@ - (void)writeAttributeLampTypeWithValue:(NSString * _Nonnull)value params:(MTRWr ListFreer listFreer; using TypeInfo = BallastConfiguration::Attributes::LampType::TypeInfo; TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; + cppValue = AsCharSpan(value); chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); @@ -74874,7 +74876,7 @@ - (void)writeAttributeLampManufacturerWithValue:(NSString * _Nonnull)value param ListFreer listFreer; using TypeInfo = BallastConfiguration::Attributes::LampManufacturer::TypeInfo; TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; + cppValue = AsCharSpan(value); chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); @@ -89096,7 +89098,7 @@ - (void)changeChannelWithParams:(MTRChannelClusterChangeChannelParams *)params c invokeTimeout.SetValue(Seconds16(serverSideProcessingTimeout.unsignedShortValue)); } } - request.match = [self asCharSpan:params.match]; + request.match = AsCharSpan(params.match); return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); }); @@ -89867,7 +89869,7 @@ - (void)navigateTargetWithParams:(MTRTargetNavigatorClusterNavigateTargetParams request.target = params.target.unsignedCharValue; if (params.data != nil) { auto & definedValue_0 = request.data.Emplace(); - definedValue_0 = [self asCharSpan:params.data]; + definedValue_0 = AsCharSpan(params.data); } return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); @@ -92023,7 +92025,7 @@ - (void)renameInputWithParams:(MTRMediaInputClusterRenameInputParams *)params co } } request.index = params.index.unsignedCharValue; - request.name = [self asCharSpan:params.name]; + request.name = AsCharSpan(params.name); return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); }); @@ -93622,7 +93624,7 @@ - (void)launchContentWithParams:(MTRContentLauncherClusterLaunchContentParams *) } auto element_1 = (MTRContentLauncherClusterParameterStruct *) params.search.parameterList[i_1]; listHolder_1->mList[i_1].type = static_castmList[i_1].type)>>(element_1.type.unsignedCharValue); - listHolder_1->mList[i_1].value = [self asCharSpan:element_1.value]; + listHolder_1->mList[i_1].value = AsCharSpan(element_1.value); if (element_1.externalIDList != nil) { auto & definedValue_3 = listHolder_1->mList[i_1].externalIDList.Emplace(); { @@ -93640,8 +93642,8 @@ - (void)launchContentWithParams:(MTRContentLauncherClusterLaunchContentParams *) return CHIP_ERROR_INVALID_ARGUMENT; } auto element_4 = (MTRContentLauncherClusterAdditionalInfoStruct *) element_1.externalIDList[i_4]; - listHolder_4->mList[i_4].name = [self asCharSpan:element_4.name]; - listHolder_4->mList[i_4].value = [self asCharSpan:element_4.value]; + listHolder_4->mList[i_4].name = AsCharSpan(element_4.name); + listHolder_4->mList[i_4].value = AsCharSpan(element_4.value); } definedValue_3 = ListType_4(listHolder_4->mList, element_1.externalIDList.count); } else { @@ -93658,7 +93660,7 @@ - (void)launchContentWithParams:(MTRContentLauncherClusterLaunchContentParams *) request.autoPlay = params.autoPlay.boolValue; if (params.data != nil) { auto & definedValue_0 = request.data.Emplace(); - definedValue_0 = [self asCharSpan:params.data]; + definedValue_0 = AsCharSpan(params.data); } return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); @@ -93690,23 +93692,23 @@ - (void)launchURLWithParams:(MTRContentLauncherClusterLaunchURLParams *)params c invokeTimeout.SetValue(Seconds16(serverSideProcessingTimeout.unsignedShortValue)); } } - request.contentURL = [self asCharSpan:params.contentURL]; + request.contentURL = AsCharSpan(params.contentURL); if (params.displayString != nil) { auto & definedValue_0 = request.displayString.Emplace(); - definedValue_0 = [self asCharSpan:params.displayString]; + definedValue_0 = AsCharSpan(params.displayString); } if (params.brandingInformation != nil) { auto & definedValue_0 = request.brandingInformation.Emplace(); - definedValue_0.providerName = [self asCharSpan:params.brandingInformation.providerName]; + definedValue_0.providerName = AsCharSpan(params.brandingInformation.providerName); if (params.brandingInformation.background != nil) { auto & definedValue_2 = definedValue_0.background.Emplace(); if (params.brandingInformation.background.imageURL != nil) { auto & definedValue_4 = definedValue_2.imageURL.Emplace(); - definedValue_4 = [self asCharSpan:params.brandingInformation.background.imageURL]; + definedValue_4 = AsCharSpan(params.brandingInformation.background.imageURL); } if (params.brandingInformation.background.color != nil) { auto & definedValue_4 = definedValue_2.color.Emplace(); - definedValue_4 = [self asCharSpan:params.brandingInformation.background.color]; + definedValue_4 = AsCharSpan(params.brandingInformation.background.color); } if (params.brandingInformation.background.size != nil) { auto & definedValue_4 = definedValue_2.size.Emplace(); @@ -93719,11 +93721,11 @@ - (void)launchURLWithParams:(MTRContentLauncherClusterLaunchURLParams *)params c auto & definedValue_2 = definedValue_0.logo.Emplace(); if (params.brandingInformation.logo.imageURL != nil) { auto & definedValue_4 = definedValue_2.imageURL.Emplace(); - definedValue_4 = [self asCharSpan:params.brandingInformation.logo.imageURL]; + definedValue_4 = AsCharSpan(params.brandingInformation.logo.imageURL); } if (params.brandingInformation.logo.color != nil) { auto & definedValue_4 = definedValue_2.color.Emplace(); - definedValue_4 = [self asCharSpan:params.brandingInformation.logo.color]; + definedValue_4 = AsCharSpan(params.brandingInformation.logo.color); } if (params.brandingInformation.logo.size != nil) { auto & definedValue_4 = definedValue_2.size.Emplace(); @@ -93736,11 +93738,11 @@ - (void)launchURLWithParams:(MTRContentLauncherClusterLaunchURLParams *)params c auto & definedValue_2 = definedValue_0.progressBar.Emplace(); if (params.brandingInformation.progressBar.imageURL != nil) { auto & definedValue_4 = definedValue_2.imageURL.Emplace(); - definedValue_4 = [self asCharSpan:params.brandingInformation.progressBar.imageURL]; + definedValue_4 = AsCharSpan(params.brandingInformation.progressBar.imageURL); } if (params.brandingInformation.progressBar.color != nil) { auto & definedValue_4 = definedValue_2.color.Emplace(); - definedValue_4 = [self asCharSpan:params.brandingInformation.progressBar.color]; + definedValue_4 = AsCharSpan(params.brandingInformation.progressBar.color); } if (params.brandingInformation.progressBar.size != nil) { auto & definedValue_4 = definedValue_2.size.Emplace(); @@ -93753,11 +93755,11 @@ - (void)launchURLWithParams:(MTRContentLauncherClusterLaunchURLParams *)params c auto & definedValue_2 = definedValue_0.splash.Emplace(); if (params.brandingInformation.splash.imageURL != nil) { auto & definedValue_4 = definedValue_2.imageURL.Emplace(); - definedValue_4 = [self asCharSpan:params.brandingInformation.splash.imageURL]; + definedValue_4 = AsCharSpan(params.brandingInformation.splash.imageURL); } if (params.brandingInformation.splash.color != nil) { auto & definedValue_4 = definedValue_2.color.Emplace(); - definedValue_4 = [self asCharSpan:params.brandingInformation.splash.color]; + definedValue_4 = AsCharSpan(params.brandingInformation.splash.color); } if (params.brandingInformation.splash.size != nil) { auto & definedValue_4 = definedValue_2.size.Emplace(); @@ -93770,11 +93772,11 @@ - (void)launchURLWithParams:(MTRContentLauncherClusterLaunchURLParams *)params c auto & definedValue_2 = definedValue_0.waterMark.Emplace(); if (params.brandingInformation.waterMark.imageURL != nil) { auto & definedValue_4 = definedValue_2.imageURL.Emplace(); - definedValue_4 = [self asCharSpan:params.brandingInformation.waterMark.imageURL]; + definedValue_4 = AsCharSpan(params.brandingInformation.waterMark.imageURL); } if (params.brandingInformation.waterMark.color != nil) { auto & definedValue_4 = definedValue_2.color.Emplace(); - definedValue_4 = [self asCharSpan:params.brandingInformation.waterMark.color]; + definedValue_4 = AsCharSpan(params.brandingInformation.waterMark.color); } if (params.brandingInformation.waterMark.size != nil) { auto & definedValue_4 = definedValue_2.size.Emplace(); @@ -94487,7 +94489,7 @@ - (void)renameOutputWithParams:(MTRAudioOutputClusterRenameOutputParams *)params } } request.index = params.index.unsignedCharValue; - request.name = [self asCharSpan:params.name]; + request.name = AsCharSpan(params.name); return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); }); @@ -95109,11 +95111,11 @@ - (void)launchAppWithParams:(MTRApplicationLauncherClusterLaunchAppParams * _Nul if (params.application != nil) { auto & definedValue_0 = request.application.Emplace(); definedValue_0.catalogVendorID = params.application.catalogVendorID.unsignedShortValue; - definedValue_0.applicationID = [self asCharSpan:params.application.applicationID]; + definedValue_0.applicationID = AsCharSpan(params.application.applicationID); } if (params.data != nil) { auto & definedValue_0 = request.data.Emplace(); - definedValue_0 = [self asByteSpan:params.data]; + definedValue_0 = AsByteSpan(params.data); } } @@ -95150,7 +95152,7 @@ - (void)stopAppWithParams:(MTRApplicationLauncherClusterStopAppParams * _Nullabl if (params.application != nil) { auto & definedValue_0 = request.application.Emplace(); definedValue_0.catalogVendorID = params.application.catalogVendorID.unsignedShortValue; - definedValue_0.applicationID = [self asCharSpan:params.application.applicationID]; + definedValue_0.applicationID = AsCharSpan(params.application.applicationID); } } @@ -95187,7 +95189,7 @@ - (void)hideAppWithParams:(MTRApplicationLauncherClusterHideAppParams * _Nullabl if (params.application != nil) { auto & definedValue_0 = request.application.Emplace(); definedValue_0.catalogVendorID = params.application.catalogVendorID.unsignedShortValue; - definedValue_0.applicationID = [self asCharSpan:params.application.applicationID]; + definedValue_0.applicationID = AsCharSpan(params.application.applicationID); } } @@ -95274,7 +95276,7 @@ - (void)writeAttributeCurrentAppWithValue:(MTRApplicationLauncherClusterApplicat } else { auto & nonNullValue_0 = cppValue.SetNonNull(); nonNullValue_0.application.catalogVendorID = value.application.catalogVendorID.unsignedShortValue; - nonNullValue_0.application.applicationID = [self asCharSpan:value.application.applicationID]; + nonNullValue_0.application.applicationID = AsCharSpan(value.application.applicationID); if (value.endpoint != nil) { auto & definedValue_2 = nonNullValue_0.endpoint.Emplace(); definedValue_2 = value.endpoint.unsignedShortValue; @@ -96890,7 +96892,7 @@ - (void)getSetupPINWithParams:(MTRAccountLoginClusterGetSetupPINParams *)params if (!timedInvokeTimeoutMs.HasValue()) { timedInvokeTimeoutMs.SetValue(10000); } - request.tempAccountIdentifier = [self asCharSpan:params.tempAccountIdentifier]; + request.tempAccountIdentifier = AsCharSpan(params.tempAccountIdentifier); return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); }); @@ -96927,8 +96929,8 @@ - (void)loginWithParams:(MTRAccountLoginClusterLoginParams *)params completion:( if (!timedInvokeTimeoutMs.HasValue()) { timedInvokeTimeoutMs.SetValue(10000); } - request.tempAccountIdentifier = [self asCharSpan:params.tempAccountIdentifier]; - request.setupPIN = [self asCharSpan:params.setupPIN]; + request.tempAccountIdentifier = AsCharSpan(params.tempAccountIdentifier); + request.setupPIN = AsCharSpan(params.setupPIN); return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self.endpoint, timedInvokeTimeoutMs, invokeTimeout); }); @@ -107878,8 +107880,8 @@ - (void)testStructArrayArgumentRequestWithParams:(MTRUnitTestingClusterTestStruc listHolder_0->mList[i_0].c.a = element_0.c.a.unsignedCharValue; listHolder_0->mList[i_0].c.b = element_0.c.b.boolValue; listHolder_0->mList[i_0].c.c = static_castmList[i_0].c.c)>>(element_0.c.c.unsignedCharValue); - listHolder_0->mList[i_0].c.d = [self asByteSpan:element_0.c.d]; - listHolder_0->mList[i_0].c.e = [self asCharSpan:element_0.c.e]; + listHolder_0->mList[i_0].c.d = AsByteSpan(element_0.c.d); + listHolder_0->mList[i_0].c.e = AsCharSpan(element_0.c.e); listHolder_0->mList[i_0].c.f = static_castmList[i_0].c.f)>>(element_0.c.f.unsignedCharValue); listHolder_0->mList[i_0].c.g = element_0.c.g.floatValue; listHolder_0->mList[i_0].c.h = element_0.c.h.doubleValue; @@ -107901,8 +107903,8 @@ - (void)testStructArrayArgumentRequestWithParams:(MTRUnitTestingClusterTestStruc listHolder_2->mList[i_2].a = element_2.a.unsignedCharValue; listHolder_2->mList[i_2].b = element_2.b.boolValue; listHolder_2->mList[i_2].c = static_castmList[i_2].c)>>(element_2.c.unsignedCharValue); - listHolder_2->mList[i_2].d = [self asByteSpan:element_2.d]; - listHolder_2->mList[i_2].e = [self asCharSpan:element_2.e]; + listHolder_2->mList[i_2].d = AsByteSpan(element_2.d); + listHolder_2->mList[i_2].e = AsCharSpan(element_2.e); listHolder_2->mList[i_2].f = static_castmList[i_2].f)>>(element_2.f.unsignedCharValue); listHolder_2->mList[i_2].g = element_2.g.floatValue; listHolder_2->mList[i_2].h = element_2.h.doubleValue; @@ -107949,7 +107951,7 @@ - (void)testStructArrayArgumentRequestWithParams:(MTRUnitTestingClusterTestStruc return CHIP_ERROR_INVALID_ARGUMENT; } auto element_2 = (NSData *) element_0.f[i_2]; - listHolder_2->mList[i_2] = [self asByteSpan:element_2]; + listHolder_2->mList[i_2] = AsByteSpan(element_2); } listHolder_0->mList[i_0].f = ListType_2(listHolder_2->mList, element_0.f.count); } else { @@ -108002,8 +108004,8 @@ - (void)testStructArrayArgumentRequestWithParams:(MTRUnitTestingClusterTestStruc listHolder_0->mList[i_0].a = element_0.a.unsignedCharValue; listHolder_0->mList[i_0].b = element_0.b.boolValue; listHolder_0->mList[i_0].c = static_castmList[i_0].c)>>(element_0.c.unsignedCharValue); - listHolder_0->mList[i_0].d = [self asByteSpan:element_0.d]; - listHolder_0->mList[i_0].e = [self asCharSpan:element_0.e]; + listHolder_0->mList[i_0].d = AsByteSpan(element_0.d); + listHolder_0->mList[i_0].e = AsCharSpan(element_0.e); listHolder_0->mList[i_0].f = static_castmList[i_0].f)>>(element_0.f.unsignedCharValue); listHolder_0->mList[i_0].g = element_0.g.floatValue; listHolder_0->mList[i_0].h = element_0.h.doubleValue; @@ -108092,8 +108094,8 @@ - (void)testStructArgumentRequestWithParams:(MTRUnitTestingClusterTestStructArgu request.arg1.a = params.arg1.a.unsignedCharValue; request.arg1.b = params.arg1.b.boolValue; request.arg1.c = static_cast>(params.arg1.c.unsignedCharValue); - request.arg1.d = [self asByteSpan:params.arg1.d]; - request.arg1.e = [self asCharSpan:params.arg1.e]; + request.arg1.d = AsByteSpan(params.arg1.d); + request.arg1.e = AsCharSpan(params.arg1.e); request.arg1.f = static_cast>(params.arg1.f.unsignedCharValue); request.arg1.g = params.arg1.g.floatValue; request.arg1.h = params.arg1.h.doubleValue; @@ -108132,8 +108134,8 @@ - (void)testNestedStructArgumentRequestWithParams:(MTRUnitTestingClusterTestNest request.arg1.c.a = params.arg1.c.a.unsignedCharValue; request.arg1.c.b = params.arg1.c.b.boolValue; request.arg1.c.c = static_cast>(params.arg1.c.c.unsignedCharValue); - request.arg1.c.d = [self asByteSpan:params.arg1.c.d]; - request.arg1.c.e = [self asCharSpan:params.arg1.c.e]; + request.arg1.c.d = AsByteSpan(params.arg1.c.d); + request.arg1.c.e = AsCharSpan(params.arg1.c.e); request.arg1.c.f = static_cast>(params.arg1.c.f.unsignedCharValue); request.arg1.c.g = params.arg1.c.g.floatValue; request.arg1.c.h = params.arg1.c.h.doubleValue; @@ -108185,8 +108187,8 @@ - (void)testListStructArgumentRequestWithParams:(MTRUnitTestingClusterTestListSt listHolder_0->mList[i_0].a = element_0.a.unsignedCharValue; listHolder_0->mList[i_0].b = element_0.b.boolValue; listHolder_0->mList[i_0].c = static_castmList[i_0].c)>>(element_0.c.unsignedCharValue); - listHolder_0->mList[i_0].d = [self asByteSpan:element_0.d]; - listHolder_0->mList[i_0].e = [self asCharSpan:element_0.e]; + listHolder_0->mList[i_0].d = AsByteSpan(element_0.d); + listHolder_0->mList[i_0].e = AsCharSpan(element_0.e); listHolder_0->mList[i_0].f = static_castmList[i_0].f)>>(element_0.f.unsignedCharValue); listHolder_0->mList[i_0].g = element_0.g.floatValue; listHolder_0->mList[i_0].h = element_0.h.doubleValue; @@ -108283,8 +108285,8 @@ - (void)testNestedStructListArgumentRequestWithParams:(MTRUnitTestingClusterTest request.arg1.c.a = params.arg1.c.a.unsignedCharValue; request.arg1.c.b = params.arg1.c.b.boolValue; request.arg1.c.c = static_cast>(params.arg1.c.c.unsignedCharValue); - request.arg1.c.d = [self asByteSpan:params.arg1.c.d]; - request.arg1.c.e = [self asCharSpan:params.arg1.c.e]; + request.arg1.c.d = AsByteSpan(params.arg1.c.d); + request.arg1.c.e = AsCharSpan(params.arg1.c.e); request.arg1.c.f = static_cast>(params.arg1.c.f.unsignedCharValue); request.arg1.c.g = params.arg1.c.g.floatValue; request.arg1.c.h = params.arg1.c.h.doubleValue; @@ -108306,8 +108308,8 @@ - (void)testNestedStructListArgumentRequestWithParams:(MTRUnitTestingClusterTest listHolder_1->mList[i_1].a = element_1.a.unsignedCharValue; listHolder_1->mList[i_1].b = element_1.b.boolValue; listHolder_1->mList[i_1].c = static_castmList[i_1].c)>>(element_1.c.unsignedCharValue); - listHolder_1->mList[i_1].d = [self asByteSpan:element_1.d]; - listHolder_1->mList[i_1].e = [self asCharSpan:element_1.e]; + listHolder_1->mList[i_1].d = AsByteSpan(element_1.d); + listHolder_1->mList[i_1].e = AsCharSpan(element_1.e); listHolder_1->mList[i_1].f = static_castmList[i_1].f)>>(element_1.f.unsignedCharValue); listHolder_1->mList[i_1].g = element_1.g.floatValue; listHolder_1->mList[i_1].h = element_1.h.doubleValue; @@ -108354,7 +108356,7 @@ - (void)testNestedStructListArgumentRequestWithParams:(MTRUnitTestingClusterTest return CHIP_ERROR_INVALID_ARGUMENT; } auto element_1 = (NSData *) params.arg1.f[i_1]; - listHolder_1->mList[i_1] = [self asByteSpan:element_1]; + listHolder_1->mList[i_1] = AsByteSpan(element_1); } request.arg1.f = ListType_1(listHolder_1->mList, params.arg1.f.count); } else { @@ -108433,8 +108435,8 @@ - (void)testListNestedStructListArgumentRequestWithParams:(MTRUnitTestingCluster listHolder_0->mList[i_0].c.a = element_0.c.a.unsignedCharValue; listHolder_0->mList[i_0].c.b = element_0.c.b.boolValue; listHolder_0->mList[i_0].c.c = static_castmList[i_0].c.c)>>(element_0.c.c.unsignedCharValue); - listHolder_0->mList[i_0].c.d = [self asByteSpan:element_0.c.d]; - listHolder_0->mList[i_0].c.e = [self asCharSpan:element_0.c.e]; + listHolder_0->mList[i_0].c.d = AsByteSpan(element_0.c.d); + listHolder_0->mList[i_0].c.e = AsCharSpan(element_0.c.e); listHolder_0->mList[i_0].c.f = static_castmList[i_0].c.f)>>(element_0.c.f.unsignedCharValue); listHolder_0->mList[i_0].c.g = element_0.c.g.floatValue; listHolder_0->mList[i_0].c.h = element_0.c.h.doubleValue; @@ -108456,8 +108458,8 @@ - (void)testListNestedStructListArgumentRequestWithParams:(MTRUnitTestingCluster listHolder_2->mList[i_2].a = element_2.a.unsignedCharValue; listHolder_2->mList[i_2].b = element_2.b.boolValue; listHolder_2->mList[i_2].c = static_castmList[i_2].c)>>(element_2.c.unsignedCharValue); - listHolder_2->mList[i_2].d = [self asByteSpan:element_2.d]; - listHolder_2->mList[i_2].e = [self asCharSpan:element_2.e]; + listHolder_2->mList[i_2].d = AsByteSpan(element_2.d); + listHolder_2->mList[i_2].e = AsCharSpan(element_2.e); listHolder_2->mList[i_2].f = static_castmList[i_2].f)>>(element_2.f.unsignedCharValue); listHolder_2->mList[i_2].g = element_2.g.floatValue; listHolder_2->mList[i_2].h = element_2.h.doubleValue; @@ -108504,7 +108506,7 @@ - (void)testListNestedStructListArgumentRequestWithParams:(MTRUnitTestingCluster return CHIP_ERROR_INVALID_ARGUMENT; } auto element_2 = (NSData *) element_0.f[i_2]; - listHolder_2->mList[i_2] = [self asByteSpan:element_2]; + listHolder_2->mList[i_2] = AsByteSpan(element_2); } listHolder_0->mList[i_0].f = ListType_2(listHolder_2->mList, element_0.f.count); } else { @@ -108717,11 +108719,11 @@ - (void)testComplexNullableOptionalRequestWithParams:(MTRUnitTestingClusterTestC request.nullableString.SetNull(); } else { auto & nonNullValue_0 = request.nullableString.SetNonNull(); - nonNullValue_0 = [self asCharSpan:params.nullableString]; + nonNullValue_0 = AsCharSpan(params.nullableString); } if (params.optionalString != nil) { auto & definedValue_0 = request.optionalString.Emplace(); - definedValue_0 = [self asCharSpan:params.optionalString]; + definedValue_0 = AsCharSpan(params.optionalString); } if (params.nullableOptionalString != nil) { auto & definedValue_0 = request.nullableOptionalString.Emplace(); @@ -108729,7 +108731,7 @@ - (void)testComplexNullableOptionalRequestWithParams:(MTRUnitTestingClusterTestC definedValue_0.SetNull(); } else { auto & nonNullValue_1 = definedValue_0.SetNonNull(); - nonNullValue_1 = [self asCharSpan:params.nullableOptionalString]; + nonNullValue_1 = AsCharSpan(params.nullableOptionalString); } } if (params.nullableStruct == nil) { @@ -108739,8 +108741,8 @@ - (void)testComplexNullableOptionalRequestWithParams:(MTRUnitTestingClusterTestC nonNullValue_0.a = params.nullableStruct.a.unsignedCharValue; nonNullValue_0.b = params.nullableStruct.b.boolValue; nonNullValue_0.c = static_cast>(params.nullableStruct.c.unsignedCharValue); - nonNullValue_0.d = [self asByteSpan:params.nullableStruct.d]; - nonNullValue_0.e = [self asCharSpan:params.nullableStruct.e]; + nonNullValue_0.d = AsByteSpan(params.nullableStruct.d); + nonNullValue_0.e = AsCharSpan(params.nullableStruct.e); nonNullValue_0.f = static_cast>(params.nullableStruct.f.unsignedCharValue); nonNullValue_0.g = params.nullableStruct.g.floatValue; nonNullValue_0.h = params.nullableStruct.h.doubleValue; @@ -108750,8 +108752,8 @@ - (void)testComplexNullableOptionalRequestWithParams:(MTRUnitTestingClusterTestC definedValue_0.a = params.optionalStruct.a.unsignedCharValue; definedValue_0.b = params.optionalStruct.b.boolValue; definedValue_0.c = static_cast>(params.optionalStruct.c.unsignedCharValue); - definedValue_0.d = [self asByteSpan:params.optionalStruct.d]; - definedValue_0.e = [self asCharSpan:params.optionalStruct.e]; + definedValue_0.d = AsByteSpan(params.optionalStruct.d); + definedValue_0.e = AsCharSpan(params.optionalStruct.e); definedValue_0.f = static_cast>(params.optionalStruct.f.unsignedCharValue); definedValue_0.g = params.optionalStruct.g.floatValue; definedValue_0.h = params.optionalStruct.h.doubleValue; @@ -108765,8 +108767,8 @@ - (void)testComplexNullableOptionalRequestWithParams:(MTRUnitTestingClusterTestC nonNullValue_1.a = params.nullableOptionalStruct.a.unsignedCharValue; nonNullValue_1.b = params.nullableOptionalStruct.b.boolValue; nonNullValue_1.c = static_cast>(params.nullableOptionalStruct.c.unsignedCharValue); - nonNullValue_1.d = [self asByteSpan:params.nullableOptionalStruct.d]; - nonNullValue_1.e = [self asCharSpan:params.nullableOptionalStruct.e]; + nonNullValue_1.d = AsByteSpan(params.nullableOptionalStruct.d); + nonNullValue_1.e = AsCharSpan(params.nullableOptionalStruct.e); nonNullValue_1.f = static_cast>(params.nullableOptionalStruct.f.unsignedCharValue); nonNullValue_1.g = params.nullableOptionalStruct.g.floatValue; nonNullValue_1.h = params.nullableOptionalStruct.h.doubleValue; @@ -108887,8 +108889,8 @@ - (void)simpleStructEchoRequestWithParams:(MTRUnitTestingClusterSimpleStructEcho request.arg1.a = params.arg1.a.unsignedCharValue; request.arg1.b = params.arg1.b.boolValue; request.arg1.c = static_cast>(params.arg1.c.unsignedCharValue); - request.arg1.d = [self asByteSpan:params.arg1.d]; - request.arg1.e = [self asCharSpan:params.arg1.e]; + request.arg1.d = AsByteSpan(params.arg1.d); + request.arg1.e = AsCharSpan(params.arg1.e); request.arg1.f = static_cast>(params.arg1.f.unsignedCharValue); request.arg1.g = params.arg1.g.floatValue; request.arg1.h = params.arg1.h.doubleValue; @@ -110876,7 +110878,7 @@ - (void)writeAttributeOctetStringWithValue:(NSData * _Nonnull)value params:(MTRW ListFreer listFreer; using TypeInfo = UnitTesting::Attributes::OctetString::TypeInfo; TypeInfo::Type cppValue; - cppValue = [self asByteSpan:value]; + cppValue = AsByteSpan(value); chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); @@ -111056,7 +111058,7 @@ - (void)writeAttributeListOctetStringWithValue:(NSArray * _Nonnull)value params: return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (NSData *) value[i_0]; - listHolder_0->mList[i_0] = [self asByteSpan:element_0]; + listHolder_0->mList[i_0] = AsByteSpan(element_0); } cppValue = ListType_0(listHolder_0->mList, value.count); } else { @@ -111150,7 +111152,7 @@ - (void)writeAttributeListStructOctetStringWithValue:(NSArray * _Nonnull)value p } auto element_0 = (MTRUnitTestingClusterTestListStructOctet *) value[i_0]; listHolder_0->mList[i_0].member1 = element_0.member1.unsignedLongLongValue; - listHolder_0->mList[i_0].member2 = [self asByteSpan:element_0.member2]; + listHolder_0->mList[i_0].member2 = AsByteSpan(element_0.member2); } cppValue = ListType_0(listHolder_0->mList, value.count); } else { @@ -111228,7 +111230,7 @@ - (void)writeAttributeLongOctetStringWithValue:(NSData * _Nonnull)value params:( ListFreer listFreer; using TypeInfo = UnitTesting::Attributes::LongOctetString::TypeInfo; TypeInfo::Type cppValue; - cppValue = [self asByteSpan:value]; + cppValue = AsByteSpan(value); chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); @@ -111300,7 +111302,7 @@ - (void)writeAttributeCharStringWithValue:(NSString * _Nonnull)value params:(MTR ListFreer listFreer; using TypeInfo = UnitTesting::Attributes::CharString::TypeInfo; TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; + cppValue = AsCharSpan(value); chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); @@ -111372,7 +111374,7 @@ - (void)writeAttributeLongCharStringWithValue:(NSString * _Nonnull)value params: ListFreer listFreer; using TypeInfo = UnitTesting::Attributes::LongCharString::TypeInfo; TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; + cppValue = AsCharSpan(value); chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); @@ -111698,11 +111700,11 @@ - (void)writeAttributeListNullablesAndOptionalsStructWithValue:(NSArray * _Nonnu listHolder_0->mList[i_0].nullableString.SetNull(); } else { auto & nonNullValue_2 = listHolder_0->mList[i_0].nullableString.SetNonNull(); - nonNullValue_2 = [self asCharSpan:element_0.nullableString]; + nonNullValue_2 = AsCharSpan(element_0.nullableString); } if (element_0.optionalString != nil) { auto & definedValue_2 = listHolder_0->mList[i_0].optionalString.Emplace(); - definedValue_2 = [self asCharSpan:element_0.optionalString]; + definedValue_2 = AsCharSpan(element_0.optionalString); } if (element_0.nullableOptionalString != nil) { auto & definedValue_2 = listHolder_0->mList[i_0].nullableOptionalString.Emplace(); @@ -111710,7 +111712,7 @@ - (void)writeAttributeListNullablesAndOptionalsStructWithValue:(NSArray * _Nonnu definedValue_2.SetNull(); } else { auto & nonNullValue_3 = definedValue_2.SetNonNull(); - nonNullValue_3 = [self asCharSpan:element_0.nullableOptionalString]; + nonNullValue_3 = AsCharSpan(element_0.nullableOptionalString); } } if (element_0.nullableStruct == nil) { @@ -111720,8 +111722,8 @@ - (void)writeAttributeListNullablesAndOptionalsStructWithValue:(NSArray * _Nonnu nonNullValue_2.a = element_0.nullableStruct.a.unsignedCharValue; nonNullValue_2.b = element_0.nullableStruct.b.boolValue; nonNullValue_2.c = static_cast>(element_0.nullableStruct.c.unsignedCharValue); - nonNullValue_2.d = [self asByteSpan:element_0.nullableStruct.d]; - nonNullValue_2.e = [self asCharSpan:element_0.nullableStruct.e]; + nonNullValue_2.d = AsByteSpan(element_0.nullableStruct.d); + nonNullValue_2.e = AsCharSpan(element_0.nullableStruct.e); nonNullValue_2.f = static_cast>(element_0.nullableStruct.f.unsignedCharValue); nonNullValue_2.g = element_0.nullableStruct.g.floatValue; nonNullValue_2.h = element_0.nullableStruct.h.doubleValue; @@ -111731,8 +111733,8 @@ - (void)writeAttributeListNullablesAndOptionalsStructWithValue:(NSArray * _Nonnu definedValue_2.a = element_0.optionalStruct.a.unsignedCharValue; definedValue_2.b = element_0.optionalStruct.b.boolValue; definedValue_2.c = static_cast>(element_0.optionalStruct.c.unsignedCharValue); - definedValue_2.d = [self asByteSpan:element_0.optionalStruct.d]; - definedValue_2.e = [self asCharSpan:element_0.optionalStruct.e]; + definedValue_2.d = AsByteSpan(element_0.optionalStruct.d); + definedValue_2.e = AsCharSpan(element_0.optionalStruct.e); definedValue_2.f = static_cast>(element_0.optionalStruct.f.unsignedCharValue); definedValue_2.g = element_0.optionalStruct.g.floatValue; definedValue_2.h = element_0.optionalStruct.h.doubleValue; @@ -111746,8 +111748,8 @@ - (void)writeAttributeListNullablesAndOptionalsStructWithValue:(NSArray * _Nonnu nonNullValue_3.a = element_0.nullableOptionalStruct.a.unsignedCharValue; nonNullValue_3.b = element_0.nullableOptionalStruct.b.boolValue; nonNullValue_3.c = static_cast>(element_0.nullableOptionalStruct.c.unsignedCharValue); - nonNullValue_3.d = [self asByteSpan:element_0.nullableOptionalStruct.d]; - nonNullValue_3.e = [self asCharSpan:element_0.nullableOptionalStruct.e]; + nonNullValue_3.d = AsByteSpan(element_0.nullableOptionalStruct.d); + nonNullValue_3.e = AsCharSpan(element_0.nullableOptionalStruct.e); nonNullValue_3.f = static_cast>(element_0.nullableOptionalStruct.f.unsignedCharValue); nonNullValue_3.g = element_0.nullableOptionalStruct.g.floatValue; nonNullValue_3.h = element_0.nullableOptionalStruct.h.doubleValue; @@ -111987,8 +111989,8 @@ - (void)writeAttributeStructAttrWithValue:(MTRUnitTestingClusterSimpleStruct * _ cppValue.a = value.a.unsignedCharValue; cppValue.b = value.b.boolValue; cppValue.c = static_cast>(value.c.unsignedCharValue); - cppValue.d = [self asByteSpan:value.d]; - cppValue.e = [self asCharSpan:value.e]; + cppValue.d = AsByteSpan(value.d); + cppValue.e = AsCharSpan(value.e); cppValue.f = static_cast>(value.f.unsignedCharValue); cppValue.g = value.g.floatValue; cppValue.h = value.h.doubleValue; @@ -112366,7 +112368,7 @@ - (void)writeAttributeListLongOctetStringWithValue:(NSArray * _Nonnull)value par return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (NSData *) value[i_0]; - listHolder_0->mList[i_0] = [self asByteSpan:element_0]; + listHolder_0->mList[i_0] = AsByteSpan(element_0); } cppValue = ListType_0(listHolder_0->mList, value.count); } else { @@ -112479,12 +112481,12 @@ - (void)writeAttributeListFabricScopedWithValue:(NSArray * _Nonnull)value params nonNullValue_3 = element_0.nullableOptionalFabricSensitiveInt8u.unsignedCharValue; } } - listHolder_0->mList[i_0].fabricSensitiveCharString = [self asCharSpan:element_0.fabricSensitiveCharString]; + listHolder_0->mList[i_0].fabricSensitiveCharString = AsCharSpan(element_0.fabricSensitiveCharString); listHolder_0->mList[i_0].fabricSensitiveStruct.a = element_0.fabricSensitiveStruct.a.unsignedCharValue; listHolder_0->mList[i_0].fabricSensitiveStruct.b = element_0.fabricSensitiveStruct.b.boolValue; listHolder_0->mList[i_0].fabricSensitiveStruct.c = static_castmList[i_0].fabricSensitiveStruct.c)>>(element_0.fabricSensitiveStruct.c.unsignedCharValue); - listHolder_0->mList[i_0].fabricSensitiveStruct.d = [self asByteSpan:element_0.fabricSensitiveStruct.d]; - listHolder_0->mList[i_0].fabricSensitiveStruct.e = [self asCharSpan:element_0.fabricSensitiveStruct.e]; + listHolder_0->mList[i_0].fabricSensitiveStruct.d = AsByteSpan(element_0.fabricSensitiveStruct.d); + listHolder_0->mList[i_0].fabricSensitiveStruct.e = AsCharSpan(element_0.fabricSensitiveStruct.e); listHolder_0->mList[i_0].fabricSensitiveStruct.f = static_castmList[i_0].fabricSensitiveStruct.f)>>(element_0.fabricSensitiveStruct.f.unsignedCharValue); listHolder_0->mList[i_0].fabricSensitiveStruct.g = element_0.fabricSensitiveStruct.g.floatValue; listHolder_0->mList[i_0].fabricSensitiveStruct.h = element_0.fabricSensitiveStruct.h.doubleValue; @@ -114805,7 +114807,7 @@ - (void)writeAttributeNullableOctetStringWithValue:(NSData * _Nullable)value par cppValue.SetNull(); } else { auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = [self asByteSpan:value]; + nonNullValue_0 = AsByteSpan(value); } chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); @@ -114882,7 +114884,7 @@ - (void)writeAttributeNullableCharStringWithValue:(NSString * _Nullable)value pa cppValue.SetNull(); } else { auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = [self asCharSpan:value]; + nonNullValue_0 = AsCharSpan(value); } chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); @@ -115039,8 +115041,8 @@ - (void)writeAttributeNullableStructWithValue:(MTRUnitTestingClusterSimpleStruct nonNullValue_0.a = value.a.unsignedCharValue; nonNullValue_0.b = value.b.boolValue; nonNullValue_0.c = static_cast>(value.c.unsignedCharValue); - nonNullValue_0.d = [self asByteSpan:value.d]; - nonNullValue_0.e = [self asCharSpan:value.e]; + nonNullValue_0.d = AsByteSpan(value.d); + nonNullValue_0.e = AsCharSpan(value.e); nonNullValue_0.f = static_cast>(value.f.unsignedCharValue); nonNullValue_0.g = value.g.floatValue; nonNullValue_0.h = value.h.doubleValue; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 7fdbe9367c7ece..cc99b43359f5f3 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -16,12 +16,8 @@ */ #import -#import +#import -#import "MTRAsyncWorkQueue.h" -#import "MTRBaseClusterUtils.h" -#import "MTRBaseDevice_Internal.h" -#import "MTRCallbackBridge.h" #import "MTRClusterConstants.h" #import "MTRCluster_Internal.h" #import "MTRClusters_Internal.h" @@ -30,7 +26,6 @@ #import "MTRLogging_Internal.h" #import "MTRStructsObjc.h" -#include #include #include @@ -43,24 +38,6 @@ using chip::System::Clock::Seconds16; using chip::System::Clock::Timeout; -static void MTRClustersLogEnqueue(NSString * logPrefix, MTRAsyncWorkQueue * workQueue) -{ - MTR_LOG_DEFAULT("%@ enqueueWorkItem %@", logPrefix, workQueue); -} - -static void MTRClustersLogDequeue(NSString * logPrefix, MTRAsyncWorkQueue * workQueue) -{ - MTR_LOG_DEFAULT("%@ dequeueWorkItem %@", logPrefix, workQueue); -} - -static void MTRClustersLogCompletion(NSString * logPrefix, id value, NSError * error) -{ - // Log the data at the INFO level (not usually persisted permanently), - // but make sure we log the work completion at the DEFAULT level. - MTR_LOG_INFO("%@ received response: %@ error: %@", logPrefix, value, error); - MTR_LOG_DEFAULT("%@ endWork", logPrefix); -} - // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks): Linter is unable to locate the delete on these objects. @implementation MTRClusterIdentify @@ -78,72 +55,54 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)identifyWithParams:(MTRIdentifyClusterIdentifyParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeIdentifyID, (unsigned int) MTRCommandIDTypeClusterIdentifyCommandIdentifyID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterIdentify - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster identifyWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRIdentifyClusterIdentifyParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeIdentifyID) + commandID:@(MTRCommandIDTypeClusterIdentifyCommandIdentifyID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)triggerEffectWithParams:(MTRIdentifyClusterTriggerEffectParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeIdentifyID, (unsigned int) MTRCommandIDTypeClusterIdentifyCommandTriggerEffectID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterIdentify - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster triggerEffectWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRIdentifyClusterTriggerEffectParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeIdentifyID) + commandID:@(MTRCommandIDTypeClusterIdentifyCommandTriggerEffectID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeIdentifyTimeWithParams:(MTRReadParams * _Nullable)params @@ -234,142 +193,106 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)addGroupWithParams:(MTRGroupsClusterAddGroupParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRGroupsClusterAddGroupResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeGroupsID, (unsigned int) MTRCommandIDTypeClusterGroupsCommandAddGroupID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterGroups - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster addGroupWithParams:params completion: - ^(MTRGroupsClusterAddGroupResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRGroupsClusterAddGroupParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeGroupsID) + commandID:@(MTRCommandIDTypeClusterGroupsCommandAddGroupID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRGroupsClusterAddGroupResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)viewGroupWithParams:(MTRGroupsClusterViewGroupParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRGroupsClusterViewGroupResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeGroupsID, (unsigned int) MTRCommandIDTypeClusterGroupsCommandViewGroupID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterGroups - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster viewGroupWithParams:params completion: - ^(MTRGroupsClusterViewGroupResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRGroupsClusterViewGroupParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeGroupsID) + commandID:@(MTRCommandIDTypeClusterGroupsCommandViewGroupID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRGroupsClusterViewGroupResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)getGroupMembershipWithParams:(MTRGroupsClusterGetGroupMembershipParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRGroupsClusterGetGroupMembershipResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeGroupsID, (unsigned int) MTRCommandIDTypeClusterGroupsCommandGetGroupMembershipID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterGroups - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster getGroupMembershipWithParams:params completion: - ^(MTRGroupsClusterGetGroupMembershipResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRGroupsClusterGetGroupMembershipParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeGroupsID) + commandID:@(MTRCommandIDTypeClusterGroupsCommandGetGroupMembershipID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRGroupsClusterGetGroupMembershipResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)removeGroupWithParams:(MTRGroupsClusterRemoveGroupParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRGroupsClusterRemoveGroupResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeGroupsID, (unsigned int) MTRCommandIDTypeClusterGroupsCommandRemoveGroupID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterGroups - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster removeGroupWithParams:params completion: - ^(MTRGroupsClusterRemoveGroupResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRGroupsClusterRemoveGroupParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeGroupsID) + commandID:@(MTRCommandIDTypeClusterGroupsCommandRemoveGroupID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRGroupsClusterRemoveGroupResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)removeAllGroupsWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion @@ -378,72 +301,54 @@ - (void)removeAllGroupsWithExpectedValues:(NSArray } - (void)removeAllGroupsWithParams:(MTRGroupsClusterRemoveAllGroupsParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeGroupsID, (unsigned int) MTRCommandIDTypeClusterGroupsCommandRemoveAllGroupsID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterGroups - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster removeAllGroupsWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRGroupsClusterRemoveAllGroupsParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeGroupsID) + commandID:@(MTRCommandIDTypeClusterGroupsCommandRemoveAllGroupsID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)addGroupIfIdentifyingWithParams:(MTRGroupsClusterAddGroupIfIdentifyingParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeGroupsID, (unsigned int) MTRCommandIDTypeClusterGroupsCommandAddGroupIfIdentifyingID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterGroups - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster addGroupIfIdentifyingWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRGroupsClusterAddGroupIfIdentifyingParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeGroupsID) + commandID:@(MTRCommandIDTypeClusterGroupsCommandAddGroupIfIdentifyingID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeNameSupportWithParams:(MTRReadParams * _Nullable)params @@ -554,352 +459,262 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)addSceneWithParams:(MTRScenesClusterAddSceneParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRScenesClusterAddSceneResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandAddSceneID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterScenes - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster addSceneWithParams:params completion: - ^(MTRScenesClusterAddSceneResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRScenesClusterAddSceneParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeScenesID) + commandID:@(MTRCommandIDTypeClusterScenesCommandAddSceneID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRScenesClusterAddSceneResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)viewSceneWithParams:(MTRScenesClusterViewSceneParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRScenesClusterViewSceneResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandViewSceneID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterScenes - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster viewSceneWithParams:params completion: - ^(MTRScenesClusterViewSceneResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRScenesClusterViewSceneParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeScenesID) + commandID:@(MTRCommandIDTypeClusterScenesCommandViewSceneID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRScenesClusterViewSceneResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)removeSceneWithParams:(MTRScenesClusterRemoveSceneParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRScenesClusterRemoveSceneResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandRemoveSceneID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterScenes - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster removeSceneWithParams:params completion: - ^(MTRScenesClusterRemoveSceneResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRScenesClusterRemoveSceneParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeScenesID) + commandID:@(MTRCommandIDTypeClusterScenesCommandRemoveSceneID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRScenesClusterRemoveSceneResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)removeAllScenesWithParams:(MTRScenesClusterRemoveAllScenesParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRScenesClusterRemoveAllScenesResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandRemoveAllScenesID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterScenes - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster removeAllScenesWithParams:params completion: - ^(MTRScenesClusterRemoveAllScenesResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRScenesClusterRemoveAllScenesParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeScenesID) + commandID:@(MTRCommandIDTypeClusterScenesCommandRemoveAllScenesID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRScenesClusterRemoveAllScenesResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)storeSceneWithParams:(MTRScenesClusterStoreSceneParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRScenesClusterStoreSceneResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandStoreSceneID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterScenes - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster storeSceneWithParams:params completion: - ^(MTRScenesClusterStoreSceneResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRScenesClusterStoreSceneParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeScenesID) + commandID:@(MTRCommandIDTypeClusterScenesCommandStoreSceneID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRScenesClusterStoreSceneResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)recallSceneWithParams:(MTRScenesClusterRecallSceneParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandRecallSceneID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterScenes - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster recallSceneWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRScenesClusterRecallSceneParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeScenesID) + commandID:@(MTRCommandIDTypeClusterScenesCommandRecallSceneID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)getSceneMembershipWithParams:(MTRScenesClusterGetSceneMembershipParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRScenesClusterGetSceneMembershipResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandGetSceneMembershipID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterScenes - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster getSceneMembershipWithParams:params completion: - ^(MTRScenesClusterGetSceneMembershipResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRScenesClusterGetSceneMembershipParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeScenesID) + commandID:@(MTRCommandIDTypeClusterScenesCommandGetSceneMembershipID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRScenesClusterGetSceneMembershipResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)enhancedAddSceneWithParams:(MTRScenesClusterEnhancedAddSceneParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRScenesClusterEnhancedAddSceneResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandEnhancedAddSceneID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterScenes - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster enhancedAddSceneWithParams:params completion: - ^(MTRScenesClusterEnhancedAddSceneResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRScenesClusterEnhancedAddSceneParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeScenesID) + commandID:@(MTRCommandIDTypeClusterScenesCommandEnhancedAddSceneID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRScenesClusterEnhancedAddSceneResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)enhancedViewSceneWithParams:(MTRScenesClusterEnhancedViewSceneParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRScenesClusterEnhancedViewSceneResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandEnhancedViewSceneID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterScenes - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster enhancedViewSceneWithParams:params completion: - ^(MTRScenesClusterEnhancedViewSceneResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRScenesClusterEnhancedViewSceneParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeScenesID) + commandID:@(MTRCommandIDTypeClusterScenesCommandEnhancedViewSceneID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRScenesClusterEnhancedViewSceneResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)copySceneWithParams:(MTRScenesClusterCopySceneParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRScenesClusterCopySceneResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandCopySceneID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterScenes - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster copySceneWithParams:params completion: - ^(MTRScenesClusterCopySceneResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRScenesClusterCopySceneParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeScenesID) + commandID:@(MTRCommandIDTypeClusterScenesCommandCopySceneID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRScenesClusterCopySceneResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeSceneCountWithParams:(MTRReadParams * _Nullable)params @@ -1080,37 +895,28 @@ - (void)offWithExpectedValues:(NSArray *> *)expecte } - (void)offWithParams:(MTROnOffClusterOffParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOnOffID, (unsigned int) MTRCommandIDTypeClusterOnOffCommandOffID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOnOff - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster offWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROnOffClusterOffParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOnOffID) + commandID:@(MTRCommandIDTypeClusterOnOffCommandOffID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)onWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion @@ -1119,37 +925,28 @@ - (void)onWithExpectedValues:(NSArray *> *)expected } - (void)onWithParams:(MTROnOffClusterOnParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOnOffID, (unsigned int) MTRCommandIDTypeClusterOnOffCommandOnID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOnOff - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster onWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROnOffClusterOnParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOnOffID) + commandID:@(MTRCommandIDTypeClusterOnOffCommandOnID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)toggleWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion @@ -1158,72 +955,54 @@ - (void)toggleWithExpectedValues:(NSArray *> *)expe } - (void)toggleWithParams:(MTROnOffClusterToggleParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOnOffID, (unsigned int) MTRCommandIDTypeClusterOnOffCommandToggleID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOnOff - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster toggleWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROnOffClusterToggleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOnOffID) + commandID:@(MTRCommandIDTypeClusterOnOffCommandToggleID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)offWithEffectWithParams:(MTROnOffClusterOffWithEffectParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOnOffID, (unsigned int) MTRCommandIDTypeClusterOnOffCommandOffWithEffectID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOnOff - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster offWithEffectWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROnOffClusterOffWithEffectParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOnOffID) + commandID:@(MTRCommandIDTypeClusterOnOffCommandOffWithEffectID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)onWithRecallGlobalSceneWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion @@ -1232,72 +1011,54 @@ - (void)onWithRecallGlobalSceneWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOnOffID, (unsigned int) MTRCommandIDTypeClusterOnOffCommandOnWithRecallGlobalSceneID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOnOff - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster onWithRecallGlobalSceneWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROnOffClusterOnWithRecallGlobalSceneParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOnOffID) + commandID:@(MTRCommandIDTypeClusterOnOffCommandOnWithRecallGlobalSceneID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)onWithTimedOffWithParams:(MTROnOffClusterOnWithTimedOffParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOnOffID, (unsigned int) MTRCommandIDTypeClusterOnOffCommandOnWithTimedOffID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOnOff - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster onWithTimedOffWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROnOffClusterOnWithTimedOffParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOnOffID) + commandID:@(MTRCommandIDTypeClusterOnOffCommandOnWithTimedOffID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeOnOffWithParams:(MTRReadParams * _Nullable)params @@ -1537,317 +1298,236 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)moveToLevelWithParams:(MTRLevelControlClusterMoveToLevelParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeLevelControlID, (unsigned int) MTRCommandIDTypeClusterLevelControlCommandMoveToLevelID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterLevelControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster moveToLevelWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRLevelControlClusterMoveToLevelParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeLevelControlID) + commandID:@(MTRCommandIDTypeClusterLevelControlCommandMoveToLevelID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)moveWithParams:(MTRLevelControlClusterMoveParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeLevelControlID, (unsigned int) MTRCommandIDTypeClusterLevelControlCommandMoveID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterLevelControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster moveWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRLevelControlClusterMoveParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeLevelControlID) + commandID:@(MTRCommandIDTypeClusterLevelControlCommandMoveID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)stepWithParams:(MTRLevelControlClusterStepParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeLevelControlID, (unsigned int) MTRCommandIDTypeClusterLevelControlCommandStepID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterLevelControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster stepWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRLevelControlClusterStepParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeLevelControlID) + commandID:@(MTRCommandIDTypeClusterLevelControlCommandStepID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)stopWithParams:(MTRLevelControlClusterStopParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeLevelControlID, (unsigned int) MTRCommandIDTypeClusterLevelControlCommandStopID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterLevelControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster stopWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRLevelControlClusterStopParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeLevelControlID) + commandID:@(MTRCommandIDTypeClusterLevelControlCommandStopID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)moveToLevelWithOnOffWithParams:(MTRLevelControlClusterMoveToLevelWithOnOffParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeLevelControlID, (unsigned int) MTRCommandIDTypeClusterLevelControlCommandMoveToLevelWithOnOffID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterLevelControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster moveToLevelWithOnOffWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRLevelControlClusterMoveToLevelWithOnOffParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeLevelControlID) + commandID:@(MTRCommandIDTypeClusterLevelControlCommandMoveToLevelWithOnOffID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)moveWithOnOffWithParams:(MTRLevelControlClusterMoveWithOnOffParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeLevelControlID, (unsigned int) MTRCommandIDTypeClusterLevelControlCommandMoveWithOnOffID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterLevelControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster moveWithOnOffWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRLevelControlClusterMoveWithOnOffParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeLevelControlID) + commandID:@(MTRCommandIDTypeClusterLevelControlCommandMoveWithOnOffID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)stepWithOnOffWithParams:(MTRLevelControlClusterStepWithOnOffParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeLevelControlID, (unsigned int) MTRCommandIDTypeClusterLevelControlCommandStepWithOnOffID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterLevelControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster stepWithOnOffWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRLevelControlClusterStepWithOnOffParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeLevelControlID) + commandID:@(MTRCommandIDTypeClusterLevelControlCommandStepWithOnOffID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)stopWithOnOffWithParams:(MTRLevelControlClusterStopWithOnOffParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeLevelControlID, (unsigned int) MTRCommandIDTypeClusterLevelControlCommandStopWithOnOffID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterLevelControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster stopWithOnOffWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRLevelControlClusterStopWithOnOffParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeLevelControlID) + commandID:@(MTRCommandIDTypeClusterLevelControlCommandStopWithOnOffID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)moveToClosestFrequencyWithParams:(MTRLevelControlClusterMoveToClosestFrequencyParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeLevelControlID, (unsigned int) MTRCommandIDTypeClusterLevelControlCommandMoveToClosestFrequencyID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterLevelControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster moveToClosestFrequencyWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRLevelControlClusterMoveToClosestFrequencyParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeLevelControlID) + commandID:@(MTRCommandIDTypeClusterLevelControlCommandMoveToClosestFrequencyID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeCurrentLevelWithParams:(MTRReadParams * _Nullable)params @@ -2580,422 +2260,314 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)instantActionWithParams:(MTRActionsClusterInstantActionParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeActionsID, (unsigned int) MTRCommandIDTypeClusterActionsCommandInstantActionID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterActions - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster instantActionWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRActionsClusterInstantActionParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeActionsID) + commandID:@(MTRCommandIDTypeClusterActionsCommandInstantActionID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)instantActionWithTransitionWithParams:(MTRActionsClusterInstantActionWithTransitionParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeActionsID, (unsigned int) MTRCommandIDTypeClusterActionsCommandInstantActionWithTransitionID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterActions - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster instantActionWithTransitionWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRActionsClusterInstantActionWithTransitionParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeActionsID) + commandID:@(MTRCommandIDTypeClusterActionsCommandInstantActionWithTransitionID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)startActionWithParams:(MTRActionsClusterStartActionParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeActionsID, (unsigned int) MTRCommandIDTypeClusterActionsCommandStartActionID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterActions - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster startActionWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRActionsClusterStartActionParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeActionsID) + commandID:@(MTRCommandIDTypeClusterActionsCommandStartActionID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)startActionWithDurationWithParams:(MTRActionsClusterStartActionWithDurationParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeActionsID, (unsigned int) MTRCommandIDTypeClusterActionsCommandStartActionWithDurationID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterActions - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster startActionWithDurationWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRActionsClusterStartActionWithDurationParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeActionsID) + commandID:@(MTRCommandIDTypeClusterActionsCommandStartActionWithDurationID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)stopActionWithParams:(MTRActionsClusterStopActionParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeActionsID, (unsigned int) MTRCommandIDTypeClusterActionsCommandStopActionID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterActions - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster stopActionWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRActionsClusterStopActionParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeActionsID) + commandID:@(MTRCommandIDTypeClusterActionsCommandStopActionID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)pauseActionWithParams:(MTRActionsClusterPauseActionParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeActionsID, (unsigned int) MTRCommandIDTypeClusterActionsCommandPauseActionID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterActions - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster pauseActionWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRActionsClusterPauseActionParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeActionsID) + commandID:@(MTRCommandIDTypeClusterActionsCommandPauseActionID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)pauseActionWithDurationWithParams:(MTRActionsClusterPauseActionWithDurationParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeActionsID, (unsigned int) MTRCommandIDTypeClusterActionsCommandPauseActionWithDurationID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterActions - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster pauseActionWithDurationWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRActionsClusterPauseActionWithDurationParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeActionsID) + commandID:@(MTRCommandIDTypeClusterActionsCommandPauseActionWithDurationID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)resumeActionWithParams:(MTRActionsClusterResumeActionParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeActionsID, (unsigned int) MTRCommandIDTypeClusterActionsCommandResumeActionID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterActions - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster resumeActionWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRActionsClusterResumeActionParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeActionsID) + commandID:@(MTRCommandIDTypeClusterActionsCommandResumeActionID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)enableActionWithParams:(MTRActionsClusterEnableActionParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeActionsID, (unsigned int) MTRCommandIDTypeClusterActionsCommandEnableActionID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterActions - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster enableActionWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRActionsClusterEnableActionParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeActionsID) + commandID:@(MTRCommandIDTypeClusterActionsCommandEnableActionID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)enableActionWithDurationWithParams:(MTRActionsClusterEnableActionWithDurationParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeActionsID, (unsigned int) MTRCommandIDTypeClusterActionsCommandEnableActionWithDurationID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterActions - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster enableActionWithDurationWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRActionsClusterEnableActionWithDurationParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeActionsID) + commandID:@(MTRCommandIDTypeClusterActionsCommandEnableActionWithDurationID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)disableActionWithParams:(MTRActionsClusterDisableActionParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeActionsID, (unsigned int) MTRCommandIDTypeClusterActionsCommandDisableActionID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterActions - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster disableActionWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRActionsClusterDisableActionParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeActionsID) + commandID:@(MTRCommandIDTypeClusterActionsCommandDisableActionID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)disableActionWithDurationWithParams:(MTRActionsClusterDisableActionWithDurationParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeActionsID, (unsigned int) MTRCommandIDTypeClusterActionsCommandDisableActionWithDurationID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterActions - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster disableActionWithDurationWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRActionsClusterDisableActionWithDurationParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeActionsID) + commandID:@(MTRCommandIDTypeClusterActionsCommandDisableActionWithDurationID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeActionListWithParams:(MTRReadParams * _Nullable)params @@ -3134,37 +2706,28 @@ - (void)mfgSpecificPingWithExpectedValues:(NSArray } - (void)mfgSpecificPingWithParams:(MTRBasicClusterMfgSpecificPingParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) 0x00000028, (unsigned int) 0x10020000]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterBasic - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster mfgSpecificPingWithParams:params completionHandler: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRBasicClusterMfgSpecificPingParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(0x00000028) + commandID:@(0x10020000) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeDataModelRevisionWithParams:(MTRReadParams * _Nullable)params @@ -3373,107 +2936,80 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)queryImageWithParams:(MTROTASoftwareUpdateProviderClusterQueryImageParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTROTASoftwareUpdateProviderClusterQueryImageResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOTASoftwareUpdateProviderID, (unsigned int) MTRCommandIDTypeClusterOTASoftwareUpdateProviderCommandQueryImageID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster queryImageWithParams:params completion: - ^(MTROTASoftwareUpdateProviderClusterQueryImageResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROTASoftwareUpdateProviderClusterQueryImageParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOTASoftwareUpdateProviderID) + commandID:@(MTRCommandIDTypeClusterOTASoftwareUpdateProviderCommandQueryImageID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTROTASoftwareUpdateProviderClusterQueryImageResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)applyUpdateRequestWithParams:(MTROTASoftwareUpdateProviderClusterApplyUpdateRequestParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTROTASoftwareUpdateProviderClusterApplyUpdateResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOTASoftwareUpdateProviderID, (unsigned int) MTRCommandIDTypeClusterOTASoftwareUpdateProviderCommandApplyUpdateRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster applyUpdateRequestWithParams:params completion: - ^(MTROTASoftwareUpdateProviderClusterApplyUpdateResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROTASoftwareUpdateProviderClusterApplyUpdateRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOTASoftwareUpdateProviderID) + commandID:@(MTRCommandIDTypeClusterOTASoftwareUpdateProviderCommandApplyUpdateRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTROTASoftwareUpdateProviderClusterApplyUpdateResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)notifyUpdateAppliedWithParams:(MTROTASoftwareUpdateProviderClusterNotifyUpdateAppliedParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOTASoftwareUpdateProviderID, (unsigned int) MTRCommandIDTypeClusterOTASoftwareUpdateProviderCommandNotifyUpdateAppliedID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster notifyUpdateAppliedWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROTASoftwareUpdateProviderClusterNotifyUpdateAppliedParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOTASoftwareUpdateProviderID) + commandID:@(MTRCommandIDTypeClusterOTASoftwareUpdateProviderCommandNotifyUpdateAppliedID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params @@ -3556,37 +3092,28 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)announceOTAProviderWithParams:(MTROTASoftwareUpdateRequestorClusterAnnounceOTAProviderParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOTASoftwareUpdateRequestorID, (unsigned int) MTRCommandIDTypeClusterOTASoftwareUpdateRequestorCommandAnnounceOTAProviderID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster announceOTAProviderWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROTASoftwareUpdateRequestorClusterAnnounceOTAProviderParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOTASoftwareUpdateRequestorID) + commandID:@(MTRCommandIDTypeClusterOTASoftwareUpdateRequestorCommandAnnounceOTAProviderID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeDefaultOTAProvidersWithParams:(MTRReadParams * _Nullable)params @@ -4210,72 +3737,54 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)armFailSafeWithParams:(MTRGeneralCommissioningClusterArmFailSafeParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRGeneralCommissioningClusterArmFailSafeResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeGeneralCommissioningID, (unsigned int) MTRCommandIDTypeClusterGeneralCommissioningCommandArmFailSafeID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterGeneralCommissioning - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster armFailSafeWithParams:params completion: - ^(MTRGeneralCommissioningClusterArmFailSafeResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRGeneralCommissioningClusterArmFailSafeParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeGeneralCommissioningID) + commandID:@(MTRCommandIDTypeClusterGeneralCommissioningCommandArmFailSafeID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRGeneralCommissioningClusterArmFailSafeResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)setRegulatoryConfigWithParams:(MTRGeneralCommissioningClusterSetRegulatoryConfigParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRGeneralCommissioningClusterSetRegulatoryConfigResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeGeneralCommissioningID, (unsigned int) MTRCommandIDTypeClusterGeneralCommissioningCommandSetRegulatoryConfigID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterGeneralCommissioning - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster setRegulatoryConfigWithParams:params completion: - ^(MTRGeneralCommissioningClusterSetRegulatoryConfigResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRGeneralCommissioningClusterSetRegulatoryConfigParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeGeneralCommissioningID) + commandID:@(MTRCommandIDTypeClusterGeneralCommissioningCommandSetRegulatoryConfigID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRGeneralCommissioningClusterSetRegulatoryConfigResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)commissioningCompleteWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRGeneralCommissioningClusterCommissioningCompleteResponseParams * _Nullable data, NSError * _Nullable error))completion @@ -4284,37 +3793,28 @@ - (void)commissioningCompleteWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRGeneralCommissioningClusterCommissioningCompleteResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeGeneralCommissioningID, (unsigned int) MTRCommandIDTypeClusterGeneralCommissioningCommandCommissioningCompleteID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterGeneralCommissioning - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster commissioningCompleteWithParams:params completion: - ^(MTRGeneralCommissioningClusterCommissioningCompleteResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRGeneralCommissioningClusterCommissioningCompleteParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeGeneralCommissioningID) + commandID:@(MTRCommandIDTypeClusterGeneralCommissioningCommandCommissioningCompleteID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRGeneralCommissioningClusterCommissioningCompleteResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeBreadcrumbWithParams:(MTRReadParams * _Nullable)params @@ -4438,212 +3938,158 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)scanNetworksWithParams:(MTRNetworkCommissioningClusterScanNetworksParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRNetworkCommissioningClusterScanNetworksResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeNetworkCommissioningID, (unsigned int) MTRCommandIDTypeClusterNetworkCommissioningCommandScanNetworksID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterNetworkCommissioning - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster scanNetworksWithParams:params completion: - ^(MTRNetworkCommissioningClusterScanNetworksResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRNetworkCommissioningClusterScanNetworksParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeNetworkCommissioningID) + commandID:@(MTRCommandIDTypeClusterNetworkCommissioningCommandScanNetworksID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRNetworkCommissioningClusterScanNetworksResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)addOrUpdateWiFiNetworkWithParams:(MTRNetworkCommissioningClusterAddOrUpdateWiFiNetworkParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeNetworkCommissioningID, (unsigned int) MTRCommandIDTypeClusterNetworkCommissioningCommandAddOrUpdateWiFiNetworkID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterNetworkCommissioning - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster addOrUpdateWiFiNetworkWithParams:params completion: - ^(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRNetworkCommissioningClusterAddOrUpdateWiFiNetworkParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeNetworkCommissioningID) + commandID:@(MTRCommandIDTypeClusterNetworkCommissioningCommandAddOrUpdateWiFiNetworkID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRNetworkCommissioningClusterNetworkConfigResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)addOrUpdateThreadNetworkWithParams:(MTRNetworkCommissioningClusterAddOrUpdateThreadNetworkParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeNetworkCommissioningID, (unsigned int) MTRCommandIDTypeClusterNetworkCommissioningCommandAddOrUpdateThreadNetworkID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterNetworkCommissioning - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster addOrUpdateThreadNetworkWithParams:params completion: - ^(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRNetworkCommissioningClusterAddOrUpdateThreadNetworkParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeNetworkCommissioningID) + commandID:@(MTRCommandIDTypeClusterNetworkCommissioningCommandAddOrUpdateThreadNetworkID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRNetworkCommissioningClusterNetworkConfigResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)removeNetworkWithParams:(MTRNetworkCommissioningClusterRemoveNetworkParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeNetworkCommissioningID, (unsigned int) MTRCommandIDTypeClusterNetworkCommissioningCommandRemoveNetworkID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterNetworkCommissioning - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster removeNetworkWithParams:params completion: - ^(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRNetworkCommissioningClusterRemoveNetworkParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeNetworkCommissioningID) + commandID:@(MTRCommandIDTypeClusterNetworkCommissioningCommandRemoveNetworkID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRNetworkCommissioningClusterNetworkConfigResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)connectNetworkWithParams:(MTRNetworkCommissioningClusterConnectNetworkParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRNetworkCommissioningClusterConnectNetworkResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeNetworkCommissioningID, (unsigned int) MTRCommandIDTypeClusterNetworkCommissioningCommandConnectNetworkID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterNetworkCommissioning - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster connectNetworkWithParams:params completion: - ^(MTRNetworkCommissioningClusterConnectNetworkResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRNetworkCommissioningClusterConnectNetworkParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeNetworkCommissioningID) + commandID:@(MTRCommandIDTypeClusterNetworkCommissioningCommandConnectNetworkID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRNetworkCommissioningClusterConnectNetworkResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)reorderNetworkWithParams:(MTRNetworkCommissioningClusterReorderNetworkParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeNetworkCommissioningID, (unsigned int) MTRCommandIDTypeClusterNetworkCommissioningCommandReorderNetworkID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterNetworkCommissioning - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster reorderNetworkWithParams:params completion: - ^(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRNetworkCommissioningClusterReorderNetworkParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeNetworkCommissioningID) + commandID:@(MTRCommandIDTypeClusterNetworkCommissioningCommandReorderNetworkID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRNetworkCommissioningClusterNetworkConfigResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeMaxNetworksWithParams:(MTRReadParams * _Nullable)params @@ -4802,37 +4248,28 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)retrieveLogsRequestWithParams:(MTRDiagnosticLogsClusterRetrieveLogsRequestParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRDiagnosticLogsClusterRetrieveLogsResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDiagnosticLogsID, (unsigned int) MTRCommandIDTypeClusterDiagnosticLogsCommandRetrieveLogsRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDiagnosticLogs - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster retrieveLogsRequestWithParams:params completion: - ^(MTRDiagnosticLogsClusterRetrieveLogsResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDiagnosticLogsClusterRetrieveLogsRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDiagnosticLogsID) + commandID:@(MTRCommandIDTypeClusterDiagnosticLogsCommandRetrieveLogsRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRDiagnosticLogsClusterRetrieveLogsResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params @@ -4900,37 +4337,28 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)testEventTriggerWithParams:(MTRGeneralDiagnosticsClusterTestEventTriggerParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeGeneralDiagnosticsID, (unsigned int) MTRCommandIDTypeClusterGeneralDiagnosticsCommandTestEventTriggerID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterGeneralDiagnostics - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testEventTriggerWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeGeneralDiagnosticsID) + commandID:@(MTRCommandIDTypeClusterGeneralDiagnosticsCommandTestEventTriggerID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeNetworkInterfacesWithParams:(MTRReadParams * _Nullable)params @@ -5053,37 +4481,28 @@ - (void)resetWatermarksWithExpectedValues:(NSArray } - (void)resetWatermarksWithParams:(MTRSoftwareDiagnosticsClusterResetWatermarksParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeSoftwareDiagnosticsID, (unsigned int) MTRCommandIDTypeClusterSoftwareDiagnosticsCommandResetWatermarksID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterSoftwareDiagnostics - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster resetWatermarksWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRSoftwareDiagnosticsClusterResetWatermarksParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeSoftwareDiagnosticsID) + commandID:@(MTRCommandIDTypeClusterSoftwareDiagnosticsCommandResetWatermarksID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeThreadMetricsWithParams:(MTRReadParams * _Nullable)params @@ -5176,37 +4595,28 @@ - (void)resetCountsWithExpectedValues:(NSArray *> * } - (void)resetCountsWithParams:(MTRThreadNetworkDiagnosticsClusterResetCountsParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeThreadNetworkDiagnosticsID, (unsigned int) MTRCommandIDTypeClusterThreadNetworkDiagnosticsCommandResetCountsID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterThreadNetworkDiagnostics - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster resetCountsWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRThreadNetworkDiagnosticsClusterResetCountsParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) + commandID:@(MTRCommandIDTypeClusterThreadNetworkDiagnosticsCommandResetCountsID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeChannelWithParams:(MTRReadParams * _Nullable)params @@ -5602,37 +5012,28 @@ - (void)resetCountsWithExpectedValues:(NSArray *> * } - (void)resetCountsWithParams:(MTRWiFiNetworkDiagnosticsClusterResetCountsParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeWiFiNetworkDiagnosticsID, (unsigned int) MTRCommandIDTypeClusterWiFiNetworkDiagnosticsCommandResetCountsID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster resetCountsWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRWiFiNetworkDiagnosticsClusterResetCountsParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeWiFiNetworkDiagnosticsID) + commandID:@(MTRCommandIDTypeClusterWiFiNetworkDiagnosticsCommandResetCountsID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeBSSIDWithParams:(MTRReadParams * _Nullable)params @@ -5778,37 +5179,28 @@ - (void)resetCountsWithExpectedValues:(NSArray *> * } - (void)resetCountsWithParams:(MTREthernetNetworkDiagnosticsClusterResetCountsParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeEthernetNetworkDiagnosticsID, (unsigned int) MTRCommandIDTypeClusterEthernetNetworkDiagnosticsCommandResetCountsID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster resetCountsWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTREthernetNetworkDiagnosticsClusterResetCountsParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeEthernetNetworkDiagnosticsID) + commandID:@(MTRCommandIDTypeClusterEthernetNetworkDiagnosticsCommandResetCountsID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributePHYRateWithParams:(MTRReadParams * _Nullable)params @@ -5922,177 +5314,132 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)setUTCTimeWithParams:(MTRTimeSynchronizationClusterSetUTCTimeParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeTimeSynchronizationID, (unsigned int) MTRCommandIDTypeClusterTimeSynchronizationCommandSetUTCTimeID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterTimeSynchronization - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster setUTCTimeWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRTimeSynchronizationClusterSetUTCTimeParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeTimeSynchronizationID) + commandID:@(MTRCommandIDTypeClusterTimeSynchronizationCommandSetUTCTimeID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)setTrustedTimeSourceWithParams:(MTRTimeSynchronizationClusterSetTrustedTimeSourceParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeTimeSynchronizationID, (unsigned int) MTRCommandIDTypeClusterTimeSynchronizationCommandSetTrustedTimeSourceID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterTimeSynchronization - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster setTrustedTimeSourceWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRTimeSynchronizationClusterSetTrustedTimeSourceParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeTimeSynchronizationID) + commandID:@(MTRCommandIDTypeClusterTimeSynchronizationCommandSetTrustedTimeSourceID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)setTimeZoneWithParams:(MTRTimeSynchronizationClusterSetTimeZoneParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRTimeSynchronizationClusterSetTimeZoneResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeTimeSynchronizationID, (unsigned int) MTRCommandIDTypeClusterTimeSynchronizationCommandSetTimeZoneID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterTimeSynchronization - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster setTimeZoneWithParams:params completion: - ^(MTRTimeSynchronizationClusterSetTimeZoneResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRTimeSynchronizationClusterSetTimeZoneParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeTimeSynchronizationID) + commandID:@(MTRCommandIDTypeClusterTimeSynchronizationCommandSetTimeZoneID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRTimeSynchronizationClusterSetTimeZoneResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)setDSTOffsetWithParams:(MTRTimeSynchronizationClusterSetDSTOffsetParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeTimeSynchronizationID, (unsigned int) MTRCommandIDTypeClusterTimeSynchronizationCommandSetDSTOffsetID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterTimeSynchronization - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster setDSTOffsetWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRTimeSynchronizationClusterSetDSTOffsetParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeTimeSynchronizationID) + commandID:@(MTRCommandIDTypeClusterTimeSynchronizationCommandSetDSTOffsetID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)setDefaultNTPWithParams:(MTRTimeSynchronizationClusterSetDefaultNTPParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeTimeSynchronizationID, (unsigned int) MTRCommandIDTypeClusterTimeSynchronizationCommandSetDefaultNTPID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterTimeSynchronization - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster setDefaultNTPWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRTimeSynchronizationClusterSetDefaultNTPParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeTimeSynchronizationID) + commandID:@(MTRCommandIDTypeClusterTimeSynchronizationCommandSetDefaultNTPID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeUTCTimeWithParams:(MTRReadParams * _Nullable)params @@ -6426,72 +5773,60 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)openCommissioningWindowWithParams:(MTRAdministratorCommissioningClusterOpenCommissioningWindowParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeAdministratorCommissioningID, (unsigned int) MTRCommandIDTypeClusterAdministratorCommissioningCommandOpenCommissioningWindowID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterAdministratorCommissioning - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster openCommissioningWindowWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRAdministratorCommissioningClusterOpenCommissioningWindowParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(10000); } + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeAdministratorCommissioningID) + commandID:@(MTRCommandIDTypeClusterAdministratorCommissioningCommandOpenCommissioningWindowID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)openBasicCommissioningWindowWithParams:(MTRAdministratorCommissioningClusterOpenBasicCommissioningWindowParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeAdministratorCommissioningID, (unsigned int) MTRCommandIDTypeClusterAdministratorCommissioningCommandOpenBasicCommissioningWindowID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterAdministratorCommissioning - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster openBasicCommissioningWindowWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRAdministratorCommissioningClusterOpenBasicCommissioningWindowParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(10000); } + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeAdministratorCommissioningID) + commandID:@(MTRCommandIDTypeClusterAdministratorCommissioningCommandOpenBasicCommissioningWindowID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)revokeCommissioningWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion @@ -6500,37 +5835,31 @@ - (void)revokeCommissioningWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeAdministratorCommissioningID, (unsigned int) MTRCommandIDTypeClusterAdministratorCommissioningCommandRevokeCommissioningID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterAdministratorCommissioning - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster revokeCommissioningWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRAdministratorCommissioningClusterRevokeCommissioningParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(10000); } + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeAdministratorCommissioningID) + commandID:@(MTRCommandIDTypeClusterAdministratorCommissioningCommandRevokeCommissioningID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeWindowStatusWithParams:(MTRReadParams * _Nullable)params @@ -6624,282 +5953,210 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)attestationRequestWithParams:(MTROperationalCredentialsClusterAttestationRequestParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTROperationalCredentialsClusterAttestationResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOperationalCredentialsID, (unsigned int) MTRCommandIDTypeClusterOperationalCredentialsCommandAttestationRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOperationalCredentials - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster attestationRequestWithParams:params completion: - ^(MTROperationalCredentialsClusterAttestationResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROperationalCredentialsClusterAttestationRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOperationalCredentialsID) + commandID:@(MTRCommandIDTypeClusterOperationalCredentialsCommandAttestationRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTROperationalCredentialsClusterAttestationResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)certificateChainRequestWithParams:(MTROperationalCredentialsClusterCertificateChainRequestParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTROperationalCredentialsClusterCertificateChainResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOperationalCredentialsID, (unsigned int) MTRCommandIDTypeClusterOperationalCredentialsCommandCertificateChainRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOperationalCredentials - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster certificateChainRequestWithParams:params completion: - ^(MTROperationalCredentialsClusterCertificateChainResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROperationalCredentialsClusterCertificateChainRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOperationalCredentialsID) + commandID:@(MTRCommandIDTypeClusterOperationalCredentialsCommandCertificateChainRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTROperationalCredentialsClusterCertificateChainResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)CSRRequestWithParams:(MTROperationalCredentialsClusterCSRRequestParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTROperationalCredentialsClusterCSRResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOperationalCredentialsID, (unsigned int) MTRCommandIDTypeClusterOperationalCredentialsCommandCSRRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOperationalCredentials - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster CSRRequestWithParams:params completion: - ^(MTROperationalCredentialsClusterCSRResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROperationalCredentialsClusterCSRRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOperationalCredentialsID) + commandID:@(MTRCommandIDTypeClusterOperationalCredentialsCommandCSRRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTROperationalCredentialsClusterCSRResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)addNOCWithParams:(MTROperationalCredentialsClusterAddNOCParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTROperationalCredentialsClusterNOCResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOperationalCredentialsID, (unsigned int) MTRCommandIDTypeClusterOperationalCredentialsCommandAddNOCID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOperationalCredentials - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster addNOCWithParams:params completion: - ^(MTROperationalCredentialsClusterNOCResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROperationalCredentialsClusterAddNOCParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOperationalCredentialsID) + commandID:@(MTRCommandIDTypeClusterOperationalCredentialsCommandAddNOCID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTROperationalCredentialsClusterNOCResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)updateNOCWithParams:(MTROperationalCredentialsClusterUpdateNOCParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTROperationalCredentialsClusterNOCResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOperationalCredentialsID, (unsigned int) MTRCommandIDTypeClusterOperationalCredentialsCommandUpdateNOCID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOperationalCredentials - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster updateNOCWithParams:params completion: - ^(MTROperationalCredentialsClusterNOCResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROperationalCredentialsClusterUpdateNOCParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOperationalCredentialsID) + commandID:@(MTRCommandIDTypeClusterOperationalCredentialsCommandUpdateNOCID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTROperationalCredentialsClusterNOCResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)updateFabricLabelWithParams:(MTROperationalCredentialsClusterUpdateFabricLabelParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTROperationalCredentialsClusterNOCResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOperationalCredentialsID, (unsigned int) MTRCommandIDTypeClusterOperationalCredentialsCommandUpdateFabricLabelID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOperationalCredentials - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster updateFabricLabelWithParams:params completion: - ^(MTROperationalCredentialsClusterNOCResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROperationalCredentialsClusterUpdateFabricLabelParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOperationalCredentialsID) + commandID:@(MTRCommandIDTypeClusterOperationalCredentialsCommandUpdateFabricLabelID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTROperationalCredentialsClusterNOCResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)removeFabricWithParams:(MTROperationalCredentialsClusterRemoveFabricParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTROperationalCredentialsClusterNOCResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOperationalCredentialsID, (unsigned int) MTRCommandIDTypeClusterOperationalCredentialsCommandRemoveFabricID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOperationalCredentials - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster removeFabricWithParams:params completion: - ^(MTROperationalCredentialsClusterNOCResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROperationalCredentialsClusterRemoveFabricParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOperationalCredentialsID) + commandID:@(MTRCommandIDTypeClusterOperationalCredentialsCommandRemoveFabricID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTROperationalCredentialsClusterNOCResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)addTrustedRootCertificateWithParams:(MTROperationalCredentialsClusterAddTrustedRootCertificateParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOperationalCredentialsID, (unsigned int) MTRCommandIDTypeClusterOperationalCredentialsCommandAddTrustedRootCertificateID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOperationalCredentials - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster addTrustedRootCertificateWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROperationalCredentialsClusterAddTrustedRootCertificateParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOperationalCredentialsID) + commandID:@(MTRCommandIDTypeClusterOperationalCredentialsCommandAddTrustedRootCertificateID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeNOCsWithParams:(MTRReadParams * _Nullable)params @@ -7050,107 +6307,80 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)keySetWriteWithParams:(MTRGroupKeyManagementClusterKeySetWriteParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeGroupKeyManagementID, (unsigned int) MTRCommandIDTypeClusterGroupKeyManagementCommandKeySetWriteID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterGroupKeyManagement - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster keySetWriteWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRGroupKeyManagementClusterKeySetWriteParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeGroupKeyManagementID) + commandID:@(MTRCommandIDTypeClusterGroupKeyManagementCommandKeySetWriteID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)keySetReadWithParams:(MTRGroupKeyManagementClusterKeySetReadParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRGroupKeyManagementClusterKeySetReadResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeGroupKeyManagementID, (unsigned int) MTRCommandIDTypeClusterGroupKeyManagementCommandKeySetReadID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterGroupKeyManagement - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster keySetReadWithParams:params completion: - ^(MTRGroupKeyManagementClusterKeySetReadResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRGroupKeyManagementClusterKeySetReadParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeGroupKeyManagementID) + commandID:@(MTRCommandIDTypeClusterGroupKeyManagementCommandKeySetReadID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRGroupKeyManagementClusterKeySetReadResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)keySetRemoveWithParams:(MTRGroupKeyManagementClusterKeySetRemoveParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeGroupKeyManagementID, (unsigned int) MTRCommandIDTypeClusterGroupKeyManagementCommandKeySetRemoveID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterGroupKeyManagement - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster keySetRemoveWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRGroupKeyManagementClusterKeySetRemoveParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeGroupKeyManagementID) + commandID:@(MTRCommandIDTypeClusterGroupKeyManagementCommandKeySetRemoveID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)keySetReadAllIndicesWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRGroupKeyManagementClusterKeySetReadAllIndicesResponseParams * _Nullable data, NSError * _Nullable error))completion @@ -7159,37 +6389,28 @@ - (void)keySetReadAllIndicesWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRGroupKeyManagementClusterKeySetReadAllIndicesResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeGroupKeyManagementID, (unsigned int) MTRCommandIDTypeClusterGroupKeyManagementCommandKeySetReadAllIndicesID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterGroupKeyManagement - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster keySetReadAllIndicesWithParams:params completion: - ^(MTRGroupKeyManagementClusterKeySetReadAllIndicesResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRGroupKeyManagementClusterKeySetReadAllIndicesParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeGroupKeyManagementID) + commandID:@(MTRCommandIDTypeClusterGroupKeyManagementCommandKeySetReadAllIndicesID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRGroupKeyManagementClusterKeySetReadAllIndicesResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeGroupKeyMapWithParams:(MTRReadParams * _Nullable)params @@ -7497,72 +6718,54 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)registerClientWithParams:(MTRICDManagementClusterRegisterClientParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRICDManagementClusterRegisterClientResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeICDManagementID, (unsigned int) MTRCommandIDTypeClusterICDManagementCommandRegisterClientID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterICDManagement - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster registerClientWithParams:params completion: - ^(MTRICDManagementClusterRegisterClientResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRICDManagementClusterRegisterClientParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeICDManagementID) + commandID:@(MTRCommandIDTypeClusterICDManagementCommandRegisterClientID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRICDManagementClusterRegisterClientResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)unregisterClientWithParams:(MTRICDManagementClusterUnregisterClientParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeICDManagementID, (unsigned int) MTRCommandIDTypeClusterICDManagementCommandUnregisterClientID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterICDManagement - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster unregisterClientWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRICDManagementClusterUnregisterClientParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeICDManagementID) + commandID:@(MTRCommandIDTypeClusterICDManagementCommandUnregisterClientID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)stayActiveRequestWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion @@ -7571,37 +6774,28 @@ - (void)stayActiveRequestWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeICDManagementID, (unsigned int) MTRCommandIDTypeClusterICDManagementCommandStayActiveRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterICDManagement - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster stayActiveRequestWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRICDManagementClusterStayActiveRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeICDManagementID) + commandID:@(MTRCommandIDTypeClusterICDManagementCommandStayActiveRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeIdleModeIntervalWithParams:(MTRReadParams * _Nullable)params @@ -7682,37 +6876,28 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)changeToModeWithParams:(MTRModeSelectClusterChangeToModeParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeModeSelectID, (unsigned int) MTRCommandIDTypeClusterModeSelectCommandChangeToModeID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterModeSelect - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster changeToModeWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRModeSelectClusterChangeToModeParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeModeSelectID) + commandID:@(MTRCommandIDTypeClusterModeSelectCommandChangeToModeID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeDescriptionWithParams:(MTRReadParams * _Nullable)params @@ -7829,37 +7014,28 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)changeToModeWithParams:(MTRLaundryWasherModeClusterChangeToModeParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRLaundryWasherModeClusterChangeToModeResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeLaundryWasherModeID, (unsigned int) MTRCommandIDTypeClusterLaundryWasherModeCommandChangeToModeID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterLaundryWasherMode - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster changeToModeWithParams:params completion: - ^(MTRLaundryWasherModeClusterChangeToModeResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRLaundryWasherModeClusterChangeToModeParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeLaundryWasherModeID) + commandID:@(MTRCommandIDTypeClusterLaundryWasherModeCommandChangeToModeID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRLaundryWasherModeClusterChangeToModeResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeSupportedModesWithParams:(MTRReadParams * _Nullable)params @@ -7952,37 +7128,28 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)changeToModeWithParams:(MTRRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeRefrigeratorAndTemperatureControlledCabinetModeID, (unsigned int) MTRCommandIDTypeClusterRefrigeratorAndTemperatureControlledCabinetModeCommandChangeToModeID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster changeToModeWithParams:params completion: - ^(MTRRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeRefrigeratorAndTemperatureControlledCabinetModeID) + commandID:@(MTRCommandIDTypeClusterRefrigeratorAndTemperatureControlledCabinetModeCommandChangeToModeID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeSupportedModesWithParams:(MTRReadParams * _Nullable)params @@ -8163,37 +7330,28 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)changeToModeWithParams:(MTRRVCRunModeClusterChangeToModeParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRRVCRunModeClusterChangeToModeResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeRVCRunModeID, (unsigned int) MTRCommandIDTypeClusterRVCRunModeCommandChangeToModeID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterRVCRunMode - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster changeToModeWithParams:params completion: - ^(MTRRVCRunModeClusterChangeToModeResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRRVCRunModeClusterChangeToModeParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeRVCRunModeID) + commandID:@(MTRCommandIDTypeClusterRVCRunModeCommandChangeToModeID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRRVCRunModeClusterChangeToModeResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeSupportedModesWithParams:(MTRReadParams * _Nullable)params @@ -8286,37 +7444,28 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)changeToModeWithParams:(MTRRVCCleanModeClusterChangeToModeParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRRVCCleanModeClusterChangeToModeResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeRVCCleanModeID, (unsigned int) MTRCommandIDTypeClusterRVCCleanModeCommandChangeToModeID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterRVCCleanMode - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster changeToModeWithParams:params completion: - ^(MTRRVCCleanModeClusterChangeToModeResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRRVCCleanModeClusterChangeToModeParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeRVCCleanModeID) + commandID:@(MTRCommandIDTypeClusterRVCCleanModeCommandChangeToModeID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRRVCCleanModeClusterChangeToModeResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeSupportedModesWithParams:(MTRReadParams * _Nullable)params @@ -8409,37 +7558,28 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)setTemperatureWithParams:(MTRTemperatureControlClusterSetTemperatureParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeTemperatureControlID, (unsigned int) MTRCommandIDTypeClusterTemperatureControlCommandSetTemperatureID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterTemperatureControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster setTemperatureWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRTemperatureControlClusterSetTemperatureParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeTemperatureControlID) + commandID:@(MTRCommandIDTypeClusterTemperatureControlCommandSetTemperatureID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeTemperatureSetpointWithParams:(MTRReadParams * _Nullable)params @@ -8581,37 +7721,28 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)changeToModeWithParams:(MTRDishwasherModeClusterChangeToModeParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRDishwasherModeClusterChangeToModeResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDishwasherModeID, (unsigned int) MTRCommandIDTypeClusterDishwasherModeCommandChangeToModeID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDishwasherMode - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster changeToModeWithParams:params completion: - ^(MTRDishwasherModeClusterChangeToModeResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDishwasherModeClusterChangeToModeParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDishwasherModeID) + commandID:@(MTRCommandIDTypeClusterDishwasherModeCommandChangeToModeID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRDishwasherModeClusterChangeToModeResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeSupportedModesWithParams:(MTRReadParams * _Nullable)params @@ -8759,37 +7890,28 @@ - (void)selfTestRequestWithExpectedValues:(NSArray } - (void)selfTestRequestWithParams:(MTRSmokeCOAlarmClusterSelfTestRequestParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeSmokeCOAlarmID, (unsigned int) MTRCommandIDTypeClusterSmokeCOAlarmCommandSelfTestRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterSmokeCOAlarm - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster selfTestRequestWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRSmokeCOAlarmClusterSelfTestRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeSmokeCOAlarmID) + commandID:@(MTRCommandIDTypeClusterSmokeCOAlarmCommandSelfTestRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeExpressedStateWithParams:(MTRReadParams * _Nullable)params @@ -8916,72 +8038,54 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)resetWithParams:(MTRDishwasherAlarmClusterResetParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDishwasherAlarmID, (unsigned int) MTRCommandIDTypeClusterDishwasherAlarmCommandResetID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDishwasherAlarm - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster resetWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDishwasherAlarmClusterResetParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDishwasherAlarmID) + commandID:@(MTRCommandIDTypeClusterDishwasherAlarmCommandResetID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)modifyEnabledAlarmsWithParams:(MTRDishwasherAlarmClusterModifyEnabledAlarmsParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDishwasherAlarmID, (unsigned int) MTRCommandIDTypeClusterDishwasherAlarmCommandModifyEnabledAlarmsID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDishwasherAlarm - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster modifyEnabledAlarmsWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDishwasherAlarmClusterModifyEnabledAlarmsParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDishwasherAlarmID) + commandID:@(MTRCommandIDTypeClusterDishwasherAlarmCommandModifyEnabledAlarmsID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeMaskWithParams:(MTRReadParams * _Nullable)params @@ -9056,37 +8160,28 @@ - (void)pauseWithExpectedValues:(NSArray *> *)expec } - (void)pauseWithParams:(MTROperationalStateClusterPauseParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTROperationalStateClusterOperationalCommandResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOperationalStateID, (unsigned int) MTRCommandIDTypeClusterOperationalStateCommandPauseID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOperationalState - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster pauseWithParams:params completion: - ^(MTROperationalStateClusterOperationalCommandResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROperationalStateClusterPauseParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOperationalStateID) + commandID:@(MTRCommandIDTypeClusterOperationalStateCommandPauseID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTROperationalStateClusterOperationalCommandResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)stopWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTROperationalStateClusterOperationalCommandResponseParams * _Nullable data, NSError * _Nullable error))completion @@ -9095,37 +8190,28 @@ - (void)stopWithExpectedValues:(NSArray *> *)expect } - (void)stopWithParams:(MTROperationalStateClusterStopParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTROperationalStateClusterOperationalCommandResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOperationalStateID, (unsigned int) MTRCommandIDTypeClusterOperationalStateCommandStopID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOperationalState - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster stopWithParams:params completion: - ^(MTROperationalStateClusterOperationalCommandResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROperationalStateClusterStopParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOperationalStateID) + commandID:@(MTRCommandIDTypeClusterOperationalStateCommandStopID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTROperationalStateClusterOperationalCommandResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)startWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTROperationalStateClusterOperationalCommandResponseParams * _Nullable data, NSError * _Nullable error))completion @@ -9134,37 +8220,28 @@ - (void)startWithExpectedValues:(NSArray *> *)expec } - (void)startWithParams:(MTROperationalStateClusterStartParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTROperationalStateClusterOperationalCommandResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOperationalStateID, (unsigned int) MTRCommandIDTypeClusterOperationalStateCommandStartID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOperationalState - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster startWithParams:params completion: - ^(MTROperationalStateClusterOperationalCommandResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROperationalStateClusterStartParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOperationalStateID) + commandID:@(MTRCommandIDTypeClusterOperationalStateCommandStartID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTROperationalStateClusterOperationalCommandResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)resumeWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTROperationalStateClusterOperationalCommandResponseParams * _Nullable data, NSError * _Nullable error))completion @@ -9173,37 +8250,28 @@ - (void)resumeWithExpectedValues:(NSArray *> *)expe } - (void)resumeWithParams:(MTROperationalStateClusterResumeParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTROperationalStateClusterOperationalCommandResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeOperationalStateID, (unsigned int) MTRCommandIDTypeClusterOperationalStateCommandResumeID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterOperationalState - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster resumeWithParams:params completion: - ^(MTROperationalStateClusterOperationalCommandResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTROperationalStateClusterResumeParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeOperationalStateID) + commandID:@(MTRCommandIDTypeClusterOperationalStateCommandResumeID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTROperationalStateClusterOperationalCommandResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributePhaseListWithParams:(MTRReadParams * _Nullable)params @@ -9288,37 +8356,28 @@ - (void)pauseWithExpectedValues:(NSArray *> *)expec } - (void)pauseWithParams:(MTRRVCOperationalStateClusterPauseParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRRVCOperationalStateClusterOperationalCommandResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeRVCOperationalStateID, (unsigned int) MTRCommandIDTypeClusterRVCOperationalStateCommandPauseID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterRVCOperationalState - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster pauseWithParams:params completion: - ^(MTRRVCOperationalStateClusterOperationalCommandResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRRVCOperationalStateClusterPauseParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeRVCOperationalStateID) + commandID:@(MTRCommandIDTypeClusterRVCOperationalStateCommandPauseID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRRVCOperationalStateClusterOperationalCommandResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)stopWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRRVCOperationalStateClusterOperationalCommandResponseParams * _Nullable data, NSError * _Nullable error))completion @@ -9327,37 +8386,28 @@ - (void)stopWithExpectedValues:(NSArray *> *)expect } - (void)stopWithParams:(MTRRVCOperationalStateClusterStopParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRRVCOperationalStateClusterOperationalCommandResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeRVCOperationalStateID, (unsigned int) MTRCommandIDTypeClusterRVCOperationalStateCommandStopID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterRVCOperationalState - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster stopWithParams:params completion: - ^(MTRRVCOperationalStateClusterOperationalCommandResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRRVCOperationalStateClusterStopParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeRVCOperationalStateID) + commandID:@(MTRCommandIDTypeClusterRVCOperationalStateCommandStopID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRRVCOperationalStateClusterOperationalCommandResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)startWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRRVCOperationalStateClusterOperationalCommandResponseParams * _Nullable data, NSError * _Nullable error))completion @@ -9366,37 +8416,28 @@ - (void)startWithExpectedValues:(NSArray *> *)expec } - (void)startWithParams:(MTRRVCOperationalStateClusterStartParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRRVCOperationalStateClusterOperationalCommandResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeRVCOperationalStateID, (unsigned int) MTRCommandIDTypeClusterRVCOperationalStateCommandStartID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterRVCOperationalState - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster startWithParams:params completion: - ^(MTRRVCOperationalStateClusterOperationalCommandResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRRVCOperationalStateClusterStartParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeRVCOperationalStateID) + commandID:@(MTRCommandIDTypeClusterRVCOperationalStateCommandStartID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRRVCOperationalStateClusterOperationalCommandResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)resumeWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRRVCOperationalStateClusterOperationalCommandResponseParams * _Nullable data, NSError * _Nullable error))completion @@ -9405,37 +8446,28 @@ - (void)resumeWithExpectedValues:(NSArray *> *)expe } - (void)resumeWithParams:(MTRRVCOperationalStateClusterResumeParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRRVCOperationalStateClusterOperationalCommandResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeRVCOperationalStateID, (unsigned int) MTRCommandIDTypeClusterRVCOperationalStateCommandResumeID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterRVCOperationalState - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster resumeWithParams:params completion: - ^(MTRRVCOperationalStateClusterOperationalCommandResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRRVCOperationalStateClusterResumeParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeRVCOperationalStateID) + commandID:@(MTRCommandIDTypeClusterRVCOperationalStateCommandResumeID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRRVCOperationalStateClusterOperationalCommandResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributePhaseListWithParams:(MTRReadParams * _Nullable)params @@ -9520,37 +8552,28 @@ - (void)resetConditionWithExpectedValues:(NSArray * } - (void)resetConditionWithParams:(MTRHEPAFilterMonitoringClusterResetConditionParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeHEPAFilterMonitoringID, (unsigned int) MTRCommandIDTypeClusterHEPAFilterMonitoringCommandResetConditionID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterHEPAFilterMonitoring - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster resetConditionWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRHEPAFilterMonitoringClusterResetConditionParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeHEPAFilterMonitoringID) + commandID:@(MTRCommandIDTypeClusterHEPAFilterMonitoringCommandResetConditionID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeConditionWithParams:(MTRReadParams * _Nullable)params @@ -9646,37 +8669,28 @@ - (void)resetConditionWithExpectedValues:(NSArray * } - (void)resetConditionWithParams:(MTRActivatedCarbonFilterMonitoringClusterResetConditionParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeActivatedCarbonFilterMonitoringID, (unsigned int) MTRCommandIDTypeClusterActivatedCarbonFilterMonitoringCommandResetConditionID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster resetConditionWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRActivatedCarbonFilterMonitoringClusterResetConditionParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeActivatedCarbonFilterMonitoringID) + commandID:@(MTRCommandIDTypeClusterActivatedCarbonFilterMonitoringCommandResetConditionID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeConditionWithParams:(MTRReadParams * _Nullable)params @@ -9768,667 +8782,520 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)lockDoorWithParams:(MTRDoorLockClusterLockDoorParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandLockDoorID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDoorLock - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster lockDoorWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDoorLockClusterLockDoorParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(10000); } + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDoorLockID) + commandID:@(MTRCommandIDTypeClusterDoorLockCommandLockDoorID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)unlockDoorWithParams:(MTRDoorLockClusterUnlockDoorParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandUnlockDoorID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDoorLock - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster unlockDoorWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDoorLockClusterUnlockDoorParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(10000); } + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDoorLockID) + commandID:@(MTRCommandIDTypeClusterDoorLockCommandUnlockDoorID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)unlockWithTimeoutWithParams:(MTRDoorLockClusterUnlockWithTimeoutParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandUnlockWithTimeoutID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDoorLock - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster unlockWithTimeoutWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDoorLockClusterUnlockWithTimeoutParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(10000); } + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDoorLockID) + commandID:@(MTRCommandIDTypeClusterDoorLockCommandUnlockWithTimeoutID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)setWeekDayScheduleWithParams:(MTRDoorLockClusterSetWeekDayScheduleParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandSetWeekDayScheduleID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDoorLock - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster setWeekDayScheduleWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDoorLockClusterSetWeekDayScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDoorLockID) + commandID:@(MTRCommandIDTypeClusterDoorLockCommandSetWeekDayScheduleID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)getWeekDayScheduleWithParams:(MTRDoorLockClusterGetWeekDayScheduleParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRDoorLockClusterGetWeekDayScheduleResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandGetWeekDayScheduleID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDoorLock - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster getWeekDayScheduleWithParams:params completion: - ^(MTRDoorLockClusterGetWeekDayScheduleResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDoorLockClusterGetWeekDayScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDoorLockID) + commandID:@(MTRCommandIDTypeClusterDoorLockCommandGetWeekDayScheduleID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRDoorLockClusterGetWeekDayScheduleResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)clearWeekDayScheduleWithParams:(MTRDoorLockClusterClearWeekDayScheduleParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandClearWeekDayScheduleID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDoorLock - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster clearWeekDayScheduleWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDoorLockClusterClearWeekDayScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDoorLockID) + commandID:@(MTRCommandIDTypeClusterDoorLockCommandClearWeekDayScheduleID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)setYearDayScheduleWithParams:(MTRDoorLockClusterSetYearDayScheduleParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandSetYearDayScheduleID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDoorLock - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster setYearDayScheduleWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDoorLockClusterSetYearDayScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDoorLockID) + commandID:@(MTRCommandIDTypeClusterDoorLockCommandSetYearDayScheduleID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)getYearDayScheduleWithParams:(MTRDoorLockClusterGetYearDayScheduleParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandGetYearDayScheduleID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDoorLock - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster getYearDayScheduleWithParams:params completion: - ^(MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDoorLockClusterGetYearDayScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDoorLockID) + commandID:@(MTRCommandIDTypeClusterDoorLockCommandGetYearDayScheduleID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRDoorLockClusterGetYearDayScheduleResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)clearYearDayScheduleWithParams:(MTRDoorLockClusterClearYearDayScheduleParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandClearYearDayScheduleID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDoorLock - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster clearYearDayScheduleWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDoorLockClusterClearYearDayScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDoorLockID) + commandID:@(MTRCommandIDTypeClusterDoorLockCommandClearYearDayScheduleID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)setHolidayScheduleWithParams:(MTRDoorLockClusterSetHolidayScheduleParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandSetHolidayScheduleID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDoorLock - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster setHolidayScheduleWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDoorLockClusterSetHolidayScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDoorLockID) + commandID:@(MTRCommandIDTypeClusterDoorLockCommandSetHolidayScheduleID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)getHolidayScheduleWithParams:(MTRDoorLockClusterGetHolidayScheduleParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRDoorLockClusterGetHolidayScheduleResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandGetHolidayScheduleID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDoorLock - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster getHolidayScheduleWithParams:params completion: - ^(MTRDoorLockClusterGetHolidayScheduleResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDoorLockClusterGetHolidayScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDoorLockID) + commandID:@(MTRCommandIDTypeClusterDoorLockCommandGetHolidayScheduleID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRDoorLockClusterGetHolidayScheduleResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)clearHolidayScheduleWithParams:(MTRDoorLockClusterClearHolidayScheduleParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandClearHolidayScheduleID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDoorLock - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster clearHolidayScheduleWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDoorLockClusterClearHolidayScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDoorLockID) + commandID:@(MTRCommandIDTypeClusterDoorLockCommandClearHolidayScheduleID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)setUserWithParams:(MTRDoorLockClusterSetUserParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandSetUserID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDoorLock - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster setUserWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDoorLockClusterSetUserParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(10000); } + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDoorLockID) + commandID:@(MTRCommandIDTypeClusterDoorLockCommandSetUserID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)getUserWithParams:(MTRDoorLockClusterGetUserParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRDoorLockClusterGetUserResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandGetUserID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDoorLock - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster getUserWithParams:params completion: - ^(MTRDoorLockClusterGetUserResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDoorLockClusterGetUserParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDoorLockID) + commandID:@(MTRCommandIDTypeClusterDoorLockCommandGetUserID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRDoorLockClusterGetUserResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)clearUserWithParams:(MTRDoorLockClusterClearUserParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandClearUserID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDoorLock - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster clearUserWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDoorLockClusterClearUserParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(10000); } + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDoorLockID) + commandID:@(MTRCommandIDTypeClusterDoorLockCommandClearUserID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)setCredentialWithParams:(MTRDoorLockClusterSetCredentialParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRDoorLockClusterSetCredentialResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandSetCredentialID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDoorLock - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster setCredentialWithParams:params completion: - ^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDoorLockClusterSetCredentialParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(10000); } + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDoorLockID) + commandID:@(MTRCommandIDTypeClusterDoorLockCommandSetCredentialID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRDoorLockClusterSetCredentialResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)getCredentialStatusWithParams:(MTRDoorLockClusterGetCredentialStatusParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandGetCredentialStatusID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDoorLock - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster getCredentialStatusWithParams:params completion: - ^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDoorLockClusterGetCredentialStatusParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDoorLockID) + commandID:@(MTRCommandIDTypeClusterDoorLockCommandGetCredentialStatusID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRDoorLockClusterGetCredentialStatusResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)clearCredentialWithParams:(MTRDoorLockClusterClearCredentialParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandClearCredentialID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDoorLock - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster clearCredentialWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDoorLockClusterClearCredentialParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(10000); } + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDoorLockID) + commandID:@(MTRCommandIDTypeClusterDoorLockCommandClearCredentialID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)unboltDoorWithParams:(MTRDoorLockClusterUnboltDoorParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandUnboltDoorID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterDoorLock - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster unboltDoorWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRDoorLockClusterUnboltDoorParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(10000); } + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeDoorLockID) + commandID:@(MTRCommandIDTypeClusterDoorLockCommandUnboltDoorID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeLockStateWithParams:(MTRReadParams * _Nullable)params @@ -10978,37 +9845,28 @@ - (void)upOrOpenWithExpectedValues:(NSArray *> *)ex } - (void)upOrOpenWithParams:(MTRWindowCoveringClusterUpOrOpenParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeWindowCoveringID, (unsigned int) MTRCommandIDTypeClusterWindowCoveringCommandUpOrOpenID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterWindowCovering - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster upOrOpenWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRWindowCoveringClusterUpOrOpenParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeWindowCoveringID) + commandID:@(MTRCommandIDTypeClusterWindowCoveringCommandUpOrOpenID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)downOrCloseWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion @@ -11017,37 +9875,28 @@ - (void)downOrCloseWithExpectedValues:(NSArray *> * } - (void)downOrCloseWithParams:(MTRWindowCoveringClusterDownOrCloseParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeWindowCoveringID, (unsigned int) MTRCommandIDTypeClusterWindowCoveringCommandDownOrCloseID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterWindowCovering - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster downOrCloseWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRWindowCoveringClusterDownOrCloseParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeWindowCoveringID) + commandID:@(MTRCommandIDTypeClusterWindowCoveringCommandDownOrCloseID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)stopMotionWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion @@ -11056,177 +9905,132 @@ - (void)stopMotionWithExpectedValues:(NSArray *> *) } - (void)stopMotionWithParams:(MTRWindowCoveringClusterStopMotionParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeWindowCoveringID, (unsigned int) MTRCommandIDTypeClusterWindowCoveringCommandStopMotionID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterWindowCovering - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster stopMotionWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRWindowCoveringClusterStopMotionParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeWindowCoveringID) + commandID:@(MTRCommandIDTypeClusterWindowCoveringCommandStopMotionID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)goToLiftValueWithParams:(MTRWindowCoveringClusterGoToLiftValueParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeWindowCoveringID, (unsigned int) MTRCommandIDTypeClusterWindowCoveringCommandGoToLiftValueID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterWindowCovering - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster goToLiftValueWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRWindowCoveringClusterGoToLiftValueParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeWindowCoveringID) + commandID:@(MTRCommandIDTypeClusterWindowCoveringCommandGoToLiftValueID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)goToLiftPercentageWithParams:(MTRWindowCoveringClusterGoToLiftPercentageParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeWindowCoveringID, (unsigned int) MTRCommandIDTypeClusterWindowCoveringCommandGoToLiftPercentageID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterWindowCovering - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster goToLiftPercentageWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRWindowCoveringClusterGoToLiftPercentageParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeWindowCoveringID) + commandID:@(MTRCommandIDTypeClusterWindowCoveringCommandGoToLiftPercentageID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)goToTiltValueWithParams:(MTRWindowCoveringClusterGoToTiltValueParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeWindowCoveringID, (unsigned int) MTRCommandIDTypeClusterWindowCoveringCommandGoToTiltValueID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterWindowCovering - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster goToTiltValueWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRWindowCoveringClusterGoToTiltValueParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeWindowCoveringID) + commandID:@(MTRCommandIDTypeClusterWindowCoveringCommandGoToTiltValueID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)goToTiltPercentageWithParams:(MTRWindowCoveringClusterGoToTiltPercentageParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeWindowCoveringID, (unsigned int) MTRCommandIDTypeClusterWindowCoveringCommandGoToTiltPercentageID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterWindowCovering - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster goToTiltPercentageWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRWindowCoveringClusterGoToTiltPercentageParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeWindowCoveringID) + commandID:@(MTRCommandIDTypeClusterWindowCoveringCommandGoToTiltPercentageID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeTypeWithParams:(MTRReadParams * _Nullable)params @@ -11454,37 +10258,28 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)barrierControlGoToPercentWithParams:(MTRBarrierControlClusterBarrierControlGoToPercentParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeBarrierControlID, (unsigned int) MTRCommandIDTypeClusterBarrierControlCommandBarrierControlGoToPercentID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterBarrierControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster barrierControlGoToPercentWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRBarrierControlClusterBarrierControlGoToPercentParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeBarrierControlID) + commandID:@(MTRCommandIDTypeClusterBarrierControlCommandBarrierControlGoToPercentID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)barrierControlStopWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion @@ -11493,37 +10288,28 @@ - (void)barrierControlStopWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeBarrierControlID, (unsigned int) MTRCommandIDTypeClusterBarrierControlCommandBarrierControlStopID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterBarrierControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster barrierControlStopWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRBarrierControlClusterBarrierControlStopParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeBarrierControlID) + commandID:@(MTRCommandIDTypeClusterBarrierControlCommandBarrierControlStopID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeBarrierMovingStateWithParams:(MTRReadParams * _Nullable)params @@ -11927,107 +10713,80 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)setpointRaiseLowerWithParams:(MTRThermostatClusterSetpointRaiseLowerParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeThermostatID, (unsigned int) MTRCommandIDTypeClusterThermostatCommandSetpointRaiseLowerID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterThermostat - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster setpointRaiseLowerWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRThermostatClusterSetpointRaiseLowerParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeThermostatID) + commandID:@(MTRCommandIDTypeClusterThermostatCommandSetpointRaiseLowerID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)setWeeklyScheduleWithParams:(MTRThermostatClusterSetWeeklyScheduleParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeThermostatID, (unsigned int) MTRCommandIDTypeClusterThermostatCommandSetWeeklyScheduleID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterThermostat - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster setWeeklyScheduleWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRThermostatClusterSetWeeklyScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeThermostatID) + commandID:@(MTRCommandIDTypeClusterThermostatCommandSetWeeklyScheduleID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)getWeeklyScheduleWithParams:(MTRThermostatClusterGetWeeklyScheduleParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRThermostatClusterGetWeeklyScheduleResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeThermostatID, (unsigned int) MTRCommandIDTypeClusterThermostatCommandGetWeeklyScheduleID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterThermostat - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster getWeeklyScheduleWithParams:params completion: - ^(MTRThermostatClusterGetWeeklyScheduleResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRThermostatClusterGetWeeklyScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeThermostatID) + commandID:@(MTRCommandIDTypeClusterThermostatCommandGetWeeklyScheduleID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRThermostatClusterGetWeeklyScheduleResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)clearWeeklyScheduleWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion @@ -12036,37 +10795,28 @@ - (void)clearWeeklyScheduleWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeThermostatID, (unsigned int) MTRCommandIDTypeClusterThermostatCommandClearWeeklyScheduleID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterThermostat - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster clearWeeklyScheduleWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRThermostatClusterClearWeeklyScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeThermostatID) + commandID:@(MTRCommandIDTypeClusterThermostatCommandClearWeeklyScheduleID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeLocalTemperatureWithParams:(MTRReadParams * _Nullable)params @@ -12695,37 +11445,28 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)stepWithParams:(MTRFanControlClusterStepParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeFanControlID, (unsigned int) MTRCommandIDTypeClusterFanControlCommandStepID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterFanControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster stepWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRFanControlClusterStepParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeFanControlID) + commandID:@(MTRCommandIDTypeClusterFanControlCommandStepID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeFanModeWithParams:(MTRReadParams * _Nullable)params @@ -13025,667 +11766,496 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)moveToHueWithParams:(MTRColorControlClusterMoveToHueParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeColorControlID, (unsigned int) MTRCommandIDTypeClusterColorControlCommandMoveToHueID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterColorControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster moveToHueWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRColorControlClusterMoveToHueParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeColorControlID) + commandID:@(MTRCommandIDTypeClusterColorControlCommandMoveToHueID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)moveHueWithParams:(MTRColorControlClusterMoveHueParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeColorControlID, (unsigned int) MTRCommandIDTypeClusterColorControlCommandMoveHueID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterColorControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster moveHueWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRColorControlClusterMoveHueParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeColorControlID) + commandID:@(MTRCommandIDTypeClusterColorControlCommandMoveHueID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)stepHueWithParams:(MTRColorControlClusterStepHueParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeColorControlID, (unsigned int) MTRCommandIDTypeClusterColorControlCommandStepHueID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterColorControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster stepHueWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRColorControlClusterStepHueParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeColorControlID) + commandID:@(MTRCommandIDTypeClusterColorControlCommandStepHueID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)moveToSaturationWithParams:(MTRColorControlClusterMoveToSaturationParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeColorControlID, (unsigned int) MTRCommandIDTypeClusterColorControlCommandMoveToSaturationID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterColorControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster moveToSaturationWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRColorControlClusterMoveToSaturationParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeColorControlID) + commandID:@(MTRCommandIDTypeClusterColorControlCommandMoveToSaturationID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)moveSaturationWithParams:(MTRColorControlClusterMoveSaturationParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeColorControlID, (unsigned int) MTRCommandIDTypeClusterColorControlCommandMoveSaturationID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterColorControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster moveSaturationWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRColorControlClusterMoveSaturationParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeColorControlID) + commandID:@(MTRCommandIDTypeClusterColorControlCommandMoveSaturationID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)stepSaturationWithParams:(MTRColorControlClusterStepSaturationParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeColorControlID, (unsigned int) MTRCommandIDTypeClusterColorControlCommandStepSaturationID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterColorControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster stepSaturationWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRColorControlClusterStepSaturationParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeColorControlID) + commandID:@(MTRCommandIDTypeClusterColorControlCommandStepSaturationID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)moveToHueAndSaturationWithParams:(MTRColorControlClusterMoveToHueAndSaturationParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeColorControlID, (unsigned int) MTRCommandIDTypeClusterColorControlCommandMoveToHueAndSaturationID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterColorControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster moveToHueAndSaturationWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRColorControlClusterMoveToHueAndSaturationParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeColorControlID) + commandID:@(MTRCommandIDTypeClusterColorControlCommandMoveToHueAndSaturationID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)moveToColorWithParams:(MTRColorControlClusterMoveToColorParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeColorControlID, (unsigned int) MTRCommandIDTypeClusterColorControlCommandMoveToColorID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterColorControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster moveToColorWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRColorControlClusterMoveToColorParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeColorControlID) + commandID:@(MTRCommandIDTypeClusterColorControlCommandMoveToColorID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)moveColorWithParams:(MTRColorControlClusterMoveColorParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeColorControlID, (unsigned int) MTRCommandIDTypeClusterColorControlCommandMoveColorID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterColorControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster moveColorWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRColorControlClusterMoveColorParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeColorControlID) + commandID:@(MTRCommandIDTypeClusterColorControlCommandMoveColorID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)stepColorWithParams:(MTRColorControlClusterStepColorParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeColorControlID, (unsigned int) MTRCommandIDTypeClusterColorControlCommandStepColorID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterColorControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster stepColorWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRColorControlClusterStepColorParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeColorControlID) + commandID:@(MTRCommandIDTypeClusterColorControlCommandStepColorID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)moveToColorTemperatureWithParams:(MTRColorControlClusterMoveToColorTemperatureParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeColorControlID, (unsigned int) MTRCommandIDTypeClusterColorControlCommandMoveToColorTemperatureID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterColorControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster moveToColorTemperatureWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRColorControlClusterMoveToColorTemperatureParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeColorControlID) + commandID:@(MTRCommandIDTypeClusterColorControlCommandMoveToColorTemperatureID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)enhancedMoveToHueWithParams:(MTRColorControlClusterEnhancedMoveToHueParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeColorControlID, (unsigned int) MTRCommandIDTypeClusterColorControlCommandEnhancedMoveToHueID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterColorControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster enhancedMoveToHueWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRColorControlClusterEnhancedMoveToHueParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeColorControlID) + commandID:@(MTRCommandIDTypeClusterColorControlCommandEnhancedMoveToHueID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)enhancedMoveHueWithParams:(MTRColorControlClusterEnhancedMoveHueParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeColorControlID, (unsigned int) MTRCommandIDTypeClusterColorControlCommandEnhancedMoveHueID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterColorControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster enhancedMoveHueWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRColorControlClusterEnhancedMoveHueParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeColorControlID) + commandID:@(MTRCommandIDTypeClusterColorControlCommandEnhancedMoveHueID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)enhancedStepHueWithParams:(MTRColorControlClusterEnhancedStepHueParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeColorControlID, (unsigned int) MTRCommandIDTypeClusterColorControlCommandEnhancedStepHueID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterColorControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster enhancedStepHueWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRColorControlClusterEnhancedStepHueParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeColorControlID) + commandID:@(MTRCommandIDTypeClusterColorControlCommandEnhancedStepHueID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)enhancedMoveToHueAndSaturationWithParams:(MTRColorControlClusterEnhancedMoveToHueAndSaturationParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeColorControlID, (unsigned int) MTRCommandIDTypeClusterColorControlCommandEnhancedMoveToHueAndSaturationID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterColorControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster enhancedMoveToHueAndSaturationWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRColorControlClusterEnhancedMoveToHueAndSaturationParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeColorControlID) + commandID:@(MTRCommandIDTypeClusterColorControlCommandEnhancedMoveToHueAndSaturationID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)colorLoopSetWithParams:(MTRColorControlClusterColorLoopSetParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeColorControlID, (unsigned int) MTRCommandIDTypeClusterColorControlCommandColorLoopSetID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterColorControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster colorLoopSetWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRColorControlClusterColorLoopSetParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeColorControlID) + commandID:@(MTRCommandIDTypeClusterColorControlCommandColorLoopSetID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)stopMoveStepWithParams:(MTRColorControlClusterStopMoveStepParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeColorControlID, (unsigned int) MTRCommandIDTypeClusterColorControlCommandStopMoveStepID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterColorControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster stopMoveStepWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRColorControlClusterStopMoveStepParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeColorControlID) + commandID:@(MTRCommandIDTypeClusterColorControlCommandStopMoveStepID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)moveColorTemperatureWithParams:(MTRColorControlClusterMoveColorTemperatureParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeColorControlID, (unsigned int) MTRCommandIDTypeClusterColorControlCommandMoveColorTemperatureID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterColorControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster moveColorTemperatureWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRColorControlClusterMoveColorTemperatureParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeColorControlID) + commandID:@(MTRCommandIDTypeClusterColorControlCommandMoveColorTemperatureID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)stepColorTemperatureWithParams:(MTRColorControlClusterStepColorTemperatureParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeColorControlID, (unsigned int) MTRCommandIDTypeClusterColorControlCommandStepColorTemperatureID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterColorControl - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster stepColorTemperatureWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRColorControlClusterStepColorTemperatureParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeColorControlID) + commandID:@(MTRCommandIDTypeClusterColorControlCommandStepColorTemperatureID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeCurrentHueWithParams:(MTRReadParams * _Nullable)params @@ -16217,107 +14787,80 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)changeChannelWithParams:(MTRChannelClusterChangeChannelParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRChannelClusterChangeChannelResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeChannelID, (unsigned int) MTRCommandIDTypeClusterChannelCommandChangeChannelID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterChannel - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster changeChannelWithParams:params completion: - ^(MTRChannelClusterChangeChannelResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRChannelClusterChangeChannelParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeChannelID) + commandID:@(MTRCommandIDTypeClusterChannelCommandChangeChannelID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRChannelClusterChangeChannelResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)changeChannelByNumberWithParams:(MTRChannelClusterChangeChannelByNumberParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeChannelID, (unsigned int) MTRCommandIDTypeClusterChannelCommandChangeChannelByNumberID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterChannel - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster changeChannelByNumberWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRChannelClusterChangeChannelByNumberParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeChannelID) + commandID:@(MTRCommandIDTypeClusterChannelCommandChangeChannelByNumberID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)skipChannelWithParams:(MTRChannelClusterSkipChannelParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeChannelID, (unsigned int) MTRCommandIDTypeClusterChannelCommandSkipChannelID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterChannel - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster skipChannelWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRChannelClusterSkipChannelParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeChannelID) + commandID:@(MTRCommandIDTypeClusterChannelCommandSkipChannelID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeChannelListWithParams:(MTRReadParams * _Nullable)params @@ -16410,37 +14953,28 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)navigateTargetWithParams:(MTRTargetNavigatorClusterNavigateTargetParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRTargetNavigatorClusterNavigateTargetResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeTargetNavigatorID, (unsigned int) MTRCommandIDTypeClusterTargetNavigatorCommandNavigateTargetID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterTargetNavigator - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster navigateTargetWithParams:params completion: - ^(MTRTargetNavigatorClusterNavigateTargetResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRTargetNavigatorClusterNavigateTargetParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeTargetNavigatorID) + commandID:@(MTRCommandIDTypeClusterTargetNavigatorCommandNavigateTargetID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRTargetNavigatorClusterNavigateTargetResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeTargetListWithParams:(MTRReadParams * _Nullable)params @@ -16522,37 +15056,28 @@ - (void)playWithExpectedValues:(NSArray *> *)expect } - (void)playWithParams:(MTRMediaPlaybackClusterPlayParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeMediaPlaybackID, (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandPlayID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterMediaPlayback - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster playWithParams:params completion: - ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRMediaPlaybackClusterPlayParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeMediaPlaybackID) + commandID:@(MTRCommandIDTypeClusterMediaPlaybackCommandPlayID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRMediaPlaybackClusterPlaybackResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)pauseWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion @@ -16561,37 +15086,28 @@ - (void)pauseWithExpectedValues:(NSArray *> *)expec } - (void)pauseWithParams:(MTRMediaPlaybackClusterPauseParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeMediaPlaybackID, (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandPauseID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterMediaPlayback - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster pauseWithParams:params completion: - ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRMediaPlaybackClusterPauseParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeMediaPlaybackID) + commandID:@(MTRCommandIDTypeClusterMediaPlaybackCommandPauseID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRMediaPlaybackClusterPlaybackResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)stopWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion @@ -16600,37 +15116,28 @@ - (void)stopWithExpectedValues:(NSArray *> *)expect } - (void)stopWithParams:(MTRMediaPlaybackClusterStopParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeMediaPlaybackID, (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandStopID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterMediaPlayback - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster stopWithParams:params completion: - ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRMediaPlaybackClusterStopParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeMediaPlaybackID) + commandID:@(MTRCommandIDTypeClusterMediaPlaybackCommandStopID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRMediaPlaybackClusterPlaybackResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)startOverWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion @@ -16639,37 +15146,28 @@ - (void)startOverWithExpectedValues:(NSArray *> *)e } - (void)startOverWithParams:(MTRMediaPlaybackClusterStartOverParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeMediaPlaybackID, (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandStartOverID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterMediaPlayback - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster startOverWithParams:params completion: - ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRMediaPlaybackClusterStartOverParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeMediaPlaybackID) + commandID:@(MTRCommandIDTypeClusterMediaPlaybackCommandStartOverID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRMediaPlaybackClusterPlaybackResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)previousWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion @@ -16678,37 +15176,28 @@ - (void)previousWithExpectedValues:(NSArray *> *)ex } - (void)previousWithParams:(MTRMediaPlaybackClusterPreviousParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeMediaPlaybackID, (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandPreviousID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterMediaPlayback - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster previousWithParams:params completion: - ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRMediaPlaybackClusterPreviousParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeMediaPlaybackID) + commandID:@(MTRCommandIDTypeClusterMediaPlaybackCommandPreviousID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRMediaPlaybackClusterPlaybackResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)nextWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion @@ -16717,37 +15206,28 @@ - (void)nextWithExpectedValues:(NSArray *> *)expect } - (void)nextWithParams:(MTRMediaPlaybackClusterNextParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeMediaPlaybackID, (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandNextID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterMediaPlayback - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster nextWithParams:params completion: - ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRMediaPlaybackClusterNextParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeMediaPlaybackID) + commandID:@(MTRCommandIDTypeClusterMediaPlaybackCommandNextID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRMediaPlaybackClusterPlaybackResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)rewindWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion @@ -16756,37 +15236,28 @@ - (void)rewindWithExpectedValues:(NSArray *> *)expe } - (void)rewindWithParams:(MTRMediaPlaybackClusterRewindParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeMediaPlaybackID, (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandRewindID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterMediaPlayback - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster rewindWithParams:params completion: - ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRMediaPlaybackClusterRewindParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeMediaPlaybackID) + commandID:@(MTRCommandIDTypeClusterMediaPlaybackCommandRewindID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRMediaPlaybackClusterPlaybackResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)fastForwardWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion @@ -16795,142 +15266,106 @@ - (void)fastForwardWithExpectedValues:(NSArray *> * } - (void)fastForwardWithParams:(MTRMediaPlaybackClusterFastForwardParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeMediaPlaybackID, (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandFastForwardID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterMediaPlayback - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster fastForwardWithParams:params completion: - ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRMediaPlaybackClusterFastForwardParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeMediaPlaybackID) + commandID:@(MTRCommandIDTypeClusterMediaPlaybackCommandFastForwardID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRMediaPlaybackClusterPlaybackResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)skipForwardWithParams:(MTRMediaPlaybackClusterSkipForwardParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeMediaPlaybackID, (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandSkipForwardID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterMediaPlayback - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster skipForwardWithParams:params completion: - ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRMediaPlaybackClusterSkipForwardParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeMediaPlaybackID) + commandID:@(MTRCommandIDTypeClusterMediaPlaybackCommandSkipForwardID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRMediaPlaybackClusterPlaybackResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)skipBackwardWithParams:(MTRMediaPlaybackClusterSkipBackwardParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeMediaPlaybackID, (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandSkipBackwardID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterMediaPlayback - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster skipBackwardWithParams:params completion: - ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRMediaPlaybackClusterSkipBackwardParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeMediaPlaybackID) + commandID:@(MTRCommandIDTypeClusterMediaPlaybackCommandSkipBackwardID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRMediaPlaybackClusterPlaybackResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)seekWithParams:(MTRMediaPlaybackClusterSeekParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeMediaPlaybackID, (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandSeekID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterMediaPlayback - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster seekWithParams:params completion: - ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRMediaPlaybackClusterSeekParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeMediaPlaybackID) + commandID:@(MTRCommandIDTypeClusterMediaPlaybackCommandSeekID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRMediaPlaybackClusterPlaybackResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeCurrentStateWithParams:(MTRReadParams * _Nullable)params @@ -17145,37 +15580,28 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)selectInputWithParams:(MTRMediaInputClusterSelectInputParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeMediaInputID, (unsigned int) MTRCommandIDTypeClusterMediaInputCommandSelectInputID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterMediaInput - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster selectInputWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRMediaInputClusterSelectInputParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeMediaInputID) + commandID:@(MTRCommandIDTypeClusterMediaInputCommandSelectInputID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)showInputStatusWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion @@ -17184,37 +15610,28 @@ - (void)showInputStatusWithExpectedValues:(NSArray } - (void)showInputStatusWithParams:(MTRMediaInputClusterShowInputStatusParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeMediaInputID, (unsigned int) MTRCommandIDTypeClusterMediaInputCommandShowInputStatusID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterMediaInput - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster showInputStatusWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRMediaInputClusterShowInputStatusParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeMediaInputID) + commandID:@(MTRCommandIDTypeClusterMediaInputCommandShowInputStatusID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)hideInputStatusWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion @@ -17223,72 +15640,54 @@ - (void)hideInputStatusWithExpectedValues:(NSArray } - (void)hideInputStatusWithParams:(MTRMediaInputClusterHideInputStatusParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeMediaInputID, (unsigned int) MTRCommandIDTypeClusterMediaInputCommandHideInputStatusID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterMediaInput - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster hideInputStatusWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRMediaInputClusterHideInputStatusParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeMediaInputID) + commandID:@(MTRCommandIDTypeClusterMediaInputCommandHideInputStatusID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)renameInputWithParams:(MTRMediaInputClusterRenameInputParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeMediaInputID, (unsigned int) MTRCommandIDTypeClusterMediaInputCommandRenameInputID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterMediaInput - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster renameInputWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRMediaInputClusterRenameInputParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeMediaInputID) + commandID:@(MTRCommandIDTypeClusterMediaInputCommandRenameInputID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeInputListWithParams:(MTRReadParams * _Nullable)params @@ -17390,37 +15789,28 @@ - (void)sleepWithExpectedValues:(NSArray *> *)expec } - (void)sleepWithParams:(MTRLowPowerClusterSleepParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeLowPowerID, (unsigned int) MTRCommandIDTypeClusterLowPowerCommandSleepID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterLowPower - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster sleepWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRLowPowerClusterSleepParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeLowPowerID) + commandID:@(MTRCommandIDTypeClusterLowPowerCommandSleepID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params @@ -17489,37 +15879,28 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)sendKeyWithParams:(MTRKeypadInputClusterSendKeyParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRKeypadInputClusterSendKeyResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeKeypadInputID, (unsigned int) MTRCommandIDTypeClusterKeypadInputCommandSendKeyID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterKeypadInput - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster sendKeyWithParams:params completion: - ^(MTRKeypadInputClusterSendKeyResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRKeypadInputClusterSendKeyParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeKeypadInputID) + commandID:@(MTRCommandIDTypeClusterKeypadInputCommandSendKeyID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRKeypadInputClusterSendKeyResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params @@ -17587,72 +15968,54 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)launchContentWithParams:(MTRContentLauncherClusterLaunchContentParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRContentLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeContentLauncherID, (unsigned int) MTRCommandIDTypeClusterContentLauncherCommandLaunchContentID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterContentLauncher - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster launchContentWithParams:params completion: - ^(MTRContentLauncherClusterLauncherResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRContentLauncherClusterLaunchContentParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeContentLauncherID) + commandID:@(MTRCommandIDTypeClusterContentLauncherCommandLaunchContentID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRContentLauncherClusterLauncherResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)launchURLWithParams:(MTRContentLauncherClusterLaunchURLParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRContentLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeContentLauncherID, (unsigned int) MTRCommandIDTypeClusterContentLauncherCommandLaunchURLID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterContentLauncher - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster launchURLWithParams:params completion: - ^(MTRContentLauncherClusterLauncherResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRContentLauncherClusterLaunchURLParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeContentLauncherID) + commandID:@(MTRCommandIDTypeClusterContentLauncherCommandLaunchURLID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRContentLauncherClusterLauncherResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeAcceptHeaderWithParams:(MTRReadParams * _Nullable)params @@ -17749,72 +16112,54 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)selectOutputWithParams:(MTRAudioOutputClusterSelectOutputParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeAudioOutputID, (unsigned int) MTRCommandIDTypeClusterAudioOutputCommandSelectOutputID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterAudioOutput - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster selectOutputWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRAudioOutputClusterSelectOutputParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeAudioOutputID) + commandID:@(MTRCommandIDTypeClusterAudioOutputCommandSelectOutputID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)renameOutputWithParams:(MTRAudioOutputClusterRenameOutputParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeAudioOutputID, (unsigned int) MTRCommandIDTypeClusterAudioOutputCommandRenameOutputID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterAudioOutput - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster renameOutputWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRAudioOutputClusterRenameOutputParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeAudioOutputID) + commandID:@(MTRCommandIDTypeClusterAudioOutputCommandRenameOutputID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeOutputListWithParams:(MTRReadParams * _Nullable)params @@ -17894,107 +16239,80 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)launchAppWithParams:(MTRApplicationLauncherClusterLaunchAppParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeApplicationLauncherID, (unsigned int) MTRCommandIDTypeClusterApplicationLauncherCommandLaunchAppID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterApplicationLauncher - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster launchAppWithParams:params completion: - ^(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRApplicationLauncherClusterLaunchAppParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeApplicationLauncherID) + commandID:@(MTRCommandIDTypeClusterApplicationLauncherCommandLaunchAppID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRApplicationLauncherClusterLauncherResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)stopAppWithParams:(MTRApplicationLauncherClusterStopAppParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeApplicationLauncherID, (unsigned int) MTRCommandIDTypeClusterApplicationLauncherCommandStopAppID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterApplicationLauncher - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster stopAppWithParams:params completion: - ^(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRApplicationLauncherClusterStopAppParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeApplicationLauncherID) + commandID:@(MTRCommandIDTypeClusterApplicationLauncherCommandStopAppID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRApplicationLauncherClusterLauncherResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)hideAppWithParams:(MTRApplicationLauncherClusterHideAppParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeApplicationLauncherID, (unsigned int) MTRCommandIDTypeClusterApplicationLauncherCommandHideAppID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterApplicationLauncher - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster hideAppWithParams:params completion: - ^(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRApplicationLauncherClusterHideAppParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeApplicationLauncherID) + commandID:@(MTRCommandIDTypeClusterApplicationLauncherCommandHideAppID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRApplicationLauncherClusterLauncherResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeCatalogListWithParams:(MTRReadParams * _Nullable)params @@ -18194,72 +16512,60 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi - (void)getSetupPINWithParams:(MTRAccountLoginClusterGetSetupPINParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRAccountLoginClusterGetSetupPINResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeAccountLoginID, (unsigned int) MTRCommandIDTypeClusterAccountLoginCommandGetSetupPINID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterAccountLogin - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster getSetupPINWithParams:params completion: - ^(MTRAccountLoginClusterGetSetupPINResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRAccountLoginClusterGetSetupPINParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(10000); } + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeAccountLoginID) + commandID:@(MTRCommandIDTypeClusterAccountLoginCommandGetSetupPINID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRAccountLoginClusterGetSetupPINResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)loginWithParams:(MTRAccountLoginClusterLoginParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeAccountLoginID, (unsigned int) MTRCommandIDTypeClusterAccountLoginCommandLoginID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterAccountLogin - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster loginWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRAccountLoginClusterLoginParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(10000); } + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeAccountLoginID) + commandID:@(MTRCommandIDTypeClusterAccountLoginCommandLoginID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)logoutWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion @@ -18268,37 +16574,31 @@ - (void)logoutWithExpectedValues:(NSArray *> *)expe } - (void)logoutWithParams:(MTRAccountLoginClusterLogoutParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeAccountLoginID, (unsigned int) MTRCommandIDTypeClusterAccountLoginCommandLogoutID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterAccountLogin - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster logoutWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRAccountLoginClusterLogoutParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(10000); } + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeAccountLoginID) + commandID:@(MTRCommandIDTypeClusterAccountLoginCommandLogoutID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params @@ -18384,72 +16684,54 @@ - (void)getProfileInfoCommandWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeElectricalMeasurementID, (unsigned int) MTRCommandIDTypeClusterElectricalMeasurementCommandGetProfileInfoCommandID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterElectricalMeasurement - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster getProfileInfoCommandWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRElectricalMeasurementClusterGetProfileInfoCommandParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeElectricalMeasurementID) + commandID:@(MTRCommandIDTypeClusterElectricalMeasurementCommandGetProfileInfoCommandID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)getMeasurementProfileCommandWithParams:(MTRElectricalMeasurementClusterGetMeasurementProfileCommandParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeElectricalMeasurementID, (unsigned int) MTRCommandIDTypeClusterElectricalMeasurementCommandGetMeasurementProfileCommandID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterElectricalMeasurement - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster getMeasurementProfileCommandWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRElectricalMeasurementClusterGetMeasurementProfileCommandParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeElectricalMeasurementID) + commandID:@(MTRCommandIDTypeClusterElectricalMeasurementCommandGetMeasurementProfileCommandID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeMeasurementTypeWithParams:(MTRReadParams * _Nullable)params @@ -19255,37 +17537,28 @@ - (void)testWithExpectedValues:(NSArray *> *)expect } - (void)testWithParams:(MTRUnitTestingClusterTestParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)testNotHandledWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion @@ -19294,37 +17567,28 @@ - (void)testNotHandledWithExpectedValues:(NSArray * } - (void)testNotHandledWithParams:(MTRUnitTestingClusterTestNotHandledParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestNotHandledID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testNotHandledWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestNotHandledParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestNotHandledID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)testSpecificWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterTestSpecificResponseParams * _Nullable data, NSError * _Nullable error))completion @@ -19333,37 +17597,28 @@ - (void)testSpecificWithExpectedValues:(NSArray *> } - (void)testSpecificWithParams:(MTRUnitTestingClusterTestSpecificParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterTestSpecificResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestSpecificID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testSpecificWithParams:params completion: - ^(MTRUnitTestingClusterTestSpecificResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestSpecificParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestSpecificID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRUnitTestingClusterTestSpecificResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)testUnknownCommandWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion @@ -19372,527 +17627,392 @@ - (void)testUnknownCommandWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestUnknownCommandID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testUnknownCommandWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestUnknownCommandParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestUnknownCommandID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)testAddArgumentsWithParams:(MTRUnitTestingClusterTestAddArgumentsParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterTestAddArgumentsResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestAddArgumentsID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testAddArgumentsWithParams:params completion: - ^(MTRUnitTestingClusterTestAddArgumentsResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestAddArgumentsParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestAddArgumentsID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRUnitTestingClusterTestAddArgumentsResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)testSimpleArgumentRequestWithParams:(MTRUnitTestingClusterTestSimpleArgumentRequestParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterTestSimpleArgumentResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestSimpleArgumentRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testSimpleArgumentRequestWithParams:params completion: - ^(MTRUnitTestingClusterTestSimpleArgumentResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestSimpleArgumentRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestSimpleArgumentRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRUnitTestingClusterTestSimpleArgumentResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)testStructArrayArgumentRequestWithParams:(MTRUnitTestingClusterTestStructArrayArgumentRequestParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterTestStructArrayArgumentResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestStructArrayArgumentRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testStructArrayArgumentRequestWithParams:params completion: - ^(MTRUnitTestingClusterTestStructArrayArgumentResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestStructArrayArgumentRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestStructArrayArgumentRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRUnitTestingClusterTestStructArrayArgumentResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)testStructArgumentRequestWithParams:(MTRUnitTestingClusterTestStructArgumentRequestParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterBooleanResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestStructArgumentRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testStructArgumentRequestWithParams:params completion: - ^(MTRUnitTestingClusterBooleanResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestStructArgumentRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestStructArgumentRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRUnitTestingClusterBooleanResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)testNestedStructArgumentRequestWithParams:(MTRUnitTestingClusterTestNestedStructArgumentRequestParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterBooleanResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestNestedStructArgumentRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testNestedStructArgumentRequestWithParams:params completion: - ^(MTRUnitTestingClusterBooleanResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestNestedStructArgumentRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestNestedStructArgumentRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRUnitTestingClusterBooleanResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)testListStructArgumentRequestWithParams:(MTRUnitTestingClusterTestListStructArgumentRequestParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterBooleanResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestListStructArgumentRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testListStructArgumentRequestWithParams:params completion: - ^(MTRUnitTestingClusterBooleanResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestListStructArgumentRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestListStructArgumentRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRUnitTestingClusterBooleanResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)testListInt8UArgumentRequestWithParams:(MTRUnitTestingClusterTestListInt8UArgumentRequestParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterBooleanResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestListInt8UArgumentRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testListInt8UArgumentRequestWithParams:params completion: - ^(MTRUnitTestingClusterBooleanResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestListInt8UArgumentRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestListInt8UArgumentRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRUnitTestingClusterBooleanResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)testNestedStructListArgumentRequestWithParams:(MTRUnitTestingClusterTestNestedStructListArgumentRequestParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterBooleanResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestNestedStructListArgumentRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testNestedStructListArgumentRequestWithParams:params completion: - ^(MTRUnitTestingClusterBooleanResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestNestedStructListArgumentRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestNestedStructListArgumentRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRUnitTestingClusterBooleanResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)testListNestedStructListArgumentRequestWithParams:(MTRUnitTestingClusterTestListNestedStructListArgumentRequestParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterBooleanResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestListNestedStructListArgumentRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testListNestedStructListArgumentRequestWithParams:params completion: - ^(MTRUnitTestingClusterBooleanResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestListNestedStructListArgumentRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestListNestedStructListArgumentRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRUnitTestingClusterBooleanResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)testListInt8UReverseRequestWithParams:(MTRUnitTestingClusterTestListInt8UReverseRequestParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterTestListInt8UReverseResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestListInt8UReverseRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testListInt8UReverseRequestWithParams:params completion: - ^(MTRUnitTestingClusterTestListInt8UReverseResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestListInt8UReverseRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestListInt8UReverseRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRUnitTestingClusterTestListInt8UReverseResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)testEnumsRequestWithParams:(MTRUnitTestingClusterTestEnumsRequestParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterTestEnumsResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestEnumsRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testEnumsRequestWithParams:params completion: - ^(MTRUnitTestingClusterTestEnumsResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestEnumsRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestEnumsRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRUnitTestingClusterTestEnumsResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)testNullableOptionalRequestWithParams:(MTRUnitTestingClusterTestNullableOptionalRequestParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterTestNullableOptionalResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestNullableOptionalRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testNullableOptionalRequestWithParams:params completion: - ^(MTRUnitTestingClusterTestNullableOptionalResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestNullableOptionalRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestNullableOptionalRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRUnitTestingClusterTestNullableOptionalResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)testComplexNullableOptionalRequestWithParams:(MTRUnitTestingClusterTestComplexNullableOptionalRequestParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterTestComplexNullableOptionalResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestComplexNullableOptionalRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testComplexNullableOptionalRequestWithParams:params completion: - ^(MTRUnitTestingClusterTestComplexNullableOptionalResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestComplexNullableOptionalRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestComplexNullableOptionalRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRUnitTestingClusterTestComplexNullableOptionalResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)simpleStructEchoRequestWithParams:(MTRUnitTestingClusterSimpleStructEchoRequestParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterSimpleStructResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandSimpleStructEchoRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster simpleStructEchoRequestWithParams:params completion: - ^(MTRUnitTestingClusterSimpleStructResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterSimpleStructEchoRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandSimpleStructEchoRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRUnitTestingClusterSimpleStructResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)timedInvokeRequestWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion @@ -19901,142 +18021,109 @@ - (void)timedInvokeRequestWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTimedInvokeRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster timedInvokeRequestWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTimedInvokeRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(10000); } + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTimedInvokeRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)testSimpleOptionalArgumentRequestWithParams:(MTRUnitTestingClusterTestSimpleOptionalArgumentRequestParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestSimpleOptionalArgumentRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testSimpleOptionalArgumentRequestWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestSimpleOptionalArgumentRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestSimpleOptionalArgumentRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)testEmitTestEventRequestWithParams:(MTRUnitTestingClusterTestEmitTestEventRequestParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterTestEmitTestEventResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestEmitTestEventRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testEmitTestEventRequestWithParams:params completion: - ^(MTRUnitTestingClusterTestEmitTestEventResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestEmitTestEventRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestEmitTestEventRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRUnitTestingClusterTestEmitTestEventResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (void)testEmitTestFabricScopedEventRequestWithParams:(MTRUnitTestingClusterTestEmitTestFabricScopedEventRequestParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterTestEmitTestFabricScopedEventResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestEmitTestFabricScopedEventRequestID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterUnitTesting - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster testEmitTestFabricScopedEventRequestWithParams:params completion: - ^(MTRUnitTestingClusterTestEmitTestFabricScopedEventResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRUnitTestingClusterTestEmitTestFabricScopedEventRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeUnitTestingID) + commandID:@(MTRCommandIDTypeClusterUnitTestingCommandTestEmitTestFabricScopedEventRequestID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRUnitTestingClusterTestEmitTestFabricScopedEventResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeBooleanWithParams:(MTRReadParams * _Nullable)params @@ -20755,6 +18842,9 @@ - (void)writeAttributeTimedWriteBooleanWithValue:(NSDictionary * - (void)writeAttributeTimedWriteBooleanWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params { NSNumber * timedWriteTimeout = params.timedWriteTimeout; + if (!timedWriteTimeout) { + timedWriteTimeout = @(10000); + } [self.device writeAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeUnitTestingID) attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeTimedWriteBooleanID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; } @@ -21595,72 +19685,54 @@ - (void)pingWithExpectedValues:(NSArray *> *)expect } - (void)pingWithParams:(MTRSampleMEIClusterPingParams * _Nullable)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeSampleMEIID, (unsigned int) MTRCommandIDTypeClusterSampleMEICommandPingID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterSampleMEI - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster pingWithParams:params completion: - ^(NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, nil, error); - dispatch_async(self.callbackQueue, ^{ - completion(error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRSampleMEIClusterPingParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeSampleMEIID) + commandID:@(MTRCommandIDTypeClusterSampleMEICommandPingID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; } - (void)addArgumentsWithParams:(MTRSampleMEIClusterAddArgumentsParams *)params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRSampleMEIClusterAddArgumentsResponseParams * _Nullable data, NSError * _Nullable error))completion { - NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int) MTRClusterIDTypeSampleMEIID, (unsigned int) MTRCommandIDTypeClusterSampleMEICommandAddArgumentsID]; - // Make a copy of params before we go async. - params = [params copy]; - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; - workItem.readyHandler = ^(MTRDevice * device, NSInteger retryCount, MTRAsyncWorkCompletionBlock workCompletion) { - MTRClustersLogDequeue(logPrefix, self.device.asyncWorkQueue); - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; - auto * cluster = [[MTRBaseClusterSampleMEI - alloc] initWithDevice:baseDevice - endpointID:@(self.endpoint) - queue:self.device.queue]; - [cluster addArgumentsWithParams:params completion: - ^(MTRSampleMEIClusterAddArgumentsResponseParams * _Nullable value, NSError * _Nullable error) { - MTRClustersLogCompletion(logPrefix, value, error); - dispatch_async(self.callbackQueue, ^{ - completion(value, error); - }); - workCompletion(MTRAsyncWorkComplete); - }]; + if (params == nil) { + params = [[MTRSampleMEIClusterAddArgumentsParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); }; - MTRClustersLogEnqueue(logPrefix, self.device.asyncWorkQueue); - [self.device.asyncWorkQueue enqueueWorkItem:workItem]; - if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { - expectedValues = nil; - } else { - expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); - } - if (expectedValues) { - [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; - } + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(MTRClusterIDTypeSampleMEIID) + commandID:@(MTRCommandIDTypeClusterSampleMEICommandAddArgumentsID) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRSampleMEIClusterAddArgumentsResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; } - (NSDictionary *)readAttributeFlipFlopWithParams:(MTRReadParams * _Nullable)params diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 6f19149ac0cb1d..c9e838300eff1a 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -26,6 +26,9 @@ #include #include +#include +#include +#include NS_ASSUME_NONNULL_BEGIN @@ -59,6 +62,55 @@ - (NSString *)description } @end + +@implementation MTRIdentifyClusterIdentifyParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Identify::Commands::Identify::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.identifyTime = self.identifyTime.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRIdentifyClusterTriggerEffectParams - (instancetype)init { @@ -92,6 +144,58 @@ - (NSString *)description } @end + +@implementation MTRIdentifyClusterTriggerEffectParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Identify::Commands::TriggerEffect::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.effectIdentifier = static_cast>(self.effectIdentifier.unsignedCharValue); + } + { + encodableStruct.effectVariant = static_cast>(self.effectVariant.unsignedCharValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRGroupsClusterAddGroupParams - (instancetype)init { @@ -126,6 +230,57 @@ - (NSString *)description @end +@implementation MTRGroupsClusterAddGroupParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Groups::Commands::AddGroup::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.groupID = self.groupID.unsignedShortValue; + } + { + encodableStruct.groupName = AsCharSpan(self.groupName); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRGroupsClusterAddGroupParams (Deprecated) - (void)setGroupId:(NSNumber * _Nonnull)groupId @@ -222,6 +377,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Groups:: } return CHIP_NO_ERROR; } + @end @implementation MTRGroupsClusterAddGroupResponseParams (Deprecated) @@ -267,6 +423,54 @@ - (NSString *)description @end +@implementation MTRGroupsClusterViewGroupParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Groups::Commands::ViewGroup::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.groupID = self.groupID.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRGroupsClusterViewGroupParams (Deprecated) - (void)setGroupId:(NSNumber * _Nonnull)groupId @@ -373,6 +577,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Groups:: } return CHIP_NO_ERROR; } + @end @implementation MTRGroupsClusterViewGroupResponseParams (Deprecated) @@ -417,6 +622,76 @@ - (NSString *)description } @end + +@implementation MTRGroupsClusterGetGroupMembershipParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Groups::Commands::GetGroupMembership::Type encodableStruct; + ListFreer listFreer; + { + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (self.groupList.count != 0) { + auto * listHolder_0 = new ListHolder(self.groupList.count); + if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_0); + for (size_t i_0 = 0; i_0 < self.groupList.count; ++i_0) { + if (![self.groupList[i_0] isKindOfClass:[NSNumber class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_0 = (NSNumber *) self.groupList[i_0]; + listHolder_0->mList[i_0] = element_0.unsignedShortValue; + } + encodableStruct.groupList = ListType_0(listHolder_0->mList, self.groupList.count); + } else { + encodableStruct.groupList = ListType_0(); + } + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRGroupsClusterGetGroupMembershipResponseParams - (instancetype)init { @@ -519,7 +794,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Groups:: } return CHIP_NO_ERROR; } + @end + @implementation MTRGroupsClusterRemoveGroupParams - (instancetype)init { @@ -551,6 +828,54 @@ - (NSString *)description @end +@implementation MTRGroupsClusterRemoveGroupParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Groups::Commands::RemoveGroup::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.groupID = self.groupID.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRGroupsClusterRemoveGroupParams (Deprecated) - (void)setGroupId:(NSNumber * _Nonnull)groupId @@ -647,6 +972,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Groups:: } return CHIP_NO_ERROR; } + @end @implementation MTRGroupsClusterRemoveGroupResponseParams (Deprecated) @@ -688,6 +1014,52 @@ - (NSString *)description } @end + +@implementation MTRGroupsClusterRemoveAllGroupsParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Groups::Commands::RemoveAllGroups::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRGroupsClusterAddGroupIfIdentifyingParams - (instancetype)init { @@ -722,6 +1094,57 @@ - (NSString *)description @end +@implementation MTRGroupsClusterAddGroupIfIdentifyingParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Groups::Commands::AddGroupIfIdentifying::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.groupID = self.groupID.unsignedShortValue; + } + { + encodableStruct.groupName = AsCharSpan(self.groupName); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRGroupsClusterAddGroupIfIdentifyingParams (Deprecated) - (void)setGroupId:(NSNumber * _Nonnull)groupId @@ -777,6 +1200,110 @@ - (NSString *)description @end +@implementation MTRScenesClusterAddSceneParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Scenes::Commands::AddScene::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.groupID = self.groupID.unsignedShortValue; + } + { + encodableStruct.sceneID = self.sceneID.unsignedCharValue; + } + { + encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; + } + { + encodableStruct.sceneName = AsCharSpan(self.sceneName); + } + { + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (self.extensionFieldSets.count != 0) { + auto * listHolder_0 = new ListHolder(self.extensionFieldSets.count); + if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_0); + for (size_t i_0 = 0; i_0 < self.extensionFieldSets.count; ++i_0) { + if (![self.extensionFieldSets[i_0] isKindOfClass:[MTRScenesClusterExtensionFieldSet class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_0 = (MTRScenesClusterExtensionFieldSet *) self.extensionFieldSets[i_0]; + listHolder_0->mList[i_0].clusterID = element_0.clusterID.unsignedIntValue; + { + using ListType_2 = std::remove_reference_tmList[i_0].attributeValueList)>; + using ListMemberType_2 = ListMemberTypeGetter::Type; + if (element_0.attributeValueList.count != 0) { + auto * listHolder_2 = new ListHolder(element_0.attributeValueList.count); + if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_2); + for (size_t i_2 = 0; i_2 < element_0.attributeValueList.count; ++i_2) { + if (![element_0.attributeValueList[i_2] isKindOfClass:[MTRScenesClusterAttributeValuePair class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_2 = (MTRScenesClusterAttributeValuePair *) element_0.attributeValueList[i_2]; + listHolder_2->mList[i_2].attributeID = element_2.attributeID.unsignedIntValue; + listHolder_2->mList[i_2].attributeValue = element_2.attributeValue.unsignedIntValue; + } + listHolder_0->mList[i_0].attributeValueList = ListType_2(listHolder_2->mList, element_0.attributeValueList.count); + } else { + listHolder_0->mList[i_0].attributeValueList = ListType_2(); + } + } + } + encodableStruct.extensionFieldSets = ListType_0(listHolder_0->mList, self.extensionFieldSets.count); + } else { + encodableStruct.extensionFieldSets = ListType_0(); + } + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRScenesClusterAddSceneParams (Deprecated) - (void)setGroupId:(NSNumber * _Nonnull)groupId @@ -889,6 +1416,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes:: } return CHIP_NO_ERROR; } + @end @implementation MTRScenesClusterAddSceneResponseParams (Deprecated) @@ -947,17 +1475,68 @@ - (NSString *)description @end -@implementation MTRScenesClusterViewSceneParams (Deprecated) - -- (void)setGroupId:(NSNumber * _Nonnull)groupId -{ - self.groupID = groupId; -} +@implementation MTRScenesClusterViewSceneParams (InternalMethods) -- (NSNumber * _Nonnull)groupId +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader { - return self.groupID; -} + chip::app::Clusters::Scenes::Commands::ViewScene::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.groupID = self.groupID.unsignedShortValue; + } + { + encodableStruct.sceneID = self.sceneID.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +@implementation MTRScenesClusterViewSceneParams (Deprecated) + +- (void)setGroupId:(NSNumber * _Nonnull)groupId +{ + self.groupID = groupId; +} + +- (NSNumber * _Nonnull)groupId +{ + return self.groupID; +} - (void)setSceneId:(NSNumber * _Nonnull)sceneId { @@ -1125,6 +1704,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes:: } return CHIP_NO_ERROR; } + @end @implementation MTRScenesClusterViewSceneResponseParams (Deprecated) @@ -1183,6 +1763,57 @@ - (NSString *)description @end +@implementation MTRScenesClusterRemoveSceneParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Scenes::Commands::RemoveScene::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.groupID = self.groupID.unsignedShortValue; + } + { + encodableStruct.sceneID = self.sceneID.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRScenesClusterRemoveSceneParams (Deprecated) - (void)setGroupId:(NSNumber * _Nonnull)groupId @@ -1295,6 +1926,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes:: } return CHIP_NO_ERROR; } + @end @implementation MTRScenesClusterRemoveSceneResponseParams (Deprecated) @@ -1350,6 +1982,54 @@ - (NSString *)description @end +@implementation MTRScenesClusterRemoveAllScenesParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Scenes::Commands::RemoveAllScenes::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.groupID = self.groupID.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRScenesClusterRemoveAllScenesParams (Deprecated) - (void)setGroupId:(NSNumber * _Nonnull)groupId @@ -1446,6 +2126,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes:: } return CHIP_NO_ERROR; } + @end @implementation MTRScenesClusterRemoveAllScenesResponseParams (Deprecated) @@ -1494,6 +2175,57 @@ - (NSString *)description @end +@implementation MTRScenesClusterStoreSceneParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Scenes::Commands::StoreScene::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.groupID = self.groupID.unsignedShortValue; + } + { + encodableStruct.sceneID = self.sceneID.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRScenesClusterStoreSceneParams (Deprecated) - (void)setGroupId:(NSNumber * _Nonnull)groupId @@ -1606,6 +2338,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes:: } return CHIP_NO_ERROR; } + @end @implementation MTRScenesClusterStoreSceneResponseParams (Deprecated) @@ -1667,6 +2400,68 @@ - (NSString *)description @end +@implementation MTRScenesClusterRecallSceneParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Scenes::Commands::RecallScene::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.groupID = self.groupID.unsignedShortValue; + } + { + encodableStruct.sceneID = self.sceneID.unsignedCharValue; + } + { + if (self.transitionTime != nil) { + auto & definedValue_0 = encodableStruct.transitionTime.Emplace(); + if (self.transitionTime == nil) { + definedValue_0.SetNull(); + } else { + auto & nonNullValue_1 = definedValue_0.SetNonNull(); + nonNullValue_1 = self.transitionTime.unsignedShortValue; + } + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRScenesClusterRecallSceneParams (Deprecated) - (void)setGroupId:(NSNumber * _Nonnull)groupId @@ -1720,6 +2515,54 @@ - (NSString *)description @end +@implementation MTRScenesClusterGetSceneMembershipParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Scenes::Commands::GetSceneMembership::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.groupID = self.groupID.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRScenesClusterGetSceneMembershipParams (Deprecated) - (void)setGroupId:(NSNumber * _Nonnull)groupId @@ -1850,6 +2693,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes:: } return CHIP_NO_ERROR; } + @end @implementation MTRScenesClusterGetSceneMembershipResponseParams (Deprecated) @@ -1907,6 +2751,110 @@ - (NSString *)description @end +@implementation MTRScenesClusterEnhancedAddSceneParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Scenes::Commands::EnhancedAddScene::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.groupID = self.groupID.unsignedShortValue; + } + { + encodableStruct.sceneID = self.sceneID.unsignedCharValue; + } + { + encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; + } + { + encodableStruct.sceneName = AsCharSpan(self.sceneName); + } + { + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (self.extensionFieldSets.count != 0) { + auto * listHolder_0 = new ListHolder(self.extensionFieldSets.count); + if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_0); + for (size_t i_0 = 0; i_0 < self.extensionFieldSets.count; ++i_0) { + if (![self.extensionFieldSets[i_0] isKindOfClass:[MTRScenesClusterExtensionFieldSet class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_0 = (MTRScenesClusterExtensionFieldSet *) self.extensionFieldSets[i_0]; + listHolder_0->mList[i_0].clusterID = element_0.clusterID.unsignedIntValue; + { + using ListType_2 = std::remove_reference_tmList[i_0].attributeValueList)>; + using ListMemberType_2 = ListMemberTypeGetter::Type; + if (element_0.attributeValueList.count != 0) { + auto * listHolder_2 = new ListHolder(element_0.attributeValueList.count); + if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_2); + for (size_t i_2 = 0; i_2 < element_0.attributeValueList.count; ++i_2) { + if (![element_0.attributeValueList[i_2] isKindOfClass:[MTRScenesClusterAttributeValuePair class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_2 = (MTRScenesClusterAttributeValuePair *) element_0.attributeValueList[i_2]; + listHolder_2->mList[i_2].attributeID = element_2.attributeID.unsignedIntValue; + listHolder_2->mList[i_2].attributeValue = element_2.attributeValue.unsignedIntValue; + } + listHolder_0->mList[i_0].attributeValueList = ListType_2(listHolder_2->mList, element_0.attributeValueList.count); + } else { + listHolder_0->mList[i_0].attributeValueList = ListType_2(); + } + } + } + encodableStruct.extensionFieldSets = ListType_0(listHolder_0->mList, self.extensionFieldSets.count); + } else { + encodableStruct.extensionFieldSets = ListType_0(); + } + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRScenesClusterEnhancedAddSceneParams (Deprecated) - (void)setGroupId:(NSNumber * _Nonnull)groupId @@ -2019,6 +2967,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes:: } return CHIP_NO_ERROR; } + @end @implementation MTRScenesClusterEnhancedAddSceneResponseParams (Deprecated) @@ -2077,6 +3026,57 @@ - (NSString *)description @end +@implementation MTRScenesClusterEnhancedViewSceneParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Scenes::Commands::EnhancedViewScene::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.groupID = self.groupID.unsignedShortValue; + } + { + encodableStruct.sceneID = self.sceneID.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRScenesClusterEnhancedViewSceneParams (Deprecated) - (void)setGroupId:(NSNumber * _Nonnull)groupId @@ -2255,6 +3255,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes:: } return CHIP_NO_ERROR; } + @end @implementation MTRScenesClusterEnhancedViewSceneResponseParams (Deprecated) @@ -2322,26 +3323,86 @@ - (NSString *)description @end -@implementation MTRScenesClusterCopySceneParams (Deprecated) +@implementation MTRScenesClusterCopySceneParams (InternalMethods) -- (void)setGroupIdFrom:(NSNumber * _Nonnull)groupIdFrom +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader { - self.groupIdentifierFrom = groupIdFrom; -} + chip::app::Clusters::Scenes::Commands::CopyScene::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.mode = static_cast>(self.mode.unsignedCharValue); + } + { + encodableStruct.groupIdentifierFrom = self.groupIdentifierFrom.unsignedShortValue; + } + { + encodableStruct.sceneIdentifierFrom = self.sceneIdentifierFrom.unsignedCharValue; + } + { + encodableStruct.groupIdentifierTo = self.groupIdentifierTo.unsignedShortValue; + } + { + encodableStruct.sceneIdentifierTo = self.sceneIdentifierTo.unsignedCharValue; + } -- (NSNumber * _Nonnull)groupIdFrom -{ - return self.groupIdentifierFrom; -} + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } -- (void)setSceneIdFrom:(NSNumber * _Nonnull)sceneIdFrom -{ - self.sceneIdentifierFrom = sceneIdFrom; -} + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); -- (NSNumber * _Nonnull)sceneIdFrom -{ - return self.sceneIdentifierFrom; + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +@implementation MTRScenesClusterCopySceneParams (Deprecated) + +- (void)setGroupIdFrom:(NSNumber * _Nonnull)groupIdFrom +{ + self.groupIdentifierFrom = groupIdFrom; +} + +- (NSNumber * _Nonnull)groupIdFrom +{ + return self.groupIdentifierFrom; +} + +- (void)setSceneIdFrom:(NSNumber * _Nonnull)sceneIdFrom +{ + self.sceneIdentifierFrom = sceneIdFrom; +} + +- (NSNumber * _Nonnull)sceneIdFrom +{ + return self.sceneIdentifierFrom; } - (void)setGroupIdTo:(NSNumber * _Nonnull)groupIdTo @@ -2454,6 +3515,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes:: } return CHIP_NO_ERROR; } + @end @implementation MTRScenesClusterCopySceneResponseParams (Deprecated) @@ -2505,6 +3567,52 @@ - (NSString *)description } @end + +@implementation MTROnOffClusterOffParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OnOff::Commands::Off::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROnOffClusterOnParams - (instancetype)init { @@ -2532,6 +3640,52 @@ - (NSString *)description } @end + +@implementation MTROnOffClusterOnParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OnOff::Commands::On::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROnOffClusterToggleParams - (instancetype)init { @@ -2559,6 +3713,52 @@ - (NSString *)description } @end + +@implementation MTROnOffClusterToggleParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OnOff::Commands::Toggle::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROnOffClusterOffWithEffectParams - (instancetype)init { @@ -2593,6 +3793,57 @@ - (NSString *)description @end +@implementation MTROnOffClusterOffWithEffectParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OnOff::Commands::OffWithEffect::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.effectIdentifier = static_cast>(self.effectIdentifier.unsignedCharValue); + } + { + encodableStruct.effectVariant = self.effectVariant.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROnOffClusterOffWithEffectParams (Deprecated) - (void)setEffectId:(NSNumber * _Nonnull)effectId @@ -2632,6 +3883,52 @@ - (NSString *)description } @end + +@implementation MTROnOffClusterOnWithRecallGlobalSceneParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OnOff::Commands::OnWithRecallGlobalScene::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROnOffClusterOnWithTimedOffParams - (instancetype)init { @@ -2668,6 +3965,61 @@ - (NSString *)description } @end + +@implementation MTROnOffClusterOnWithTimedOffParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.onOffControl = static_cast>(self.onOffControl.unsignedCharValue); + } + { + encodableStruct.onTime = self.onTime.unsignedShortValue; + } + { + encodableStruct.offWaitTime = self.offWaitTime.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRLevelControlClusterMoveToLevelParams - (instancetype)init { @@ -2707,6 +4059,69 @@ - (NSString *)description } @end + +@implementation MTRLevelControlClusterMoveToLevelParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.level = self.level.unsignedCharValue; + } + { + if (self.transitionTime == nil) { + encodableStruct.transitionTime.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.transitionTime.SetNonNull(); + nonNullValue_0 = self.transitionTime.unsignedShortValue; + } + } + { + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); + } + { + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRLevelControlClusterMoveParams - (instancetype)init { @@ -2746,6 +4161,69 @@ - (NSString *)description } @end + +@implementation MTRLevelControlClusterMoveParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::LevelControl::Commands::Move::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.moveMode = static_cast>(self.moveMode.unsignedCharValue); + } + { + if (self.rate == nil) { + encodableStruct.rate.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.rate.SetNonNull(); + nonNullValue_0 = self.rate.unsignedCharValue; + } + } + { + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); + } + { + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRLevelControlClusterStepParams - (instancetype)init { @@ -2788,27 +4266,93 @@ - (NSString *)description } @end -@implementation MTRLevelControlClusterStopParams -- (instancetype)init -{ - if (self = [super init]) { - - _optionsMask = @(0); - _optionsOverride = @(0); - _timedInvokeTimeoutMs = nil; - _serverSideProcessingTimeout = nil; - } - return self; -} +@implementation MTRLevelControlClusterStepParams (InternalMethods) -- (id)copyWithZone:(NSZone * _Nullable)zone; +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader { - auto other = [[MTRLevelControlClusterStopParams alloc] init]; - - other.optionsMask = self.optionsMask; - other.optionsOverride = self.optionsOverride; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + chip::app::Clusters::LevelControl::Commands::Step::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.stepMode = static_cast>(self.stepMode.unsignedCharValue); + } + { + encodableStruct.stepSize = self.stepSize.unsignedCharValue; + } + { + if (self.transitionTime == nil) { + encodableStruct.transitionTime.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.transitionTime.SetNonNull(); + nonNullValue_0 = self.transitionTime.unsignedShortValue; + } + } + { + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); + } + { + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +@implementation MTRLevelControlClusterStopParams +- (instancetype)init +{ + if (self = [super init]) { + + _optionsMask = @(0); + + _optionsOverride = @(0); + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRLevelControlClusterStopParams alloc] init]; + + other.optionsMask = self.optionsMask; + other.optionsOverride = self.optionsOverride; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; return other; @@ -2821,6 +4365,58 @@ - (NSString *)description } @end + +@implementation MTRLevelControlClusterStopParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::LevelControl::Commands::Stop::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); + } + { + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRLevelControlClusterMoveToLevelWithOnOffParams - (instancetype)init { @@ -2860,6 +4456,69 @@ - (NSString *)description } @end + +@implementation MTRLevelControlClusterMoveToLevelWithOnOffParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::LevelControl::Commands::MoveToLevelWithOnOff::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.level = self.level.unsignedCharValue; + } + { + if (self.transitionTime == nil) { + encodableStruct.transitionTime.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.transitionTime.SetNonNull(); + nonNullValue_0 = self.transitionTime.unsignedShortValue; + } + } + { + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); + } + { + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRLevelControlClusterMoveWithOnOffParams - (instancetype)init { @@ -2899,6 +4558,69 @@ - (NSString *)description } @end + +@implementation MTRLevelControlClusterMoveWithOnOffParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::LevelControl::Commands::MoveWithOnOff::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.moveMode = static_cast>(self.moveMode.unsignedCharValue); + } + { + if (self.rate == nil) { + encodableStruct.rate.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.rate.SetNonNull(); + nonNullValue_0 = self.rate.unsignedCharValue; + } + } + { + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); + } + { + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRLevelControlClusterStepWithOnOffParams - (instancetype)init { @@ -2941,6 +4663,72 @@ - (NSString *)description } @end + +@implementation MTRLevelControlClusterStepWithOnOffParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::LevelControl::Commands::StepWithOnOff::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.stepMode = static_cast>(self.stepMode.unsignedCharValue); + } + { + encodableStruct.stepSize = self.stepSize.unsignedCharValue; + } + { + if (self.transitionTime == nil) { + encodableStruct.transitionTime.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.transitionTime.SetNonNull(); + nonNullValue_0 = self.transitionTime.unsignedShortValue; + } + } + { + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); + } + { + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRLevelControlClusterStopWithOnOffParams - (instancetype)init { @@ -2974,6 +4762,58 @@ - (NSString *)description } @end + +@implementation MTRLevelControlClusterStopWithOnOffParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::LevelControl::Commands::StopWithOnOff::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); + } + { + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRLevelControlClusterMoveToClosestFrequencyParams - (instancetype)init { @@ -3004,6 +4844,55 @@ - (NSString *)description } @end + +@implementation MTRLevelControlClusterMoveToClosestFrequencyParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::LevelControl::Commands::MoveToClosestFrequency::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.frequency = self.frequency.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRActionsClusterInstantActionParams - (instancetype)init { @@ -3037,6 +4926,61 @@ - (NSString *)description } @end + +@implementation MTRActionsClusterInstantActionParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Actions::Commands::InstantAction::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.actionID = self.actionID.unsignedShortValue; + } + { + if (self.invokeID != nil) { + auto & definedValue_0 = encodableStruct.invokeID.Emplace(); + definedValue_0 = self.invokeID.unsignedIntValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRActionsClusterInstantActionWithTransitionParams - (instancetype)init { @@ -3073,6 +5017,64 @@ - (NSString *)description } @end + +@implementation MTRActionsClusterInstantActionWithTransitionParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Actions::Commands::InstantActionWithTransition::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.actionID = self.actionID.unsignedShortValue; + } + { + if (self.invokeID != nil) { + auto & definedValue_0 = encodableStruct.invokeID.Emplace(); + definedValue_0 = self.invokeID.unsignedIntValue; + } + } + { + encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRActionsClusterStartActionParams - (instancetype)init { @@ -3106,6 +5108,61 @@ - (NSString *)description } @end + +@implementation MTRActionsClusterStartActionParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Actions::Commands::StartAction::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.actionID = self.actionID.unsignedShortValue; + } + { + if (self.invokeID != nil) { + auto & definedValue_0 = encodableStruct.invokeID.Emplace(); + definedValue_0 = self.invokeID.unsignedIntValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRActionsClusterStartActionWithDurationParams - (instancetype)init { @@ -3142,6 +5199,64 @@ - (NSString *)description } @end + +@implementation MTRActionsClusterStartActionWithDurationParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Actions::Commands::StartActionWithDuration::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.actionID = self.actionID.unsignedShortValue; + } + { + if (self.invokeID != nil) { + auto & definedValue_0 = encodableStruct.invokeID.Emplace(); + definedValue_0 = self.invokeID.unsignedIntValue; + } + } + { + encodableStruct.duration = self.duration.unsignedIntValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRActionsClusterStopActionParams - (instancetype)init { @@ -3175,6 +5290,61 @@ - (NSString *)description } @end + +@implementation MTRActionsClusterStopActionParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Actions::Commands::StopAction::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.actionID = self.actionID.unsignedShortValue; + } + { + if (self.invokeID != nil) { + auto & definedValue_0 = encodableStruct.invokeID.Emplace(); + definedValue_0 = self.invokeID.unsignedIntValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRActionsClusterPauseActionParams - (instancetype)init { @@ -3208,6 +5378,61 @@ - (NSString *)description } @end + +@implementation MTRActionsClusterPauseActionParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Actions::Commands::PauseAction::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.actionID = self.actionID.unsignedShortValue; + } + { + if (self.invokeID != nil) { + auto & definedValue_0 = encodableStruct.invokeID.Emplace(); + definedValue_0 = self.invokeID.unsignedIntValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRActionsClusterPauseActionWithDurationParams - (instancetype)init { @@ -3244,6 +5469,64 @@ - (NSString *)description } @end + +@implementation MTRActionsClusterPauseActionWithDurationParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Actions::Commands::PauseActionWithDuration::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.actionID = self.actionID.unsignedShortValue; + } + { + if (self.invokeID != nil) { + auto & definedValue_0 = encodableStruct.invokeID.Emplace(); + definedValue_0 = self.invokeID.unsignedIntValue; + } + } + { + encodableStruct.duration = self.duration.unsignedIntValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRActionsClusterResumeActionParams - (instancetype)init { @@ -3277,6 +5560,61 @@ - (NSString *)description } @end + +@implementation MTRActionsClusterResumeActionParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Actions::Commands::ResumeAction::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.actionID = self.actionID.unsignedShortValue; + } + { + if (self.invokeID != nil) { + auto & definedValue_0 = encodableStruct.invokeID.Emplace(); + definedValue_0 = self.invokeID.unsignedIntValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRActionsClusterEnableActionParams - (instancetype)init { @@ -3310,6 +5648,61 @@ - (NSString *)description } @end + +@implementation MTRActionsClusterEnableActionParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Actions::Commands::EnableAction::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.actionID = self.actionID.unsignedShortValue; + } + { + if (self.invokeID != nil) { + auto & definedValue_0 = encodableStruct.invokeID.Emplace(); + definedValue_0 = self.invokeID.unsignedIntValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRActionsClusterEnableActionWithDurationParams - (instancetype)init { @@ -3336,16 +5729,74 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; - return other; + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: actionID:%@; invokeID:%@; duration:%@; >", NSStringFromClass([self class]), _actionID, _invokeID, _duration]; + return descriptionString; +} + +@end + +@implementation MTRActionsClusterEnableActionWithDurationParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Actions::Commands::EnableActionWithDuration::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.actionID = self.actionID.unsignedShortValue; + } + { + if (self.invokeID != nil) { + auto & definedValue_0 = encodableStruct.invokeID.Emplace(); + definedValue_0 = self.invokeID.unsignedIntValue; + } + } + { + encodableStruct.duration = self.duration.unsignedIntValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); } -- (NSString *)description +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: actionID:%@; invokeID:%@; duration:%@; >", NSStringFromClass([self class]), _actionID, _invokeID, _duration]; - return descriptionString; -} + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} @end + @implementation MTRActionsClusterDisableActionParams - (instancetype)init { @@ -3379,6 +5830,61 @@ - (NSString *)description } @end + +@implementation MTRActionsClusterDisableActionParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Actions::Commands::DisableAction::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.actionID = self.actionID.unsignedShortValue; + } + { + if (self.invokeID != nil) { + auto & definedValue_0 = encodableStruct.invokeID.Emplace(); + definedValue_0 = self.invokeID.unsignedIntValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRActionsClusterDisableActionWithDurationParams - (instancetype)init { @@ -3415,6 +5921,64 @@ - (NSString *)description } @end + +@implementation MTRActionsClusterDisableActionWithDurationParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Actions::Commands::DisableActionWithDuration::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.actionID = self.actionID.unsignedShortValue; + } + { + if (self.invokeID != nil) { + auto & definedValue_0 = encodableStruct.invokeID.Emplace(); + definedValue_0 = self.invokeID.unsignedIntValue; + } + } + { + encodableStruct.duration = self.duration.unsignedIntValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRBasicClusterMfgSpecificPingParams - (instancetype)init { @@ -3494,6 +6058,108 @@ - (NSString *)description @end +@implementation MTROTASoftwareUpdateProviderClusterQueryImageParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImage::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.vendorID = static_cast>(self.vendorID.unsignedShortValue); + } + { + encodableStruct.productID = self.productID.unsignedShortValue; + } + { + encodableStruct.softwareVersion = self.softwareVersion.unsignedIntValue; + } + { + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (self.protocolsSupported.count != 0) { + auto * listHolder_0 = new ListHolder(self.protocolsSupported.count); + if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_0); + for (size_t i_0 = 0; i_0 < self.protocolsSupported.count; ++i_0) { + if (![self.protocolsSupported[i_0] isKindOfClass:[NSNumber class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_0 = (NSNumber *) self.protocolsSupported[i_0]; + listHolder_0->mList[i_0] = static_castmList[i_0])>>(element_0.unsignedCharValue); + } + encodableStruct.protocolsSupported = ListType_0(listHolder_0->mList, self.protocolsSupported.count); + } else { + encodableStruct.protocolsSupported = ListType_0(); + } + } + } + { + if (self.hardwareVersion != nil) { + auto & definedValue_0 = encodableStruct.hardwareVersion.Emplace(); + definedValue_0 = self.hardwareVersion.unsignedShortValue; + } + } + { + if (self.location != nil) { + auto & definedValue_0 = encodableStruct.location.Emplace(); + definedValue_0 = AsCharSpan(self.location); + } + } + { + if (self.requestorCanConsent != nil) { + auto & definedValue_0 = encodableStruct.requestorCanConsent.Emplace(); + definedValue_0 = self.requestorCanConsent.boolValue; + } + } + { + if (self.metadataForProvider != nil) { + auto & definedValue_0 = encodableStruct.metadataForProvider.Emplace(); + definedValue_0 = AsByteSpan(self.metadataForProvider); + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROtaSoftwareUpdateProviderClusterQueryImageParams @dynamic softwareVersion; @dynamic protocolsSupported; @@ -3684,6 +6350,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::OtaSoftw } return CHIP_NO_ERROR; } + @end @implementation MTROtaSoftwareUpdateProviderClusterQueryImageResponseParams @@ -3732,6 +6399,57 @@ - (NSString *)description @end +@implementation MTROTASoftwareUpdateProviderClusterApplyUpdateRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.updateToken = AsByteSpan(self.updateToken); + } + { + encodableStruct.newVersion = self.newVersion.unsignedIntValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROtaSoftwareUpdateProviderClusterApplyUpdateRequestParams @dynamic updateToken; @dynamic newVersion; @@ -3823,6 +6541,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::OtaSoftw } return CHIP_NO_ERROR; } + @end @implementation MTROtaSoftwareUpdateProviderClusterApplyUpdateResponseParams @@ -3865,6 +6584,57 @@ - (NSString *)description @end +@implementation MTROTASoftwareUpdateProviderClusterNotifyUpdateAppliedParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::NotifyUpdateApplied::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.updateToken = AsByteSpan(self.updateToken); + } + { + encodableStruct.softwareVersion = self.softwareVersion.unsignedIntValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROtaSoftwareUpdateProviderClusterNotifyUpdateAppliedParams @dynamic updateToken; @dynamic softwareVersion; @@ -3915,6 +6685,69 @@ - (NSString *)description @end +@implementation MTROTASoftwareUpdateRequestorClusterAnnounceOTAProviderParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OtaSoftwareUpdateRequestor::Commands::AnnounceOTAProvider::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.providerNodeID = self.providerNodeID.unsignedLongLongValue; + } + { + encodableStruct.vendorID = static_cast>(self.vendorID.unsignedShortValue); + } + { + encodableStruct.announcementReason = static_cast>(self.announcementReason.unsignedCharValue); + } + { + if (self.metadataForNode != nil) { + auto & definedValue_0 = encodableStruct.metadataForNode.Emplace(); + definedValue_0 = AsByteSpan(self.metadataForNode); + } + } + { + encodableStruct.endpoint = self.endpoint.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROtaSoftwareUpdateRequestorClusterAnnounceOtaProviderParams @dynamic announcementReason; @dynamic metadataForNode; @@ -3979,6 +6812,58 @@ - (NSString *)description } @end + +@implementation MTRGeneralCommissioningClusterArmFailSafeParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.expiryLengthSeconds = self.expiryLengthSeconds.unsignedShortValue; + } + { + encodableStruct.breadcrumb = self.breadcrumb.unsignedLongLongValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRGeneralCommissioningClusterArmFailSafeResponseParams - (instancetype)init { @@ -4067,7 +6952,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::GeneralC } return CHIP_NO_ERROR; } + @end + @implementation MTRGeneralCommissioningClusterSetRegulatoryConfigParams - (instancetype)init { @@ -4104,6 +6991,61 @@ - (NSString *)description } @end + +@implementation MTRGeneralCommissioningClusterSetRegulatoryConfigParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfig::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.newRegulatoryConfig = static_cast>(self.newRegulatoryConfig.unsignedCharValue); + } + { + encodableStruct.countryCode = AsCharSpan(self.countryCode); + } + { + encodableStruct.breadcrumb = self.breadcrumb.unsignedLongLongValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRGeneralCommissioningClusterSetRegulatoryConfigResponseParams - (instancetype)init { @@ -4192,7 +7134,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::GeneralC } return CHIP_NO_ERROR; } + @end + @implementation MTRGeneralCommissioningClusterCommissioningCompleteParams - (instancetype)init { @@ -4220,6 +7164,52 @@ - (NSString *)description } @end + +@implementation MTRGeneralCommissioningClusterCommissioningCompleteParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::GeneralCommissioning::Commands::CommissioningComplete::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRGeneralCommissioningClusterCommissioningCompleteResponseParams - (instancetype)init { @@ -4308,7 +7298,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::GeneralC } return CHIP_NO_ERROR; } + @end + @implementation MTRNetworkCommissioningClusterScanNetworksParams - (instancetype)init { @@ -4342,6 +7334,69 @@ - (NSString *)description } @end + +@implementation MTRNetworkCommissioningClusterScanNetworksParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::NetworkCommissioning::Commands::ScanNetworks::Type encodableStruct; + ListFreer listFreer; + { + if (self.ssid != nil) { + auto & definedValue_0 = encodableStruct.ssid.Emplace(); + if (self.ssid == nil) { + definedValue_0.SetNull(); + } else { + auto & nonNullValue_1 = definedValue_0.SetNonNull(); + nonNullValue_1 = AsByteSpan(self.ssid); + } + } + } + { + if (self.breadcrumb != nil) { + auto & definedValue_0 = encodableStruct.breadcrumb.Emplace(); + definedValue_0 = self.breadcrumb.unsignedLongLongValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRNetworkCommissioningClusterScanNetworksResponseParams - (instancetype)init { @@ -4500,7 +7555,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::NetworkC } return CHIP_NO_ERROR; } + @end + @implementation MTRNetworkCommissioningClusterAddOrUpdateWiFiNetworkParams - (instancetype)init { @@ -4537,6 +7594,64 @@ - (NSString *)description } @end + +@implementation MTRNetworkCommissioningClusterAddOrUpdateWiFiNetworkParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::NetworkCommissioning::Commands::AddOrUpdateWiFiNetwork::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.ssid = AsByteSpan(self.ssid); + } + { + encodableStruct.credentials = AsByteSpan(self.credentials); + } + { + if (self.breadcrumb != nil) { + auto & definedValue_0 = encodableStruct.breadcrumb.Emplace(); + definedValue_0 = self.breadcrumb.unsignedLongLongValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRNetworkCommissioningClusterAddOrUpdateThreadNetworkParams - (instancetype)init { @@ -4570,6 +7685,61 @@ - (NSString *)description } @end + +@implementation MTRNetworkCommissioningClusterAddOrUpdateThreadNetworkParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::NetworkCommissioning::Commands::AddOrUpdateThreadNetwork::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.operationalDataset = AsByteSpan(self.operationalDataset); + } + { + if (self.breadcrumb != nil) { + auto & definedValue_0 = encodableStruct.breadcrumb.Emplace(); + definedValue_0 = self.breadcrumb.unsignedLongLongValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRNetworkCommissioningClusterRemoveNetworkParams - (instancetype)init { @@ -4603,6 +7773,61 @@ - (NSString *)description } @end + +@implementation MTRNetworkCommissioningClusterRemoveNetworkParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::NetworkCommissioning::Commands::RemoveNetwork::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.networkID = AsByteSpan(self.networkID); + } + { + if (self.breadcrumb != nil) { + auto & definedValue_0 = encodableStruct.breadcrumb.Emplace(); + definedValue_0 = self.breadcrumb.unsignedLongLongValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRNetworkCommissioningClusterNetworkConfigResponseParams - (instancetype)init { @@ -4705,7 +7930,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::NetworkC } return CHIP_NO_ERROR; } + @end + @implementation MTRNetworkCommissioningClusterConnectNetworkParams - (instancetype)init { @@ -4739,6 +7966,61 @@ - (NSString *)description } @end + +@implementation MTRNetworkCommissioningClusterConnectNetworkParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::NetworkCommissioning::Commands::ConnectNetwork::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.networkID = AsByteSpan(self.networkID); + } + { + if (self.breadcrumb != nil) { + auto & definedValue_0 = encodableStruct.breadcrumb.Emplace(); + definedValue_0 = self.breadcrumb.unsignedLongLongValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRNetworkCommissioningClusterConnectNetworkResponseParams - (instancetype)init { @@ -4841,7 +8123,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::NetworkC } return CHIP_NO_ERROR; } + @end + @implementation MTRNetworkCommissioningClusterReorderNetworkParams - (instancetype)init { @@ -4878,6 +8162,64 @@ - (NSString *)description } @end + +@implementation MTRNetworkCommissioningClusterReorderNetworkParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::NetworkCommissioning::Commands::ReorderNetwork::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.networkID = AsByteSpan(self.networkID); + } + { + encodableStruct.networkIndex = self.networkIndex.unsignedCharValue; + } + { + if (self.breadcrumb != nil) { + auto & definedValue_0 = encodableStruct.breadcrumb.Emplace(); + definedValue_0 = self.breadcrumb.unsignedLongLongValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDiagnosticLogsClusterRetrieveLogsRequestParams - (instancetype)init { @@ -4914,6 +8256,64 @@ - (NSString *)description } @end + +@implementation MTRDiagnosticLogsClusterRetrieveLogsRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.intent = static_cast>(self.intent.unsignedCharValue); + } + { + encodableStruct.requestedProtocol = static_cast>(self.requestedProtocol.unsignedCharValue); + } + { + if (self.transferFileDesignator != nil) { + auto & definedValue_0 = encodableStruct.transferFileDesignator.Emplace(); + definedValue_0 = AsCharSpan(self.transferFileDesignator); + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDiagnosticLogsClusterRetrieveLogsResponseParams - (instancetype)init { @@ -5018,6 +8418,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Diagnost } return CHIP_NO_ERROR; } + @end @implementation MTRDiagnosticLogsClusterRetrieveLogsResponseParams (Deprecated) @@ -5075,6 +8476,58 @@ - (NSString *)description } @end + +@implementation MTRGeneralDiagnosticsClusterTestEventTriggerParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.enableKey = AsByteSpan(self.enableKey); + } + { + encodableStruct.eventTrigger = self.eventTrigger.unsignedLongLongValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRSoftwareDiagnosticsClusterResetWatermarksParams - (instancetype)init { @@ -5102,6 +8555,52 @@ - (NSString *)description } @end + +@implementation MTRSoftwareDiagnosticsClusterResetWatermarksParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::SoftwareDiagnostics::Commands::ResetWatermarks::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRThreadNetworkDiagnosticsClusterResetCountsParams - (instancetype)init { @@ -5129,6 +8628,52 @@ - (NSString *)description } @end + +@implementation MTRThreadNetworkDiagnosticsClusterResetCountsParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ThreadNetworkDiagnostics::Commands::ResetCounts::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRWiFiNetworkDiagnosticsClusterResetCountsParams - (instancetype)init { @@ -5156,6 +8701,52 @@ - (NSString *)description } @end + +@implementation MTRWiFiNetworkDiagnosticsClusterResetCountsParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::WiFiNetworkDiagnostics::Commands::ResetCounts::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTREthernetNetworkDiagnosticsClusterResetCountsParams - (instancetype)init { @@ -5183,6 +8774,52 @@ - (NSString *)description } @end + +@implementation MTREthernetNetworkDiagnosticsClusterResetCountsParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::EthernetNetworkDiagnostics::Commands::ResetCounts::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTimeSynchronizationClusterSetUTCTimeParams - (instancetype)init { @@ -5220,6 +8857,63 @@ - (NSString *)description @end +@implementation MTRTimeSynchronizationClusterSetUTCTimeParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::TimeSynchronization::Commands::SetUTCTime::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.UTCTime = self.utcTime.unsignedLongLongValue; + } + { + encodableStruct.granularity = static_cast>(self.granularity.unsignedCharValue); + } + { + if (self.timeSource != nil) { + auto & definedValue_0 = encodableStruct.timeSource.Emplace(); + definedValue_0 = static_cast>(self.timeSource.unsignedCharValue); + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTimeSynchronizationClusterSetUtcTimeParams @dynamic utcTime; @dynamic granularity; @@ -5258,6 +8952,61 @@ - (NSString *)description } @end + +@implementation MTRTimeSynchronizationClusterSetTrustedTimeSourceParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::TimeSynchronization::Commands::SetTrustedTimeSource::Type encodableStruct; + ListFreer listFreer; + { + if (self.trustedTimeSource == nil) { + encodableStruct.trustedTimeSource.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.trustedTimeSource.SetNonNull(); + nonNullValue_0.nodeID = self.trustedTimeSource.nodeID.unsignedLongLongValue; + nonNullValue_0.endpoint = self.trustedTimeSource.endpoint.unsignedShortValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTimeSynchronizationClusterSetTimeZoneParams - (instancetype)init { @@ -5288,6 +9037,81 @@ - (NSString *)description } @end + +@implementation MTRTimeSynchronizationClusterSetTimeZoneParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::TimeSynchronization::Commands::SetTimeZone::Type encodableStruct; + ListFreer listFreer; + { + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (self.timeZone.count != 0) { + auto * listHolder_0 = new ListHolder(self.timeZone.count); + if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_0); + for (size_t i_0 = 0; i_0 < self.timeZone.count; ++i_0) { + if (![self.timeZone[i_0] isKindOfClass:[MTRTimeSynchronizationClusterTimeZoneStruct class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_0 = (MTRTimeSynchronizationClusterTimeZoneStruct *) self.timeZone[i_0]; + listHolder_0->mList[i_0].offset = element_0.offset.intValue; + listHolder_0->mList[i_0].validAt = element_0.validAt.unsignedLongLongValue; + if (element_0.name != nil) { + auto & definedValue_2 = listHolder_0->mList[i_0].name.Emplace(); + definedValue_2 = AsCharSpan(element_0.name); + } + } + encodableStruct.timeZone = ListType_0(listHolder_0->mList, self.timeZone.count); + } else { + encodableStruct.timeZone = ListType_0(); + } + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTimeSynchronizationClusterSetTimeZoneResponseParams - (instancetype)init { @@ -5364,7 +9188,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::TimeSync } return CHIP_NO_ERROR; } + @end + @implementation MTRTimeSynchronizationClusterSetDSTOffsetParams - (instancetype)init { @@ -5395,6 +9221,83 @@ - (NSString *)description } @end + +@implementation MTRTimeSynchronizationClusterSetDSTOffsetParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::TimeSynchronization::Commands::SetDSTOffset::Type encodableStruct; + ListFreer listFreer; + { + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (self.dstOffset.count != 0) { + auto * listHolder_0 = new ListHolder(self.dstOffset.count); + if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_0); + for (size_t i_0 = 0; i_0 < self.dstOffset.count; ++i_0) { + if (![self.dstOffset[i_0] isKindOfClass:[MTRTimeSynchronizationClusterDSTOffsetStruct class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_0 = (MTRTimeSynchronizationClusterDSTOffsetStruct *) self.dstOffset[i_0]; + listHolder_0->mList[i_0].offset = element_0.offset.intValue; + listHolder_0->mList[i_0].validStarting = element_0.validStarting.unsignedLongLongValue; + if (element_0.validUntil == nil) { + listHolder_0->mList[i_0].validUntil.SetNull(); + } else { + auto & nonNullValue_2 = listHolder_0->mList[i_0].validUntil.SetNonNull(); + nonNullValue_2 = element_0.validUntil.unsignedLongLongValue; + } + } + encodableStruct.DSTOffset = ListType_0(listHolder_0->mList, self.dstOffset.count); + } else { + encodableStruct.DSTOffset = ListType_0(); + } + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTimeSynchronizationClusterSetDefaultNTPParams - (instancetype)init { @@ -5425,6 +9328,60 @@ - (NSString *)description } @end + +@implementation MTRTimeSynchronizationClusterSetDefaultNTPParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::TimeSynchronization::Commands::SetDefaultNTP::Type encodableStruct; + ListFreer listFreer; + { + if (self.defaultNTP == nil) { + encodableStruct.defaultNTP.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.defaultNTP.SetNonNull(); + nonNullValue_0 = AsCharSpan(self.defaultNTP); + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRAdministratorCommissioningClusterOpenCommissioningWindowParams - (instancetype)init { @@ -5457,15 +9414,75 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; - return other; + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: commissioningTimeout:%@; pakePasscodeVerifier:%@; discriminator:%@; iterations:%@; salt:%@; >", NSStringFromClass([self class]), _commissioningTimeout, [_pakePasscodeVerifier base64EncodedStringWithOptions:0], _discriminator, _iterations, [_salt base64EncodedStringWithOptions:0]]; + return descriptionString; +} + +@end + +@implementation MTRAdministratorCommissioningClusterOpenCommissioningWindowParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.commissioningTimeout = self.commissioningTimeout.unsignedShortValue; + } + { + encodableStruct.PAKEPasscodeVerifier = AsByteSpan(self.pakePasscodeVerifier); + } + { + encodableStruct.discriminator = self.discriminator.unsignedShortValue; + } + { + encodableStruct.iterations = self.iterations.unsignedIntValue; + } + { + encodableStruct.salt = AsByteSpan(self.salt); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); } -- (NSString *)description +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: commissioningTimeout:%@; pakePasscodeVerifier:%@; discriminator:%@; iterations:%@; salt:%@; >", NSStringFromClass([self class]), _commissioningTimeout, [_pakePasscodeVerifier base64EncodedStringWithOptions:0], _discriminator, _iterations, [_salt base64EncodedStringWithOptions:0]]; - return descriptionString; -} + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} @end @implementation MTRAdministratorCommissioningClusterOpenCommissioningWindowParams (Deprecated) @@ -5510,6 +9527,55 @@ - (NSString *)description } @end + +@implementation MTRAdministratorCommissioningClusterOpenBasicCommissioningWindowParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.commissioningTimeout = self.commissioningTimeout.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRAdministratorCommissioningClusterRevokeCommissioningParams - (instancetype)init { @@ -5537,6 +9603,52 @@ - (NSString *)description } @end + +@implementation MTRAdministratorCommissioningClusterRevokeCommissioningParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::AdministratorCommissioning::Commands::RevokeCommissioning::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROperationalCredentialsClusterAttestationRequestParams - (instancetype)init { @@ -5567,6 +9679,55 @@ - (NSString *)description } @end + +@implementation MTROperationalCredentialsClusterAttestationRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OperationalCredentials::Commands::AttestationRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.attestationNonce = AsByteSpan(self.attestationNonce); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROperationalCredentialsClusterAttestationResponseParams - (instancetype)init { @@ -5651,6 +9812,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Operatio } return CHIP_NO_ERROR; } + @end @implementation MTROperationalCredentialsClusterAttestationResponseParams (Deprecated) @@ -5695,6 +9857,55 @@ - (NSString *)description } @end + +@implementation MTROperationalCredentialsClusterCertificateChainRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OperationalCredentials::Commands::CertificateChainRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.certificateType = static_cast>(self.certificateType.unsignedCharValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROperationalCredentialsClusterCertificateChainResponseParams - (instancetype)init { @@ -5773,7 +9984,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Operatio } return CHIP_NO_ERROR; } + @end + @implementation MTROperationalCredentialsClusterCSRRequestParams - (instancetype)init { @@ -5807,6 +10020,61 @@ - (NSString *)description } @end + +@implementation MTROperationalCredentialsClusterCSRRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OperationalCredentials::Commands::CSRRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.CSRNonce = AsByteSpan(self.csrNonce); + } + { + if (self.isForUpdateNOC != nil) { + auto & definedValue_0 = encodableStruct.isForUpdateNOC.Emplace(); + definedValue_0 = self.isForUpdateNOC.boolValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROperationalCredentialsClusterCSRResponseParams - (instancetype)init { @@ -5891,7 +10159,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Operatio } return CHIP_NO_ERROR; } + @end + @implementation MTROperationalCredentialsClusterAddNOCParams - (instancetype)init { @@ -5934,6 +10204,70 @@ - (NSString *)description } @end + +@implementation MTROperationalCredentialsClusterAddNOCParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OperationalCredentials::Commands::AddNOC::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.NOCValue = AsByteSpan(self.nocValue); + } + { + if (self.icacValue != nil) { + auto & definedValue_0 = encodableStruct.ICACValue.Emplace(); + definedValue_0 = AsByteSpan(self.icacValue); + } + } + { + encodableStruct.IPKValue = AsByteSpan(self.ipkValue); + } + { + encodableStruct.caseAdminSubject = self.caseAdminSubject.unsignedLongLongValue; + } + { + encodableStruct.adminVendorId = static_cast>(self.adminVendorId.unsignedShortValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROperationalCredentialsClusterUpdateNOCParams - (instancetype)init { @@ -5967,6 +10301,61 @@ - (NSString *)description } @end + +@implementation MTROperationalCredentialsClusterUpdateNOCParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OperationalCredentials::Commands::UpdateNOC::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.NOCValue = AsByteSpan(self.nocValue); + } + { + if (self.icacValue != nil) { + auto & definedValue_0 = encodableStruct.ICACValue.Emplace(); + definedValue_0 = AsByteSpan(self.icacValue); + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROperationalCredentialsClusterNOCResponseParams - (instancetype)init { @@ -6069,7 +10458,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Operatio } return CHIP_NO_ERROR; } + @end + @implementation MTROperationalCredentialsClusterUpdateFabricLabelParams - (instancetype)init { @@ -6100,6 +10491,55 @@ - (NSString *)description } @end + +@implementation MTROperationalCredentialsClusterUpdateFabricLabelParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OperationalCredentials::Commands::UpdateFabricLabel::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.label = AsCharSpan(self.label); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROperationalCredentialsClusterRemoveFabricParams - (instancetype)init { @@ -6109,27 +10549,76 @@ - (instancetype)init _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } - return self; -} + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTROperationalCredentialsClusterRemoveFabricParams alloc] init]; + + other.fabricIndex = self.fabricIndex; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: fabricIndex:%@; >", NSStringFromClass([self class]), _fabricIndex]; + return descriptionString; +} + +@end + +@implementation MTROperationalCredentialsClusterRemoveFabricParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.fabricIndex = self.fabricIndex.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } -- (id)copyWithZone:(NSZone * _Nullable)zone; -{ - auto other = [[MTROperationalCredentialsClusterRemoveFabricParams alloc] init]; + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); - other.fabricIndex = self.fabricIndex; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); - return other; + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); } -- (NSString *)description +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: fabricIndex:%@; >", NSStringFromClass([self class]), _fabricIndex]; - return descriptionString; -} + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} @end + @implementation MTROperationalCredentialsClusterAddTrustedRootCertificateParams - (instancetype)init { @@ -6161,6 +10650,54 @@ - (NSString *)description @end +@implementation MTROperationalCredentialsClusterAddTrustedRootCertificateParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OperationalCredentials::Commands::AddTrustedRootCertificate::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.rootCACertificate = AsByteSpan(self.rootCACertificate); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROperationalCredentialsClusterAddTrustedRootCertificateParams (Deprecated) - (void)setRootCertificate:(NSData * _Nonnull)rootCertificate @@ -6203,6 +10740,92 @@ - (NSString *)description } @end + +@implementation MTRGroupKeyManagementClusterKeySetWriteParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.groupKeySet.groupKeySetID = self.groupKeySet.groupKeySetID.unsignedShortValue; + encodableStruct.groupKeySet.groupKeySecurityPolicy = static_cast>(self.groupKeySet.groupKeySecurityPolicy.unsignedCharValue); + if (self.groupKeySet.epochKey0 == nil) { + encodableStruct.groupKeySet.epochKey0.SetNull(); + } else { + auto & nonNullValue_1 = encodableStruct.groupKeySet.epochKey0.SetNonNull(); + nonNullValue_1 = AsByteSpan(self.groupKeySet.epochKey0); + } + if (self.groupKeySet.epochStartTime0 == nil) { + encodableStruct.groupKeySet.epochStartTime0.SetNull(); + } else { + auto & nonNullValue_1 = encodableStruct.groupKeySet.epochStartTime0.SetNonNull(); + nonNullValue_1 = self.groupKeySet.epochStartTime0.unsignedLongLongValue; + } + if (self.groupKeySet.epochKey1 == nil) { + encodableStruct.groupKeySet.epochKey1.SetNull(); + } else { + auto & nonNullValue_1 = encodableStruct.groupKeySet.epochKey1.SetNonNull(); + nonNullValue_1 = AsByteSpan(self.groupKeySet.epochKey1); + } + if (self.groupKeySet.epochStartTime1 == nil) { + encodableStruct.groupKeySet.epochStartTime1.SetNull(); + } else { + auto & nonNullValue_1 = encodableStruct.groupKeySet.epochStartTime1.SetNonNull(); + nonNullValue_1 = self.groupKeySet.epochStartTime1.unsignedLongLongValue; + } + if (self.groupKeySet.epochKey2 == nil) { + encodableStruct.groupKeySet.epochKey2.SetNull(); + } else { + auto & nonNullValue_1 = encodableStruct.groupKeySet.epochKey2.SetNonNull(); + nonNullValue_1 = AsByteSpan(self.groupKeySet.epochKey2); + } + if (self.groupKeySet.epochStartTime2 == nil) { + encodableStruct.groupKeySet.epochStartTime2.SetNull(); + } else { + auto & nonNullValue_1 = encodableStruct.groupKeySet.epochStartTime2.SetNonNull(); + nonNullValue_1 = self.groupKeySet.epochStartTime2.unsignedLongLongValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRGroupKeyManagementClusterKeySetReadParams - (instancetype)init { @@ -6233,6 +10856,55 @@ - (NSString *)description } @end + +@implementation MTRGroupKeyManagementClusterKeySetReadParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.groupKeySetID = self.groupKeySetID.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRGroupKeyManagementClusterKeySetReadResponseParams - (instancetype)init { @@ -6343,7 +11015,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::GroupKey } return CHIP_NO_ERROR; } + @end + @implementation MTRGroupKeyManagementClusterKeySetRemoveParams - (instancetype)init { @@ -6374,6 +11048,55 @@ - (NSString *)description } @end + +@implementation MTRGroupKeyManagementClusterKeySetRemoveParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.groupKeySetID = self.groupKeySetID.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRGroupKeyManagementClusterKeySetReadAllIndicesParams - (instancetype)init { @@ -6401,6 +11124,52 @@ - (NSString *)description } @end + +@implementation MTRGroupKeyManagementClusterKeySetReadAllIndicesParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndices::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRGroupKeyManagementClusterKeySetReadAllIndicesResponseParams - (instancetype)init { @@ -6493,7 +11262,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::GroupKey } return CHIP_NO_ERROR; } + @end + @implementation MTRICDManagementClusterRegisterClientParams - (instancetype)init { @@ -6533,6 +11304,67 @@ - (NSString *)description } @end + +@implementation MTRICDManagementClusterRegisterClientParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::IcdManagement::Commands::RegisterClient::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.checkInNodeID = self.checkInNodeID.unsignedLongLongValue; + } + { + encodableStruct.monitoredSubject = self.monitoredSubject.unsignedLongLongValue; + } + { + encodableStruct.key = AsByteSpan(self.key); + } + { + if (self.verificationKey != nil) { + auto & definedValue_0 = encodableStruct.verificationKey.Emplace(); + definedValue_0 = AsByteSpan(self.verificationKey); + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRICDManagementClusterRegisterClientResponseParams - (instancetype)init { @@ -6609,7 +11441,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::IcdManag } return CHIP_NO_ERROR; } + @end + @implementation MTRICDManagementClusterUnregisterClientParams - (instancetype)init { @@ -6643,6 +11477,61 @@ - (NSString *)description } @end + +@implementation MTRICDManagementClusterUnregisterClientParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.checkInNodeID = self.checkInNodeID.unsignedLongLongValue; + } + { + if (self.verificationKey != nil) { + auto & definedValue_0 = encodableStruct.verificationKey.Emplace(); + definedValue_0 = AsByteSpan(self.verificationKey); + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRICDManagementClusterStayActiveRequestParams - (instancetype)init { @@ -6670,6 +11559,52 @@ - (NSString *)description } @end + +@implementation MTRICDManagementClusterStayActiveRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::IcdManagement::Commands::StayActiveRequest::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRModeSelectClusterChangeToModeParams - (instancetype)init { @@ -6700,6 +11635,55 @@ - (NSString *)description } @end + +@implementation MTRModeSelectClusterChangeToModeParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.newMode = self.newMode.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRLaundryWasherModeClusterChangeToModeParams - (instancetype)init { @@ -6730,6 +11714,55 @@ - (NSString *)description } @end + +@implementation MTRLaundryWasherModeClusterChangeToModeParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::LaundryWasherMode::Commands::ChangeToMode::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.newMode = self.newMode.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRLaundryWasherModeClusterChangeToModeResponseParams - (instancetype)init { @@ -6820,7 +11853,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::LaundryW } return CHIP_NO_ERROR; } + @end + @implementation MTRRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeParams - (instancetype)init { @@ -6851,6 +11886,55 @@ - (NSString *)description } @end + +@implementation MTRRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Commands::ChangeToMode::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.newMode = self.newMode.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseParams - (instancetype)init { @@ -6941,7 +12025,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Refriger } return CHIP_NO_ERROR; } + @end + @implementation MTRRVCRunModeClusterChangeToModeParams - (instancetype)init { @@ -6972,6 +12058,55 @@ - (NSString *)description } @end + +@implementation MTRRVCRunModeClusterChangeToModeParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::RvcRunMode::Commands::ChangeToMode::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.newMode = self.newMode.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRRVCRunModeClusterChangeToModeResponseParams - (instancetype)init { @@ -7062,7 +12197,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::RvcRunMo } return CHIP_NO_ERROR; } + @end + @implementation MTRRVCCleanModeClusterChangeToModeParams - (instancetype)init { @@ -7093,6 +12230,55 @@ - (NSString *)description } @end + +@implementation MTRRVCCleanModeClusterChangeToModeParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::RvcCleanMode::Commands::ChangeToMode::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.newMode = self.newMode.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRRVCCleanModeClusterChangeToModeResponseParams - (instancetype)init { @@ -7183,7 +12369,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::RvcClean } return CHIP_NO_ERROR; } + @end + @implementation MTRTemperatureControlClusterSetTemperatureParams - (instancetype)init { @@ -7217,6 +12405,64 @@ - (NSString *)description } @end + +@implementation MTRTemperatureControlClusterSetTemperatureParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::TemperatureControl::Commands::SetTemperature::Type encodableStruct; + ListFreer listFreer; + { + if (self.targetTemperature != nil) { + auto & definedValue_0 = encodableStruct.targetTemperature.Emplace(); + definedValue_0 = self.targetTemperature.shortValue; + } + } + { + if (self.targetTemperatureLevel != nil) { + auto & definedValue_0 = encodableStruct.targetTemperatureLevel.Emplace(); + definedValue_0 = self.targetTemperatureLevel.unsignedCharValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDishwasherModeClusterChangeToModeParams - (instancetype)init { @@ -7247,6 +12493,55 @@ - (NSString *)description } @end + +@implementation MTRDishwasherModeClusterChangeToModeParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DishwasherMode::Commands::ChangeToMode::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.newMode = self.newMode.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDishwasherModeClusterChangeToModeResponseParams - (instancetype)init { @@ -7337,7 +12632,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Dishwash } return CHIP_NO_ERROR; } + @end + @implementation MTRSmokeCOAlarmClusterSelfTestRequestParams - (instancetype)init { @@ -7365,6 +12662,52 @@ - (NSString *)description } @end + +@implementation MTRSmokeCOAlarmClusterSelfTestRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::SmokeCoAlarm::Commands::SelfTestRequest::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDishwasherAlarmClusterResetParams - (instancetype)init { @@ -7395,6 +12738,55 @@ - (NSString *)description } @end + +@implementation MTRDishwasherAlarmClusterResetParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DishwasherAlarm::Commands::Reset::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.alarms = static_cast>(self.alarms.unsignedIntValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDishwasherAlarmClusterModifyEnabledAlarmsParams - (instancetype)init { @@ -7425,6 +12817,55 @@ - (NSString *)description } @end + +@implementation MTRDishwasherAlarmClusterModifyEnabledAlarmsParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DishwasherAlarm::Commands::ModifyEnabledAlarms::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.mask = static_cast>(self.mask.unsignedIntValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROperationalStateClusterPauseParams - (instancetype)init { @@ -7452,6 +12893,52 @@ - (NSString *)description } @end + +@implementation MTROperationalStateClusterPauseParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OperationalState::Commands::Pause::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROperationalStateClusterStopParams - (instancetype)init { @@ -7479,6 +12966,52 @@ - (NSString *)description } @end + +@implementation MTROperationalStateClusterStopParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OperationalState::Commands::Stop::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROperationalStateClusterStartParams - (instancetype)init { @@ -7506,6 +13039,52 @@ - (NSString *)description } @end + +@implementation MTROperationalStateClusterStartParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OperationalState::Commands::Start::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROperationalStateClusterResumeParams - (instancetype)init { @@ -7533,6 +13112,52 @@ - (NSString *)description } @end + +@implementation MTROperationalStateClusterResumeParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::OperationalState::Commands::Resume::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTROperationalStateClusterOperationalCommandResponseParams - (instancetype)init { @@ -7628,7 +13253,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Operatio } return CHIP_NO_ERROR; } + @end + @implementation MTRRVCOperationalStateClusterPauseParams - (instancetype)init { @@ -7656,6 +13283,52 @@ - (NSString *)description } @end + +@implementation MTRRVCOperationalStateClusterPauseParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::RvcOperationalState::Commands::Pause::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRRVCOperationalStateClusterStopParams - (instancetype)init { @@ -7683,6 +13356,52 @@ - (NSString *)description } @end + +@implementation MTRRVCOperationalStateClusterStopParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::RvcOperationalState::Commands::Stop::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRRVCOperationalStateClusterStartParams - (instancetype)init { @@ -7710,6 +13429,52 @@ - (NSString *)description } @end + +@implementation MTRRVCOperationalStateClusterStartParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::RvcOperationalState::Commands::Start::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRRVCOperationalStateClusterResumeParams - (instancetype)init { @@ -7737,6 +13502,52 @@ - (NSString *)description } @end + +@implementation MTRRVCOperationalStateClusterResumeParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::RvcOperationalState::Commands::Resume::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRRVCOperationalStateClusterOperationalCommandResponseParams - (instancetype)init { @@ -7832,7 +13643,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::RvcOpera } return CHIP_NO_ERROR; } + @end + @implementation MTRHEPAFilterMonitoringClusterResetConditionParams - (instancetype)init { @@ -7860,6 +13673,52 @@ - (NSString *)description } @end + +@implementation MTRHEPAFilterMonitoringClusterResetConditionParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::HepaFilterMonitoring::Commands::ResetCondition::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRActivatedCarbonFilterMonitoringClusterResetConditionParams - (instancetype)init { @@ -7887,6 +13746,52 @@ - (NSString *)description } @end + +@implementation MTRActivatedCarbonFilterMonitoringClusterResetConditionParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ActivatedCarbonFilterMonitoring::Commands::ResetCondition::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDoorLockClusterLockDoorParams - (instancetype)init { @@ -7917,6 +13822,58 @@ - (NSString *)description } @end + +@implementation MTRDoorLockClusterLockDoorParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::LockDoor::Type encodableStruct; + ListFreer listFreer; + { + if (self.pinCode != nil) { + auto & definedValue_0 = encodableStruct.PINCode.Emplace(); + definedValue_0 = AsByteSpan(self.pinCode); + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDoorLockClusterUnlockDoorParams - (instancetype)init { @@ -7926,27 +13883,79 @@ - (instancetype)init _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } - return self; -} + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; + + other.pinCode = self.pinCode; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: pinCode:%@; >", NSStringFromClass([self class]), [_pinCode base64EncodedStringWithOptions:0]]; + return descriptionString; +} + +@end + +@implementation MTRDoorLockClusterUnlockDoorParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type encodableStruct; + ListFreer listFreer; + { + if (self.pinCode != nil) { + auto & definedValue_0 = encodableStruct.PINCode.Emplace(); + definedValue_0 = AsByteSpan(self.pinCode); + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } -- (id)copyWithZone:(NSZone * _Nullable)zone; -{ - auto other = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); - other.pinCode = self.pinCode; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); - return other; + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); } -- (NSString *)description +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: pinCode:%@; >", NSStringFromClass([self class]), [_pinCode base64EncodedStringWithOptions:0]]; - return descriptionString; -} + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} @end + @implementation MTRDoorLockClusterUnlockWithTimeoutParams - (instancetype)init { @@ -7980,6 +13989,61 @@ - (NSString *)description } @end + +@implementation MTRDoorLockClusterUnlockWithTimeoutParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::UnlockWithTimeout::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.timeout = self.timeout.unsignedShortValue; + } + { + if (self.pinCode != nil) { + auto & definedValue_0 = encodableStruct.PINCode.Emplace(); + definedValue_0 = AsByteSpan(self.pinCode); + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDoorLockClusterSetWeekDayScheduleParams - (instancetype)init { @@ -8028,6 +14092,73 @@ - (NSString *)description } @end + +@implementation MTRDoorLockClusterSetWeekDayScheduleParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.weekDayIndex = self.weekDayIndex.unsignedCharValue; + } + { + encodableStruct.userIndex = self.userIndex.unsignedShortValue; + } + { + encodableStruct.daysMask = static_cast>(self.daysMask.unsignedCharValue); + } + { + encodableStruct.startHour = self.startHour.unsignedCharValue; + } + { + encodableStruct.startMinute = self.startMinute.unsignedCharValue; + } + { + encodableStruct.endHour = self.endHour.unsignedCharValue; + } + { + encodableStruct.endMinute = self.endMinute.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDoorLockClusterGetWeekDayScheduleParams - (instancetype)init { @@ -8061,6 +14192,58 @@ - (NSString *)description } @end + +@implementation MTRDoorLockClusterGetWeekDayScheduleParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.weekDayIndex = self.weekDayIndex.unsignedCharValue; + } + { + encodableStruct.userIndex = self.userIndex.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDoorLockClusterGetWeekDayScheduleResponseParams - (instancetype)init { @@ -8201,7 +14384,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DoorLock } return CHIP_NO_ERROR; } + @end + @implementation MTRDoorLockClusterClearWeekDayScheduleParams - (instancetype)init { @@ -8235,6 +14420,58 @@ - (NSString *)description } @end + +@implementation MTRDoorLockClusterClearWeekDayScheduleParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.weekDayIndex = self.weekDayIndex.unsignedCharValue; + } + { + encodableStruct.userIndex = self.userIndex.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDoorLockClusterSetYearDayScheduleParams - (instancetype)init { @@ -8274,6 +14511,64 @@ - (NSString *)description } @end + +@implementation MTRDoorLockClusterSetYearDayScheduleParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.yearDayIndex = self.yearDayIndex.unsignedCharValue; + } + { + encodableStruct.userIndex = self.userIndex.unsignedShortValue; + } + { + encodableStruct.localStartTime = self.localStartTime.unsignedIntValue; + } + { + encodableStruct.localEndTime = self.localEndTime.unsignedIntValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDoorLockClusterGetYearDayScheduleParams - (instancetype)init { @@ -8307,6 +14602,58 @@ - (NSString *)description } @end + +@implementation MTRDoorLockClusterGetYearDayScheduleParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.yearDayIndex = self.yearDayIndex.unsignedCharValue; + } + { + encodableStruct.userIndex = self.userIndex.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDoorLockClusterGetYearDayScheduleResponseParams - (instancetype)init { @@ -8417,7 +14764,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DoorLock } return CHIP_NO_ERROR; } + @end + @implementation MTRDoorLockClusterClearYearDayScheduleParams - (instancetype)init { @@ -8451,6 +14800,58 @@ - (NSString *)description } @end + +@implementation MTRDoorLockClusterClearYearDayScheduleParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.yearDayIndex = self.yearDayIndex.unsignedCharValue; + } + { + encodableStruct.userIndex = self.userIndex.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDoorLockClusterSetHolidayScheduleParams - (instancetype)init { @@ -8473,23 +14874,81 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; { auto other = [[MTRDoorLockClusterSetHolidayScheduleParams alloc] init]; - other.holidayIndex = self.holidayIndex; - other.localStartTime = self.localStartTime; - other.localEndTime = self.localEndTime; - other.operatingMode = self.operatingMode; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + other.holidayIndex = self.holidayIndex; + other.localStartTime = self.localStartTime; + other.localEndTime = self.localEndTime; + other.operatingMode = self.operatingMode; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: holidayIndex:%@; localStartTime:%@; localEndTime:%@; operatingMode:%@; >", NSStringFromClass([self class]), _holidayIndex, _localStartTime, _localEndTime, _operatingMode]; + return descriptionString; +} + +@end + +@implementation MTRDoorLockClusterSetHolidayScheduleParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::SetHolidaySchedule::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.holidayIndex = self.holidayIndex.unsignedCharValue; + } + { + encodableStruct.localStartTime = self.localStartTime.unsignedIntValue; + } + { + encodableStruct.localEndTime = self.localEndTime.unsignedIntValue; + } + { + encodableStruct.operatingMode = static_cast>(self.operatingMode.unsignedCharValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); - return other; + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); } -- (NSString *)description +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: holidayIndex:%@; localStartTime:%@; localEndTime:%@; operatingMode:%@; >", NSStringFromClass([self class]), _holidayIndex, _localStartTime, _localEndTime, _operatingMode]; - return descriptionString; -} + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} @end + @implementation MTRDoorLockClusterGetHolidayScheduleParams - (instancetype)init { @@ -8520,6 +14979,55 @@ - (NSString *)description } @end + +@implementation MTRDoorLockClusterGetHolidayScheduleParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.holidayIndex = self.holidayIndex.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDoorLockClusterGetHolidayScheduleResponseParams - (instancetype)init { @@ -8634,7 +15142,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DoorLock } return CHIP_NO_ERROR; } + @end + @implementation MTRDoorLockClusterClearHolidayScheduleParams - (instancetype)init { @@ -8665,6 +15175,55 @@ - (NSString *)description } @end + +@implementation MTRDoorLockClusterClearHolidayScheduleParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::ClearHolidaySchedule::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.holidayIndex = self.holidayIndex.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDoorLockClusterSetUserParams - (instancetype)init { @@ -8714,6 +15273,97 @@ - (NSString *)description @end +@implementation MTRDoorLockClusterSetUserParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::SetUser::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.operationType = static_cast>(self.operationType.unsignedCharValue); + } + { + encodableStruct.userIndex = self.userIndex.unsignedShortValue; + } + { + if (self.userName == nil) { + encodableStruct.userName.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.userName.SetNonNull(); + nonNullValue_0 = AsCharSpan(self.userName); + } + } + { + if (self.userUniqueID == nil) { + encodableStruct.userUniqueID.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.userUniqueID.SetNonNull(); + nonNullValue_0 = self.userUniqueID.unsignedIntValue; + } + } + { + if (self.userStatus == nil) { + encodableStruct.userStatus.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.userStatus.SetNonNull(); + nonNullValue_0 = static_cast>(self.userStatus.unsignedCharValue); + } + } + { + if (self.userType == nil) { + encodableStruct.userType.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.userType.SetNonNull(); + nonNullValue_0 = static_cast>(self.userType.unsignedCharValue); + } + } + { + if (self.credentialRule == nil) { + encodableStruct.credentialRule.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.credentialRule.SetNonNull(); + nonNullValue_0 = static_cast>(self.credentialRule.unsignedCharValue); + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDoorLockClusterSetUserParams (Deprecated) - (void)setUserUniqueId:(NSNumber * _Nullable)userUniqueId @@ -8756,6 +15406,55 @@ - (NSString *)description } @end + +@implementation MTRDoorLockClusterGetUserParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::GetUser::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.userIndex = self.userIndex.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDoorLockClusterGetUserResponseParams - (instancetype)init { @@ -8944,6 +15643,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DoorLock } return CHIP_NO_ERROR; } + @end @implementation MTRDoorLockClusterGetUserResponseParams (Deprecated) @@ -8988,6 +15688,55 @@ - (NSString *)description } @end + +@implementation MTRDoorLockClusterClearUserParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::ClearUser::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.userIndex = self.userIndex.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDoorLockClusterSetCredentialParams - (instancetype)init { @@ -9033,6 +15782,86 @@ - (NSString *)description } @end + +@implementation MTRDoorLockClusterSetCredentialParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::SetCredential::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.operationType = static_cast>(self.operationType.unsignedCharValue); + } + { + encodableStruct.credential.credentialType = static_cast>(self.credential.credentialType.unsignedCharValue); + encodableStruct.credential.credentialIndex = self.credential.credentialIndex.unsignedShortValue; + } + { + encodableStruct.credentialData = AsByteSpan(self.credentialData); + } + { + if (self.userIndex == nil) { + encodableStruct.userIndex.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.userIndex.SetNonNull(); + nonNullValue_0 = self.userIndex.unsignedShortValue; + } + } + { + if (self.userStatus == nil) { + encodableStruct.userStatus.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.userStatus.SetNonNull(); + nonNullValue_0 = static_cast>(self.userStatus.unsignedCharValue); + } + } + { + if (self.userType == nil) { + encodableStruct.userType.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.userType.SetNonNull(); + nonNullValue_0 = static_cast>(self.userType.unsignedCharValue); + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDoorLockClusterSetCredentialResponseParams - (instancetype)init { @@ -9131,7 +15960,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DoorLock } return CHIP_NO_ERROR; } + @end + @implementation MTRDoorLockClusterGetCredentialStatusParams - (instancetype)init { @@ -9162,6 +15993,56 @@ - (NSString *)description } @end + +@implementation MTRDoorLockClusterGetCredentialStatusParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.credential.credentialType = static_cast>(self.credential.credentialType.unsignedCharValue); + encodableStruct.credential.credentialIndex = self.credential.credentialIndex.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDoorLockClusterGetCredentialStatusResponseParams - (instancetype)init { @@ -9280,7 +16161,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DoorLock } return CHIP_NO_ERROR; } + @end + @implementation MTRDoorLockClusterClearCredentialParams - (instancetype)init { @@ -9311,6 +16194,61 @@ - (NSString *)description } @end + +@implementation MTRDoorLockClusterClearCredentialParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::ClearCredential::Type encodableStruct; + ListFreer listFreer; + { + if (self.credential == nil) { + encodableStruct.credential.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.credential.SetNonNull(); + nonNullValue_0.credentialType = static_cast>(self.credential.credentialType.unsignedCharValue); + nonNullValue_0.credentialIndex = self.credential.credentialIndex.unsignedShortValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDoorLockClusterUnboltDoorParams - (instancetype)init { @@ -9341,6 +16279,58 @@ - (NSString *)description } @end + +@implementation MTRDoorLockClusterUnboltDoorParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type encodableStruct; + ListFreer listFreer; + { + if (self.pinCode != nil) { + auto & definedValue_0 = encodableStruct.PINCode.Emplace(); + definedValue_0 = AsByteSpan(self.pinCode); + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRWindowCoveringClusterUpOrOpenParams - (instancetype)init { @@ -9368,6 +16358,52 @@ - (NSString *)description } @end + +@implementation MTRWindowCoveringClusterUpOrOpenParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRWindowCoveringClusterDownOrCloseParams - (instancetype)init { @@ -9395,6 +16431,52 @@ - (NSString *)description } @end + +@implementation MTRWindowCoveringClusterDownOrCloseParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRWindowCoveringClusterStopMotionParams - (instancetype)init { @@ -9422,6 +16504,52 @@ - (NSString *)description } @end + +@implementation MTRWindowCoveringClusterStopMotionParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::WindowCovering::Commands::StopMotion::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRWindowCoveringClusterGoToLiftValueParams - (instancetype)init { @@ -9452,6 +16580,55 @@ - (NSString *)description } @end + +@implementation MTRWindowCoveringClusterGoToLiftValueParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::WindowCovering::Commands::GoToLiftValue::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.liftValue = self.liftValue.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRWindowCoveringClusterGoToLiftPercentageParams - (instancetype)init { @@ -9482,6 +16659,55 @@ - (NSString *)description } @end + +@implementation MTRWindowCoveringClusterGoToLiftPercentageParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.liftPercent100thsValue = self.liftPercent100thsValue.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRWindowCoveringClusterGoToTiltValueParams - (instancetype)init { @@ -9512,6 +16738,55 @@ - (NSString *)description } @end + +@implementation MTRWindowCoveringClusterGoToTiltValueParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::WindowCovering::Commands::GoToTiltValue::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.tiltValue = self.tiltValue.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRWindowCoveringClusterGoToTiltPercentageParams - (instancetype)init { @@ -9542,6 +16817,55 @@ - (NSString *)description } @end + +@implementation MTRWindowCoveringClusterGoToTiltPercentageParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.tiltPercent100thsValue = self.tiltPercent100thsValue.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRBarrierControlClusterBarrierControlGoToPercentParams - (instancetype)init { @@ -9572,6 +16896,55 @@ - (NSString *)description } @end + +@implementation MTRBarrierControlClusterBarrierControlGoToPercentParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::BarrierControl::Commands::BarrierControlGoToPercent::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.percentOpen = self.percentOpen.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRBarrierControlClusterBarrierControlStopParams - (instancetype)init { @@ -9599,6 +16972,52 @@ - (NSString *)description } @end + +@implementation MTRBarrierControlClusterBarrierControlStopParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::BarrierControl::Commands::BarrierControlStop::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRThermostatClusterSetpointRaiseLowerParams - (instancetype)init { @@ -9632,6 +17051,58 @@ - (NSString *)description } @end + +@implementation MTRThermostatClusterSetpointRaiseLowerParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Thermostat::Commands::SetpointRaiseLower::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.mode = static_cast>(self.mode.unsignedCharValue); + } + { + encodableStruct.amount = self.amount.charValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRThermostatClusterGetWeeklyScheduleResponseParams - (instancetype)init { @@ -9753,7 +17224,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Thermost } return CHIP_NO_ERROR; } + @end + @implementation MTRThermostatClusterSetWeeklyScheduleParams - (instancetype)init { @@ -9793,6 +17266,97 @@ - (NSString *)description } @end + +@implementation MTRThermostatClusterSetWeeklyScheduleParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Thermostat::Commands::SetWeeklySchedule::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.numberOfTransitionsForSequence = self.numberOfTransitionsForSequence.unsignedCharValue; + } + { + encodableStruct.dayOfWeekForSequence = static_cast>(self.dayOfWeekForSequence.unsignedCharValue); + } + { + encodableStruct.modeForSequence = static_cast>(self.modeForSequence.unsignedCharValue); + } + { + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (self.transitions.count != 0) { + auto * listHolder_0 = new ListHolder(self.transitions.count); + if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_0); + for (size_t i_0 = 0; i_0 < self.transitions.count; ++i_0) { + if (![self.transitions[i_0] isKindOfClass:[MTRThermostatClusterThermostatScheduleTransition class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_0 = (MTRThermostatClusterThermostatScheduleTransition *) self.transitions[i_0]; + listHolder_0->mList[i_0].transitionTime = element_0.transitionTime.unsignedShortValue; + if (element_0.heatSetpoint == nil) { + listHolder_0->mList[i_0].heatSetpoint.SetNull(); + } else { + auto & nonNullValue_2 = listHolder_0->mList[i_0].heatSetpoint.SetNonNull(); + nonNullValue_2 = element_0.heatSetpoint.shortValue; + } + if (element_0.coolSetpoint == nil) { + listHolder_0->mList[i_0].coolSetpoint.SetNull(); + } else { + auto & nonNullValue_2 = listHolder_0->mList[i_0].coolSetpoint.SetNonNull(); + nonNullValue_2 = element_0.coolSetpoint.shortValue; + } + } + encodableStruct.transitions = ListType_0(listHolder_0->mList, self.transitions.count); + } else { + encodableStruct.transitions = ListType_0(); + } + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRThermostatClusterGetWeeklyScheduleParams - (instancetype)init { @@ -9826,6 +17390,58 @@ - (NSString *)description } @end + +@implementation MTRThermostatClusterGetWeeklyScheduleParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Thermostat::Commands::GetWeeklySchedule::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.daysToReturn = static_cast>(self.daysToReturn.unsignedCharValue); + } + { + encodableStruct.modeToReturn = static_cast>(self.modeToReturn.unsignedCharValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRThermostatClusterClearWeeklyScheduleParams - (instancetype)init { @@ -9853,6 +17469,52 @@ - (NSString *)description } @end + +@implementation MTRThermostatClusterClearWeeklyScheduleParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Thermostat::Commands::ClearWeeklySchedule::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRFanControlClusterStepParams - (instancetype)init { @@ -9889,6 +17551,67 @@ - (NSString *)description } @end + +@implementation MTRFanControlClusterStepParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::FanControl::Commands::Step::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.direction = static_cast>(self.direction.unsignedCharValue); + } + { + if (self.wrap != nil) { + auto & definedValue_0 = encodableStruct.wrap.Emplace(); + definedValue_0 = self.wrap.boolValue; + } + } + { + if (self.lowestOff != nil) { + auto & definedValue_0 = encodableStruct.lowestOff.Emplace(); + definedValue_0 = self.lowestOff.boolValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRColorControlClusterMoveToHueParams - (instancetype)init { @@ -9931,6 +17654,67 @@ - (NSString *)description } @end + +@implementation MTRColorControlClusterMoveToHueParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ColorControl::Commands::MoveToHue::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.hue = self.hue.unsignedCharValue; + } + { + encodableStruct.direction = static_cast>(self.direction.unsignedCharValue); + } + { + encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; + } + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRColorControlClusterMoveHueParams - (instancetype)init { @@ -9970,6 +17754,64 @@ - (NSString *)description } @end + +@implementation MTRColorControlClusterMoveHueParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ColorControl::Commands::MoveHue::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.moveMode = static_cast>(self.moveMode.unsignedCharValue); + } + { + encodableStruct.rate = self.rate.unsignedCharValue; + } + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRColorControlClusterStepHueParams - (instancetype)init { @@ -10012,6 +17854,67 @@ - (NSString *)description } @end + +@implementation MTRColorControlClusterStepHueParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ColorControl::Commands::StepHue::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.stepMode = static_cast>(self.stepMode.unsignedCharValue); + } + { + encodableStruct.stepSize = self.stepSize.unsignedCharValue; + } + { + encodableStruct.transitionTime = self.transitionTime.unsignedCharValue; + } + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRColorControlClusterMoveToSaturationParams - (instancetype)init { @@ -10023,34 +17926,92 @@ - (instancetype)init _optionsMask = @(0); - _optionsOverride = @(0); - _timedInvokeTimeoutMs = nil; - _serverSideProcessingTimeout = nil; + _optionsOverride = @(0); + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRColorControlClusterMoveToSaturationParams alloc] init]; + + other.saturation = self.saturation; + other.transitionTime = self.transitionTime; + other.optionsMask = self.optionsMask; + other.optionsOverride = self.optionsOverride; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: saturation:%@; transitionTime:%@; optionsMask:%@; optionsOverride:%@; >", NSStringFromClass([self class]), _saturation, _transitionTime, _optionsMask, _optionsOverride]; + return descriptionString; +} + +@end + +@implementation MTRColorControlClusterMoveToSaturationParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ColorControl::Commands::MoveToSaturation::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.saturation = self.saturation.unsignedCharValue; + } + { + encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; + } + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; } - return self; -} -- (id)copyWithZone:(NSZone * _Nullable)zone; -{ - auto other = [[MTRColorControlClusterMoveToSaturationParams alloc] init]; + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); - other.saturation = self.saturation; - other.transitionTime = self.transitionTime; - other.optionsMask = self.optionsMask; - other.optionsOverride = self.optionsOverride; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); - return other; + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); } -- (NSString *)description +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: saturation:%@; transitionTime:%@; optionsMask:%@; optionsOverride:%@; >", NSStringFromClass([self class]), _saturation, _transitionTime, _optionsMask, _optionsOverride]; - return descriptionString; -} + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} @end + @implementation MTRColorControlClusterMoveSaturationParams - (instancetype)init { @@ -10090,6 +18051,64 @@ - (NSString *)description } @end + +@implementation MTRColorControlClusterMoveSaturationParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.moveMode = static_cast>(self.moveMode.unsignedCharValue); + } + { + encodableStruct.rate = self.rate.unsignedCharValue; + } + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRColorControlClusterStepSaturationParams - (instancetype)init { @@ -10132,6 +18151,67 @@ - (NSString *)description } @end + +@implementation MTRColorControlClusterStepSaturationParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ColorControl::Commands::StepSaturation::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.stepMode = static_cast>(self.stepMode.unsignedCharValue); + } + { + encodableStruct.stepSize = self.stepSize.unsignedCharValue; + } + { + encodableStruct.transitionTime = self.transitionTime.unsignedCharValue; + } + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRColorControlClusterMoveToHueAndSaturationParams - (instancetype)init { @@ -10174,6 +18254,67 @@ - (NSString *)description } @end + +@implementation MTRColorControlClusterMoveToHueAndSaturationParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ColorControl::Commands::MoveToHueAndSaturation::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.hue = self.hue.unsignedCharValue; + } + { + encodableStruct.saturation = self.saturation.unsignedCharValue; + } + { + encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; + } + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRColorControlClusterMoveToColorParams - (instancetype)init { @@ -10216,6 +18357,67 @@ - (NSString *)description } @end + +@implementation MTRColorControlClusterMoveToColorParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ColorControl::Commands::MoveToColor::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.colorX = self.colorX.unsignedShortValue; + } + { + encodableStruct.colorY = self.colorY.unsignedShortValue; + } + { + encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; + } + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRColorControlClusterMoveColorParams - (instancetype)init { @@ -10255,6 +18457,64 @@ - (NSString *)description } @end + +@implementation MTRColorControlClusterMoveColorParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ColorControl::Commands::MoveColor::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.rateX = self.rateX.shortValue; + } + { + encodableStruct.rateY = self.rateY.shortValue; + } + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRColorControlClusterStepColorParams - (instancetype)init { @@ -10297,6 +18557,67 @@ - (NSString *)description } @end + +@implementation MTRColorControlClusterStepColorParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ColorControl::Commands::StepColor::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.stepX = self.stepX.shortValue; + } + { + encodableStruct.stepY = self.stepY.shortValue; + } + { + encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; + } + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRColorControlClusterMoveToColorTemperatureParams - (instancetype)init { @@ -10308,33 +18629,90 @@ - (instancetype)init _optionsMask = @(0); - _optionsOverride = @(0); - _timedInvokeTimeoutMs = nil; - _serverSideProcessingTimeout = nil; + _optionsOverride = @(0); + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRColorControlClusterMoveToColorTemperatureParams alloc] init]; + + other.colorTemperatureMireds = self.colorTemperatureMireds; + other.transitionTime = self.transitionTime; + other.optionsMask = self.optionsMask; + other.optionsOverride = self.optionsOverride; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: colorTemperatureMireds:%@; transitionTime:%@; optionsMask:%@; optionsOverride:%@; >", NSStringFromClass([self class]), _colorTemperatureMireds, _transitionTime, _optionsMask, _optionsOverride]; + return descriptionString; +} + +@end + +@implementation MTRColorControlClusterMoveToColorTemperatureParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ColorControl::Commands::MoveToColorTemperature::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.colorTemperatureMireds = self.colorTemperatureMireds.unsignedShortValue; + } + { + encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; + } + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; } - return self; -} -- (id)copyWithZone:(NSZone * _Nullable)zone; -{ - auto other = [[MTRColorControlClusterMoveToColorTemperatureParams alloc] init]; + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); - other.colorTemperatureMireds = self.colorTemperatureMireds; - other.transitionTime = self.transitionTime; - other.optionsMask = self.optionsMask; - other.optionsOverride = self.optionsOverride; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); - return other; + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); } -- (NSString *)description +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: colorTemperatureMireds:%@; transitionTime:%@; optionsMask:%@; optionsOverride:%@; >", NSStringFromClass([self class]), _colorTemperatureMireds, _transitionTime, _optionsMask, _optionsOverride]; - return descriptionString; -} + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} @end @implementation MTRColorControlClusterMoveToColorTemperatureParams (Deprecated) @@ -10391,6 +18769,67 @@ - (NSString *)description } @end + +@implementation MTRColorControlClusterEnhancedMoveToHueParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.enhancedHue = self.enhancedHue.unsignedShortValue; + } + { + encodableStruct.direction = static_cast>(self.direction.unsignedCharValue); + } + { + encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; + } + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRColorControlClusterEnhancedMoveHueParams - (instancetype)init { @@ -10430,6 +18869,64 @@ - (NSString *)description } @end + +@implementation MTRColorControlClusterEnhancedMoveHueParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.moveMode = static_cast>(self.moveMode.unsignedCharValue); + } + { + encodableStruct.rate = self.rate.unsignedShortValue; + } + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRColorControlClusterEnhancedStepHueParams - (instancetype)init { @@ -10472,6 +18969,67 @@ - (NSString *)description } @end + +@implementation MTRColorControlClusterEnhancedStepHueParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ColorControl::Commands::EnhancedStepHue::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.stepMode = static_cast>(self.stepMode.unsignedCharValue); + } + { + encodableStruct.stepSize = self.stepSize.unsignedShortValue; + } + { + encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; + } + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRColorControlClusterEnhancedMoveToHueAndSaturationParams - (instancetype)init { @@ -10514,6 +19072,67 @@ - (NSString *)description } @end + +@implementation MTRColorControlClusterEnhancedMoveToHueAndSaturationParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHueAndSaturation::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.enhancedHue = self.enhancedHue.unsignedShortValue; + } + { + encodableStruct.saturation = self.saturation.unsignedCharValue; + } + { + encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; + } + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRColorControlClusterColorLoopSetParams - (instancetype)init { @@ -10562,6 +19181,73 @@ - (NSString *)description } @end + +@implementation MTRColorControlClusterColorLoopSetParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.updateFlags = static_cast>(self.updateFlags.unsignedCharValue); + } + { + encodableStruct.action = static_cast>(self.action.unsignedCharValue); + } + { + encodableStruct.direction = static_cast>(self.direction.unsignedCharValue); + } + { + encodableStruct.time = self.time.unsignedShortValue; + } + { + encodableStruct.startHue = self.startHue.unsignedShortValue; + } + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRColorControlClusterStopMoveStepParams - (instancetype)init { @@ -10595,6 +19281,58 @@ - (NSString *)description } @end + +@implementation MTRColorControlClusterStopMoveStepParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ColorControl::Commands::StopMoveStep::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRColorControlClusterMoveColorTemperatureParams - (instancetype)init { @@ -10614,32 +19352,96 @@ - (instancetype)init _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } - return self; -} + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRColorControlClusterMoveColorTemperatureParams alloc] init]; + + other.moveMode = self.moveMode; + other.rate = self.rate; + other.colorTemperatureMinimumMireds = self.colorTemperatureMinimumMireds; + other.colorTemperatureMaximumMireds = self.colorTemperatureMaximumMireds; + other.optionsMask = self.optionsMask; + other.optionsOverride = self.optionsOverride; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: moveMode:%@; rate:%@; colorTemperatureMinimumMireds:%@; colorTemperatureMaximumMireds:%@; optionsMask:%@; optionsOverride:%@; >", NSStringFromClass([self class]), _moveMode, _rate, _colorTemperatureMinimumMireds, _colorTemperatureMaximumMireds, _optionsMask, _optionsOverride]; + return descriptionString; +} + +@end + +@implementation MTRColorControlClusterMoveColorTemperatureParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.moveMode = static_cast>(self.moveMode.unsignedCharValue); + } + { + encodableStruct.rate = self.rate.unsignedShortValue; + } + { + encodableStruct.colorTemperatureMinimumMireds = self.colorTemperatureMinimumMireds.unsignedShortValue; + } + { + encodableStruct.colorTemperatureMaximumMireds = self.colorTemperatureMaximumMireds.unsignedShortValue; + } + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + } -- (id)copyWithZone:(NSZone * _Nullable)zone; -{ - auto other = [[MTRColorControlClusterMoveColorTemperatureParams alloc] init]; + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } - other.moveMode = self.moveMode; - other.rate = self.rate; - other.colorTemperatureMinimumMireds = self.colorTemperatureMinimumMireds; - other.colorTemperatureMaximumMireds = self.colorTemperatureMaximumMireds; - other.optionsMask = self.optionsMask; - other.optionsOverride = self.optionsOverride; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); - return other; + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); } -- (NSString *)description +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: moveMode:%@; rate:%@; colorTemperatureMinimumMireds:%@; colorTemperatureMaximumMireds:%@; optionsMask:%@; optionsOverride:%@; >", NSStringFromClass([self class]), _moveMode, _rate, _colorTemperatureMinimumMireds, _colorTemperatureMaximumMireds, _optionsMask, _optionsOverride]; - return descriptionString; -} + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} @end + @implementation MTRColorControlClusterStepColorTemperatureParams - (instancetype)init { @@ -10688,6 +19490,73 @@ - (NSString *)description } @end + +@implementation MTRColorControlClusterStepColorTemperatureParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ColorControl::Commands::StepColorTemperature::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.stepMode = static_cast>(self.stepMode.unsignedCharValue); + } + { + encodableStruct.stepSize = self.stepSize.unsignedShortValue; + } + { + encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; + } + { + encodableStruct.colorTemperatureMinimumMireds = self.colorTemperatureMinimumMireds.unsignedShortValue; + } + { + encodableStruct.colorTemperatureMaximumMireds = self.colorTemperatureMaximumMireds.unsignedShortValue; + } + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRChannelClusterChangeChannelParams - (instancetype)init { @@ -10718,6 +19587,55 @@ - (NSString *)description } @end + +@implementation MTRChannelClusterChangeChannelParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Channel::Commands::ChangeChannel::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.match = AsCharSpan(self.match); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRChannelClusterChangeChannelResponseParams - (instancetype)init { @@ -10810,7 +19728,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Channel: } return CHIP_NO_ERROR; } + @end + @implementation MTRChannelClusterChangeChannelByNumberParams - (instancetype)init { @@ -10844,6 +19764,58 @@ - (NSString *)description } @end + +@implementation MTRChannelClusterChangeChannelByNumberParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.majorNumber = self.majorNumber.unsignedShortValue; + } + { + encodableStruct.minorNumber = self.minorNumber.unsignedShortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRChannelClusterSkipChannelParams - (instancetype)init { @@ -10874,6 +19846,55 @@ - (NSString *)description } @end + +@implementation MTRChannelClusterSkipChannelParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::Channel::Commands::SkipChannel::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.count = self.count.shortValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTargetNavigatorClusterNavigateTargetParams - (instancetype)init { @@ -10907,6 +19928,61 @@ - (NSString *)description } @end + +@implementation MTRTargetNavigatorClusterNavigateTargetParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::TargetNavigator::Commands::NavigateTarget::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.target = self.target.unsignedCharValue; + } + { + if (self.data != nil) { + auto & definedValue_0 = encodableStruct.data.Emplace(); + definedValue_0 = AsCharSpan(self.data); + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTargetNavigatorClusterNavigateTargetResponseParams - (instancetype)init { @@ -10999,7 +20075,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::TargetNa } return CHIP_NO_ERROR; } + @end + @implementation MTRMediaPlaybackClusterPlayParams - (instancetype)init { @@ -11027,6 +20105,52 @@ - (NSString *)description } @end + +@implementation MTRMediaPlaybackClusterPlayParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::MediaPlayback::Commands::Play::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRMediaPlaybackClusterPauseParams - (instancetype)init { @@ -11054,6 +20178,52 @@ - (NSString *)description } @end + +@implementation MTRMediaPlaybackClusterPauseParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::MediaPlayback::Commands::Pause::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRMediaPlaybackClusterStopParams - (instancetype)init { @@ -11082,6 +20252,51 @@ - (NSString *)description @end +@implementation MTRMediaPlaybackClusterStopParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::MediaPlayback::Commands::Stop::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRMediaPlaybackClusterStopPlaybackParams @dynamic timedInvokeTimeoutMs; @@ -11112,8 +20327,54 @@ - (NSString *)description NSString * descriptionString = [NSString stringWithFormat:@"<%@: >", NSStringFromClass([self class])]; return descriptionString; } - + +@end + +@implementation MTRMediaPlaybackClusterStartOverParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::MediaPlayback::Commands::StartOver::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} @end + @implementation MTRMediaPlaybackClusterPreviousParams - (instancetype)init { @@ -11141,6 +20402,52 @@ - (NSString *)description } @end + +@implementation MTRMediaPlaybackClusterPreviousParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::MediaPlayback::Commands::Previous::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRMediaPlaybackClusterNextParams - (instancetype)init { @@ -11168,6 +20475,52 @@ - (NSString *)description } @end + +@implementation MTRMediaPlaybackClusterNextParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::MediaPlayback::Commands::Next::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRMediaPlaybackClusterRewindParams - (instancetype)init { @@ -11195,6 +20548,52 @@ - (NSString *)description } @end + +@implementation MTRMediaPlaybackClusterRewindParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::MediaPlayback::Commands::Rewind::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRMediaPlaybackClusterFastForwardParams - (instancetype)init { @@ -11222,6 +20621,52 @@ - (NSString *)description } @end + +@implementation MTRMediaPlaybackClusterFastForwardParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::MediaPlayback::Commands::FastForward::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRMediaPlaybackClusterSkipForwardParams - (instancetype)init { @@ -11252,6 +20697,55 @@ - (NSString *)description } @end + +@implementation MTRMediaPlaybackClusterSkipForwardParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::MediaPlayback::Commands::SkipForward::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.deltaPositionMilliseconds = self.deltaPositionMilliseconds.unsignedLongLongValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRMediaPlaybackClusterSkipBackwardParams - (instancetype)init { @@ -11282,6 +20776,55 @@ - (NSString *)description } @end + +@implementation MTRMediaPlaybackClusterSkipBackwardParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::MediaPlayback::Commands::SkipBackward::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.deltaPositionMilliseconds = self.deltaPositionMilliseconds.unsignedLongLongValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRMediaPlaybackClusterPlaybackResponseParams - (instancetype)init { @@ -11374,7 +20917,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::MediaPla } return CHIP_NO_ERROR; } + @end + @implementation MTRMediaPlaybackClusterSeekParams - (instancetype)init { @@ -11405,6 +20950,55 @@ - (NSString *)description } @end + +@implementation MTRMediaPlaybackClusterSeekParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::MediaPlayback::Commands::Seek::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.position = self.position.unsignedLongLongValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRMediaInputClusterSelectInputParams - (instancetype)init { @@ -11435,6 +21029,55 @@ - (NSString *)description } @end + +@implementation MTRMediaInputClusterSelectInputParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::MediaInput::Commands::SelectInput::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.index = self.index.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRMediaInputClusterShowInputStatusParams - (instancetype)init { @@ -11462,6 +21105,52 @@ - (NSString *)description } @end + +@implementation MTRMediaInputClusterShowInputStatusParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::MediaInput::Commands::ShowInputStatus::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRMediaInputClusterHideInputStatusParams - (instancetype)init { @@ -11489,6 +21178,52 @@ - (NSString *)description } @end + +@implementation MTRMediaInputClusterHideInputStatusParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::MediaInput::Commands::HideInputStatus::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRMediaInputClusterRenameInputParams - (instancetype)init { @@ -11515,13 +21250,65 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; return other; } -- (NSString *)description +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: index:%@; name:%@; >", NSStringFromClass([self class]), _index, _name]; + return descriptionString; +} + +@end + +@implementation MTRMediaInputClusterRenameInputParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::MediaInput::Commands::RenameInput::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.index = self.index.unsignedCharValue; + } + { + encodableStruct.name = AsCharSpan(self.name); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: index:%@; name:%@; >", NSStringFromClass([self class]), _index, _name]; - return descriptionString; -} + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} @end + @implementation MTRLowPowerClusterSleepParams - (instancetype)init { @@ -11549,6 +21336,52 @@ - (NSString *)description } @end + +@implementation MTRLowPowerClusterSleepParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::LowPower::Commands::Sleep::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRKeypadInputClusterSendKeyParams - (instancetype)init { @@ -11579,6 +21412,55 @@ - (NSString *)description } @end + +@implementation MTRKeypadInputClusterSendKeyParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::KeypadInput::Commands::SendKey::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.keyCode = static_cast>(self.keyCode.unsignedCharValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRKeypadInputClusterSendKeyResponseParams - (instancetype)init { @@ -11657,7 +21539,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::KeypadIn } return CHIP_NO_ERROR; } + @end + @implementation MTRContentLauncherClusterLaunchContentParams - (instancetype)init { @@ -11694,6 +21578,112 @@ - (NSString *)description } @end + +@implementation MTRContentLauncherClusterLaunchContentParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type encodableStruct; + ListFreer listFreer; + { + { + using ListType_1 = std::remove_reference_t; + using ListMemberType_1 = ListMemberTypeGetter::Type; + if (self.search.parameterList.count != 0) { + auto * listHolder_1 = new ListHolder(self.search.parameterList.count); + if (listHolder_1 == nullptr || listHolder_1->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_1); + for (size_t i_1 = 0; i_1 < self.search.parameterList.count; ++i_1) { + if (![self.search.parameterList[i_1] isKindOfClass:[MTRContentLauncherClusterParameterStruct class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_1 = (MTRContentLauncherClusterParameterStruct *) self.search.parameterList[i_1]; + listHolder_1->mList[i_1].type = static_castmList[i_1].type)>>(element_1.type.unsignedCharValue); + listHolder_1->mList[i_1].value = AsCharSpan(element_1.value); + if (element_1.externalIDList != nil) { + auto & definedValue_3 = listHolder_1->mList[i_1].externalIDList.Emplace(); + { + using ListType_4 = std::remove_reference_t; + using ListMemberType_4 = ListMemberTypeGetter::Type; + if (element_1.externalIDList.count != 0) { + auto * listHolder_4 = new ListHolder(element_1.externalIDList.count); + if (listHolder_4 == nullptr || listHolder_4->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_4); + for (size_t i_4 = 0; i_4 < element_1.externalIDList.count; ++i_4) { + if (![element_1.externalIDList[i_4] isKindOfClass:[MTRContentLauncherClusterAdditionalInfoStruct class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_4 = (MTRContentLauncherClusterAdditionalInfoStruct *) element_1.externalIDList[i_4]; + listHolder_4->mList[i_4].name = AsCharSpan(element_4.name); + listHolder_4->mList[i_4].value = AsCharSpan(element_4.value); + } + definedValue_3 = ListType_4(listHolder_4->mList, element_1.externalIDList.count); + } else { + definedValue_3 = ListType_4(); + } + } + } + } + encodableStruct.search.parameterList = ListType_1(listHolder_1->mList, self.search.parameterList.count); + } else { + encodableStruct.search.parameterList = ListType_1(); + } + } + } + { + encodableStruct.autoPlay = self.autoPlay.boolValue; + } + { + if (self.data != nil) { + auto & definedValue_0 = encodableStruct.data.Emplace(); + definedValue_0 = AsCharSpan(self.data); + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRContentLauncherClusterLaunchURLParams - (instancetype)init { @@ -11730,6 +21720,152 @@ - (NSString *)description } @end + +@implementation MTRContentLauncherClusterLaunchURLParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.contentURL = AsCharSpan(self.contentURL); + } + { + if (self.displayString != nil) { + auto & definedValue_0 = encodableStruct.displayString.Emplace(); + definedValue_0 = AsCharSpan(self.displayString); + } + } + { + if (self.brandingInformation != nil) { + auto & definedValue_0 = encodableStruct.brandingInformation.Emplace(); + definedValue_0.providerName = AsCharSpan(self.brandingInformation.providerName); + if (self.brandingInformation.background != nil) { + auto & definedValue_2 = definedValue_0.background.Emplace(); + if (self.brandingInformation.background.imageURL != nil) { + auto & definedValue_4 = definedValue_2.imageURL.Emplace(); + definedValue_4 = AsCharSpan(self.brandingInformation.background.imageURL); + } + if (self.brandingInformation.background.color != nil) { + auto & definedValue_4 = definedValue_2.color.Emplace(); + definedValue_4 = AsCharSpan(self.brandingInformation.background.color); + } + if (self.brandingInformation.background.size != nil) { + auto & definedValue_4 = definedValue_2.size.Emplace(); + definedValue_4.width = self.brandingInformation.background.size.width.doubleValue; + definedValue_4.height = self.brandingInformation.background.size.height.doubleValue; + definedValue_4.metric = static_cast>(self.brandingInformation.background.size.metric.unsignedCharValue); + } + } + if (self.brandingInformation.logo != nil) { + auto & definedValue_2 = definedValue_0.logo.Emplace(); + if (self.brandingInformation.logo.imageURL != nil) { + auto & definedValue_4 = definedValue_2.imageURL.Emplace(); + definedValue_4 = AsCharSpan(self.brandingInformation.logo.imageURL); + } + if (self.brandingInformation.logo.color != nil) { + auto & definedValue_4 = definedValue_2.color.Emplace(); + definedValue_4 = AsCharSpan(self.brandingInformation.logo.color); + } + if (self.brandingInformation.logo.size != nil) { + auto & definedValue_4 = definedValue_2.size.Emplace(); + definedValue_4.width = self.brandingInformation.logo.size.width.doubleValue; + definedValue_4.height = self.brandingInformation.logo.size.height.doubleValue; + definedValue_4.metric = static_cast>(self.brandingInformation.logo.size.metric.unsignedCharValue); + } + } + if (self.brandingInformation.progressBar != nil) { + auto & definedValue_2 = definedValue_0.progressBar.Emplace(); + if (self.brandingInformation.progressBar.imageURL != nil) { + auto & definedValue_4 = definedValue_2.imageURL.Emplace(); + definedValue_4 = AsCharSpan(self.brandingInformation.progressBar.imageURL); + } + if (self.brandingInformation.progressBar.color != nil) { + auto & definedValue_4 = definedValue_2.color.Emplace(); + definedValue_4 = AsCharSpan(self.brandingInformation.progressBar.color); + } + if (self.brandingInformation.progressBar.size != nil) { + auto & definedValue_4 = definedValue_2.size.Emplace(); + definedValue_4.width = self.brandingInformation.progressBar.size.width.doubleValue; + definedValue_4.height = self.brandingInformation.progressBar.size.height.doubleValue; + definedValue_4.metric = static_cast>(self.brandingInformation.progressBar.size.metric.unsignedCharValue); + } + } + if (self.brandingInformation.splash != nil) { + auto & definedValue_2 = definedValue_0.splash.Emplace(); + if (self.brandingInformation.splash.imageURL != nil) { + auto & definedValue_4 = definedValue_2.imageURL.Emplace(); + definedValue_4 = AsCharSpan(self.brandingInformation.splash.imageURL); + } + if (self.brandingInformation.splash.color != nil) { + auto & definedValue_4 = definedValue_2.color.Emplace(); + definedValue_4 = AsCharSpan(self.brandingInformation.splash.color); + } + if (self.brandingInformation.splash.size != nil) { + auto & definedValue_4 = definedValue_2.size.Emplace(); + definedValue_4.width = self.brandingInformation.splash.size.width.doubleValue; + definedValue_4.height = self.brandingInformation.splash.size.height.doubleValue; + definedValue_4.metric = static_cast>(self.brandingInformation.splash.size.metric.unsignedCharValue); + } + } + if (self.brandingInformation.waterMark != nil) { + auto & definedValue_2 = definedValue_0.waterMark.Emplace(); + if (self.brandingInformation.waterMark.imageURL != nil) { + auto & definedValue_4 = definedValue_2.imageURL.Emplace(); + definedValue_4 = AsCharSpan(self.brandingInformation.waterMark.imageURL); + } + if (self.brandingInformation.waterMark.color != nil) { + auto & definedValue_4 = definedValue_2.color.Emplace(); + definedValue_4 = AsCharSpan(self.brandingInformation.waterMark.color); + } + if (self.brandingInformation.waterMark.size != nil) { + auto & definedValue_4 = definedValue_2.size.Emplace(); + definedValue_4.width = self.brandingInformation.waterMark.size.width.doubleValue; + definedValue_4.height = self.brandingInformation.waterMark.size.height.doubleValue; + definedValue_4.metric = static_cast>(self.brandingInformation.waterMark.size.metric.unsignedCharValue); + } + } + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRContentLauncherClusterLauncherResponseParams - (instancetype)init { @@ -11822,6 +21958,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::ContentL } return CHIP_NO_ERROR; } + @end @implementation MTRContentLauncherClusterLaunchResponseParams @@ -11860,6 +21997,55 @@ - (NSString *)description } @end + +@implementation MTRAudioOutputClusterSelectOutputParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::AudioOutput::Commands::SelectOutput::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.index = self.index.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRAudioOutputClusterRenameOutputParams - (instancetype)init { @@ -11893,14 +22079,156 @@ - (NSString *)description } @end + +@implementation MTRAudioOutputClusterRenameOutputParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::AudioOutput::Commands::RenameOutput::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.index = self.index.unsignedCharValue; + } + { + encodableStruct.name = AsCharSpan(self.name); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRApplicationLauncherClusterLaunchAppParams - (instancetype)init { if (self = [super init]) { _application = nil; - - _data = nil; + + _data = nil; + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRApplicationLauncherClusterLaunchAppParams alloc] init]; + + other.application = self.application; + other.data = self.data; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: application:%@; data:%@; >", NSStringFromClass([self class]), _application, [_data base64EncodedStringWithOptions:0]]; + return descriptionString; +} + +@end + +@implementation MTRApplicationLauncherClusterLaunchAppParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ApplicationLauncher::Commands::LaunchApp::Type encodableStruct; + ListFreer listFreer; + { + if (self.application != nil) { + auto & definedValue_0 = encodableStruct.application.Emplace(); + definedValue_0.catalogVendorID = self.application.catalogVendorID.unsignedShortValue; + definedValue_0.applicationID = AsCharSpan(self.application.applicationID); + } + } + { + if (self.data != nil) { + auto & definedValue_0 = encodableStruct.data.Emplace(); + definedValue_0 = AsByteSpan(self.data); + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +@implementation MTRApplicationLauncherClusterStopAppParams +- (instancetype)init +{ + if (self = [super init]) { + + _application = nil; _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } @@ -11909,10 +22237,9 @@ - (instancetype)init - (id)copyWithZone:(NSZone * _Nullable)zone; { - auto other = [[MTRApplicationLauncherClusterLaunchAppParams alloc] init]; + auto other = [[MTRApplicationLauncherClusterStopAppParams alloc] init]; other.application = self.application; - other.data = self.data; other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; @@ -11921,41 +22248,64 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: application:%@; data:%@; >", NSStringFromClass([self class]), _application, [_data base64EncodedStringWithOptions:0]]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: application:%@; >", NSStringFromClass([self class]), _application]; return descriptionString; } @end -@implementation MTRApplicationLauncherClusterStopAppParams -- (instancetype)init + +@implementation MTRApplicationLauncherClusterStopAppParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader { - if (self = [super init]) { + chip::app::Clusters::ApplicationLauncher::Commands::StopApp::Type encodableStruct; + ListFreer listFreer; + { + if (self.application != nil) { + auto & definedValue_0 = encodableStruct.application.Emplace(); + definedValue_0.catalogVendorID = self.application.catalogVendorID.unsignedShortValue; + definedValue_0.applicationID = AsCharSpan(self.application.applicationID); + } + } - _application = nil; - _timedInvokeTimeoutMs = nil; - _serverSideProcessingTimeout = nil; + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; } - return self; -} -- (id)copyWithZone:(NSZone * _Nullable)zone; -{ - auto other = [[MTRApplicationLauncherClusterStopAppParams alloc] init]; + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); - other.application = self.application; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); - return other; + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); } -- (NSString *)description +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: application:%@; >", NSStringFromClass([self class]), _application]; - return descriptionString; -} + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} @end + @implementation MTRApplicationLauncherClusterHideAppParams - (instancetype)init { @@ -11986,6 +22336,59 @@ - (NSString *)description } @end + +@implementation MTRApplicationLauncherClusterHideAppParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ApplicationLauncher::Commands::HideApp::Type encodableStruct; + ListFreer listFreer; + { + if (self.application != nil) { + auto & definedValue_0 = encodableStruct.application.Emplace(); + definedValue_0.catalogVendorID = self.application.catalogVendorID.unsignedShortValue; + definedValue_0.applicationID = AsCharSpan(self.application.applicationID); + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRApplicationLauncherClusterLauncherResponseParams - (instancetype)init { @@ -12074,7 +22477,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Applicat } return CHIP_NO_ERROR; } + @end + @implementation MTRAccountLoginClusterGetSetupPINParams - (instancetype)init { @@ -12105,6 +22510,55 @@ - (NSString *)description } @end + +@implementation MTRAccountLoginClusterGetSetupPINParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::AccountLogin::Commands::GetSetupPIN::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.tempAccountIdentifier = AsCharSpan(self.tempAccountIdentifier); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRAccountLoginClusterGetSetupPINResponseParams - (instancetype)init { @@ -12187,7 +22641,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::AccountL } return CHIP_NO_ERROR; } + @end + @implementation MTRAccountLoginClusterLoginParams - (instancetype)init { @@ -12221,6 +22677,58 @@ - (NSString *)description } @end + +@implementation MTRAccountLoginClusterLoginParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::AccountLogin::Commands::Login::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.tempAccountIdentifier = AsCharSpan(self.tempAccountIdentifier); + } + { + encodableStruct.setupPIN = AsCharSpan(self.setupPIN); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRAccountLoginClusterLogoutParams - (instancetype)init { @@ -12248,6 +22756,52 @@ - (NSString *)description } @end + +@implementation MTRAccountLoginClusterLogoutParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::AccountLogin::Commands::Logout::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRElectricalMeasurementClusterGetProfileInfoResponseCommandParams - (instancetype)init { @@ -12358,7 +22912,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Electric } return CHIP_NO_ERROR; } + @end + @implementation MTRElectricalMeasurementClusterGetProfileInfoCommandParams - (instancetype)init { @@ -12386,6 +22942,52 @@ - (NSString *)description } @end + +@implementation MTRElectricalMeasurementClusterGetProfileInfoCommandParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ElectricalMeasurement::Commands::GetProfileInfoCommand::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRElectricalMeasurementClusterGetMeasurementProfileResponseCommandParams - (instancetype)init { @@ -12508,7 +23110,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Electric } return CHIP_NO_ERROR; } + @end + @implementation MTRElectricalMeasurementClusterGetMeasurementProfileCommandParams - (instancetype)init { @@ -12545,6 +23149,61 @@ - (NSString *)description } @end + +@implementation MTRElectricalMeasurementClusterGetMeasurementProfileCommandParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ElectricalMeasurement::Commands::GetMeasurementProfileCommand::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.attributeId = self.attributeId.unsignedShortValue; + } + { + encodableStruct.startTime = self.startTime.unsignedIntValue; + } + { + encodableStruct.numberOfIntervals = self.numberOfIntervals.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRUnitTestingClusterTestParams - (instancetype)init { @@ -12573,6 +23232,51 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterTestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::Test::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterTestParams @dynamic timedInvokeTimeoutMs; @@ -12656,6 +23360,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTest } return CHIP_NO_ERROR; } + @end @implementation MTRTestClusterClusterTestSpecificResponseParams @@ -12691,6 +23396,51 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterTestNotHandledParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TestNotHandled::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterTestNotHandledParams @dynamic timedInvokeTimeoutMs; @@ -12774,6 +23524,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTest } return CHIP_NO_ERROR; } + @end @implementation MTRTestClusterClusterTestAddArgumentsResponseParams @@ -12809,6 +23560,51 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterTestSpecificParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TestSpecific::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterTestSpecificParams @dynamic timedInvokeTimeoutMs; @@ -12892,6 +23688,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTest } return CHIP_NO_ERROR; } + @end @implementation MTRTestClusterClusterTestSimpleArgumentResponseParams @@ -12927,6 +23724,51 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterTestUnknownCommandParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TestUnknownCommand::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterTestUnknownCommandParams @dynamic timedInvokeTimeoutMs; @@ -13195,6 +24037,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTest } return CHIP_NO_ERROR; } + @end @implementation MTRTestClusterClusterTestStructArrayArgumentResponseParams @@ -13241,6 +24084,57 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterTestAddArgumentsParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TestAddArguments::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.arg1 = self.arg1.unsignedCharValue; + } + { + encodableStruct.arg2 = self.arg2.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterTestAddArgumentsParams @dynamic arg1; @dynamic arg2; @@ -13340,6 +24234,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTest } return CHIP_NO_ERROR; } + @end @implementation MTRTestClusterClusterTestListInt8UReverseResponseParams @@ -13378,6 +24273,54 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterTestSimpleArgumentRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TestSimpleArgumentRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.arg1 = self.arg1.boolValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterTestSimpleArgumentRequestParams @dynamic arg1; @@ -13468,6 +24411,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTest } return CHIP_NO_ERROR; } + @end @implementation MTRTestClusterClusterTestEnumsResponseParams @@ -13522,6 +24466,264 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterTestStructArrayArgumentRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TestStructArrayArgumentRequest::Type encodableStruct; + ListFreer listFreer; + { + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (self.arg1.count != 0) { + auto * listHolder_0 = new ListHolder(self.arg1.count); + if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_0); + for (size_t i_0 = 0; i_0 < self.arg1.count; ++i_0) { + if (![self.arg1[i_0] isKindOfClass:[MTRUnitTestingClusterNestedStructList class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_0 = (MTRUnitTestingClusterNestedStructList *) self.arg1[i_0]; + listHolder_0->mList[i_0].a = element_0.a.unsignedCharValue; + listHolder_0->mList[i_0].b = element_0.b.boolValue; + listHolder_0->mList[i_0].c.a = element_0.c.a.unsignedCharValue; + listHolder_0->mList[i_0].c.b = element_0.c.b.boolValue; + listHolder_0->mList[i_0].c.c = static_castmList[i_0].c.c)>>(element_0.c.c.unsignedCharValue); + listHolder_0->mList[i_0].c.d = AsByteSpan(element_0.c.d); + listHolder_0->mList[i_0].c.e = AsCharSpan(element_0.c.e); + listHolder_0->mList[i_0].c.f = static_castmList[i_0].c.f)>>(element_0.c.f.unsignedCharValue); + listHolder_0->mList[i_0].c.g = element_0.c.g.floatValue; + listHolder_0->mList[i_0].c.h = element_0.c.h.doubleValue; + { + using ListType_2 = std::remove_reference_tmList[i_0].d)>; + using ListMemberType_2 = ListMemberTypeGetter::Type; + if (element_0.d.count != 0) { + auto * listHolder_2 = new ListHolder(element_0.d.count); + if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_2); + for (size_t i_2 = 0; i_2 < element_0.d.count; ++i_2) { + if (![element_0.d[i_2] isKindOfClass:[MTRUnitTestingClusterSimpleStruct class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_2 = (MTRUnitTestingClusterSimpleStruct *) element_0.d[i_2]; + listHolder_2->mList[i_2].a = element_2.a.unsignedCharValue; + listHolder_2->mList[i_2].b = element_2.b.boolValue; + listHolder_2->mList[i_2].c = static_castmList[i_2].c)>>(element_2.c.unsignedCharValue); + listHolder_2->mList[i_2].d = AsByteSpan(element_2.d); + listHolder_2->mList[i_2].e = AsCharSpan(element_2.e); + listHolder_2->mList[i_2].f = static_castmList[i_2].f)>>(element_2.f.unsignedCharValue); + listHolder_2->mList[i_2].g = element_2.g.floatValue; + listHolder_2->mList[i_2].h = element_2.h.doubleValue; + } + listHolder_0->mList[i_0].d = ListType_2(listHolder_2->mList, element_0.d.count); + } else { + listHolder_0->mList[i_0].d = ListType_2(); + } + } + { + using ListType_2 = std::remove_reference_tmList[i_0].e)>; + using ListMemberType_2 = ListMemberTypeGetter::Type; + if (element_0.e.count != 0) { + auto * listHolder_2 = new ListHolder(element_0.e.count); + if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_2); + for (size_t i_2 = 0; i_2 < element_0.e.count; ++i_2) { + if (![element_0.e[i_2] isKindOfClass:[NSNumber class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_2 = (NSNumber *) element_0.e[i_2]; + listHolder_2->mList[i_2] = element_2.unsignedIntValue; + } + listHolder_0->mList[i_0].e = ListType_2(listHolder_2->mList, element_0.e.count); + } else { + listHolder_0->mList[i_0].e = ListType_2(); + } + } + { + using ListType_2 = std::remove_reference_tmList[i_0].f)>; + using ListMemberType_2 = ListMemberTypeGetter::Type; + if (element_0.f.count != 0) { + auto * listHolder_2 = new ListHolder(element_0.f.count); + if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_2); + for (size_t i_2 = 0; i_2 < element_0.f.count; ++i_2) { + if (![element_0.f[i_2] isKindOfClass:[NSData class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_2 = (NSData *) element_0.f[i_2]; + listHolder_2->mList[i_2] = AsByteSpan(element_2); + } + listHolder_0->mList[i_0].f = ListType_2(listHolder_2->mList, element_0.f.count); + } else { + listHolder_0->mList[i_0].f = ListType_2(); + } + } + { + using ListType_2 = std::remove_reference_tmList[i_0].g)>; + using ListMemberType_2 = ListMemberTypeGetter::Type; + if (element_0.g.count != 0) { + auto * listHolder_2 = new ListHolder(element_0.g.count); + if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_2); + for (size_t i_2 = 0; i_2 < element_0.g.count; ++i_2) { + if (![element_0.g[i_2] isKindOfClass:[NSNumber class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_2 = (NSNumber *) element_0.g[i_2]; + listHolder_2->mList[i_2] = element_2.unsignedCharValue; + } + listHolder_0->mList[i_0].g = ListType_2(listHolder_2->mList, element_0.g.count); + } else { + listHolder_0->mList[i_0].g = ListType_2(); + } + } + } + encodableStruct.arg1 = ListType_0(listHolder_0->mList, self.arg1.count); + } else { + encodableStruct.arg1 = ListType_0(); + } + } + } + { + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (self.arg2.count != 0) { + auto * listHolder_0 = new ListHolder(self.arg2.count); + if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_0); + for (size_t i_0 = 0; i_0 < self.arg2.count; ++i_0) { + if (![self.arg2[i_0] isKindOfClass:[MTRUnitTestingClusterSimpleStruct class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_0 = (MTRUnitTestingClusterSimpleStruct *) self.arg2[i_0]; + listHolder_0->mList[i_0].a = element_0.a.unsignedCharValue; + listHolder_0->mList[i_0].b = element_0.b.boolValue; + listHolder_0->mList[i_0].c = static_castmList[i_0].c)>>(element_0.c.unsignedCharValue); + listHolder_0->mList[i_0].d = AsByteSpan(element_0.d); + listHolder_0->mList[i_0].e = AsCharSpan(element_0.e); + listHolder_0->mList[i_0].f = static_castmList[i_0].f)>>(element_0.f.unsignedCharValue); + listHolder_0->mList[i_0].g = element_0.g.floatValue; + listHolder_0->mList[i_0].h = element_0.h.doubleValue; + } + encodableStruct.arg2 = ListType_0(listHolder_0->mList, self.arg2.count); + } else { + encodableStruct.arg2 = ListType_0(); + } + } + } + { + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (self.arg3.count != 0) { + auto * listHolder_0 = new ListHolder(self.arg3.count); + if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_0); + for (size_t i_0 = 0; i_0 < self.arg3.count; ++i_0) { + if (![self.arg3[i_0] isKindOfClass:[NSNumber class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_0 = (NSNumber *) self.arg3[i_0]; + listHolder_0->mList[i_0] = static_castmList[i_0])>>(element_0.unsignedCharValue); + } + encodableStruct.arg3 = ListType_0(listHolder_0->mList, self.arg3.count); + } else { + encodableStruct.arg3 = ListType_0(); + } + } + } + { + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (self.arg4.count != 0) { + auto * listHolder_0 = new ListHolder(self.arg4.count); + if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_0); + for (size_t i_0 = 0; i_0 < self.arg4.count; ++i_0) { + if (![self.arg4[i_0] isKindOfClass:[NSNumber class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_0 = (NSNumber *) self.arg4[i_0]; + listHolder_0->mList[i_0] = element_0.boolValue; + } + encodableStruct.arg4 = ListType_0(listHolder_0->mList, self.arg4.count); + } else { + encodableStruct.arg4 = ListType_0(); + } + } + } + { + encodableStruct.arg5 = static_cast>(self.arg5.unsignedCharValue); + } + { + encodableStruct.arg6 = self.arg6.boolValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterTestStructArrayArgumentRequestParams @dynamic arg1; @dynamic arg2; @@ -13645,6 +24847,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTest } return CHIP_NO_ERROR; } + @end @implementation MTRTestClusterClusterTestNullableOptionalResponseParams @@ -13686,6 +24889,61 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterTestStructArgumentRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TestStructArgumentRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.arg1.a = self.arg1.a.unsignedCharValue; + encodableStruct.arg1.b = self.arg1.b.boolValue; + encodableStruct.arg1.c = static_cast>(self.arg1.c.unsignedCharValue); + encodableStruct.arg1.d = AsByteSpan(self.arg1.d); + encodableStruct.arg1.e = AsCharSpan(self.arg1.e); + encodableStruct.arg1.f = static_cast>(self.arg1.f.unsignedCharValue); + encodableStruct.arg1.g = self.arg1.g.floatValue; + encodableStruct.arg1.h = self.arg1.h.doubleValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterTestStructArgumentRequestParams @dynamic arg1; @@ -14086,6 +25344,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTest } return CHIP_NO_ERROR; } + @end @implementation MTRTestClusterClusterTestComplexNullableOptionalResponseParams @@ -14151,6 +25410,63 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterTestNestedStructArgumentRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TestNestedStructArgumentRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.arg1.a = self.arg1.a.unsignedCharValue; + encodableStruct.arg1.b = self.arg1.b.boolValue; + encodableStruct.arg1.c.a = self.arg1.c.a.unsignedCharValue; + encodableStruct.arg1.c.b = self.arg1.c.b.boolValue; + encodableStruct.arg1.c.c = static_cast>(self.arg1.c.c.unsignedCharValue); + encodableStruct.arg1.c.d = AsByteSpan(self.arg1.c.d); + encodableStruct.arg1.c.e = AsCharSpan(self.arg1.c.e); + encodableStruct.arg1.c.f = static_cast>(self.arg1.c.f.unsignedCharValue); + encodableStruct.arg1.c.g = self.arg1.c.g.floatValue; + encodableStruct.arg1.c.h = self.arg1.c.h.doubleValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterTestNestedStructArgumentRequestParams @dynamic arg1; @@ -14235,6 +25551,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTest } return CHIP_NO_ERROR; } + @end @implementation MTRTestClusterClusterBooleanResponseParams @@ -14273,6 +25590,82 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterTestListStructArgumentRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TestListStructArgumentRequest::Type encodableStruct; + ListFreer listFreer; + { + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (self.arg1.count != 0) { + auto * listHolder_0 = new ListHolder(self.arg1.count); + if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_0); + for (size_t i_0 = 0; i_0 < self.arg1.count; ++i_0) { + if (![self.arg1[i_0] isKindOfClass:[MTRUnitTestingClusterSimpleStruct class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_0 = (MTRUnitTestingClusterSimpleStruct *) self.arg1[i_0]; + listHolder_0->mList[i_0].a = element_0.a.unsignedCharValue; + listHolder_0->mList[i_0].b = element_0.b.boolValue; + listHolder_0->mList[i_0].c = static_castmList[i_0].c)>>(element_0.c.unsignedCharValue); + listHolder_0->mList[i_0].d = AsByteSpan(element_0.d); + listHolder_0->mList[i_0].e = AsCharSpan(element_0.e); + listHolder_0->mList[i_0].f = static_castmList[i_0].f)>>(element_0.f.unsignedCharValue); + listHolder_0->mList[i_0].g = element_0.g.floatValue; + listHolder_0->mList[i_0].h = element_0.h.doubleValue; + } + encodableStruct.arg1 = ListType_0(listHolder_0->mList, self.arg1.count); + } else { + encodableStruct.arg1 = ListType_0(); + } + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterTestListStructArgumentRequestParams @dynamic arg1; @@ -14369,6 +25762,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTest } return CHIP_NO_ERROR; } + @end @implementation MTRTestClusterClusterSimpleStructResponseParams @@ -14385,26 +25779,95 @@ - (instancetype)init _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } - return self; -} + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRUnitTestingClusterTestListInt8UArgumentRequestParams alloc] init]; + + other.arg1 = self.arg1; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: arg1:%@; >", NSStringFromClass([self class]), _arg1]; + return descriptionString; +} + +@end + +@implementation MTRUnitTestingClusterTestListInt8UArgumentRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TestListInt8UArgumentRequest::Type encodableStruct; + ListFreer listFreer; + { + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (self.arg1.count != 0) { + auto * listHolder_0 = new ListHolder(self.arg1.count); + if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_0); + for (size_t i_0 = 0; i_0 < self.arg1.count; ++i_0) { + if (![self.arg1[i_0] isKindOfClass:[NSNumber class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_0 = (NSNumber *) self.arg1[i_0]; + listHolder_0->mList[i_0] = element_0.unsignedCharValue; + } + encodableStruct.arg1 = ListType_0(listHolder_0->mList, self.arg1.count); + } else { + encodableStruct.arg1 = ListType_0(); + } + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } -- (id)copyWithZone:(NSZone * _Nullable)zone; -{ - auto other = [[MTRUnitTestingClusterTestListInt8UArgumentRequestParams alloc] init]; + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); - other.arg1 = self.arg1; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); - return other; + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); } -- (NSString *)description +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: arg1:%@; >", NSStringFromClass([self class]), _arg1]; - return descriptionString; -} + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} @end @implementation MTRTestClusterClusterTestListInt8UArgumentRequestParams @@ -14491,6 +25954,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTest } return CHIP_NO_ERROR; } + @end @implementation MTRTestClusterClusterTestEmitTestEventResponseParams @@ -14529,6 +25993,158 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterTestNestedStructListArgumentRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TestNestedStructListArgumentRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.arg1.a = self.arg1.a.unsignedCharValue; + encodableStruct.arg1.b = self.arg1.b.boolValue; + encodableStruct.arg1.c.a = self.arg1.c.a.unsignedCharValue; + encodableStruct.arg1.c.b = self.arg1.c.b.boolValue; + encodableStruct.arg1.c.c = static_cast>(self.arg1.c.c.unsignedCharValue); + encodableStruct.arg1.c.d = AsByteSpan(self.arg1.c.d); + encodableStruct.arg1.c.e = AsCharSpan(self.arg1.c.e); + encodableStruct.arg1.c.f = static_cast>(self.arg1.c.f.unsignedCharValue); + encodableStruct.arg1.c.g = self.arg1.c.g.floatValue; + encodableStruct.arg1.c.h = self.arg1.c.h.doubleValue; + { + using ListType_1 = std::remove_reference_t; + using ListMemberType_1 = ListMemberTypeGetter::Type; + if (self.arg1.d.count != 0) { + auto * listHolder_1 = new ListHolder(self.arg1.d.count); + if (listHolder_1 == nullptr || listHolder_1->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_1); + for (size_t i_1 = 0; i_1 < self.arg1.d.count; ++i_1) { + if (![self.arg1.d[i_1] isKindOfClass:[MTRUnitTestingClusterSimpleStruct class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_1 = (MTRUnitTestingClusterSimpleStruct *) self.arg1.d[i_1]; + listHolder_1->mList[i_1].a = element_1.a.unsignedCharValue; + listHolder_1->mList[i_1].b = element_1.b.boolValue; + listHolder_1->mList[i_1].c = static_castmList[i_1].c)>>(element_1.c.unsignedCharValue); + listHolder_1->mList[i_1].d = AsByteSpan(element_1.d); + listHolder_1->mList[i_1].e = AsCharSpan(element_1.e); + listHolder_1->mList[i_1].f = static_castmList[i_1].f)>>(element_1.f.unsignedCharValue); + listHolder_1->mList[i_1].g = element_1.g.floatValue; + listHolder_1->mList[i_1].h = element_1.h.doubleValue; + } + encodableStruct.arg1.d = ListType_1(listHolder_1->mList, self.arg1.d.count); + } else { + encodableStruct.arg1.d = ListType_1(); + } + } + { + using ListType_1 = std::remove_reference_t; + using ListMemberType_1 = ListMemberTypeGetter::Type; + if (self.arg1.e.count != 0) { + auto * listHolder_1 = new ListHolder(self.arg1.e.count); + if (listHolder_1 == nullptr || listHolder_1->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_1); + for (size_t i_1 = 0; i_1 < self.arg1.e.count; ++i_1) { + if (![self.arg1.e[i_1] isKindOfClass:[NSNumber class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_1 = (NSNumber *) self.arg1.e[i_1]; + listHolder_1->mList[i_1] = element_1.unsignedIntValue; + } + encodableStruct.arg1.e = ListType_1(listHolder_1->mList, self.arg1.e.count); + } else { + encodableStruct.arg1.e = ListType_1(); + } + } + { + using ListType_1 = std::remove_reference_t; + using ListMemberType_1 = ListMemberTypeGetter::Type; + if (self.arg1.f.count != 0) { + auto * listHolder_1 = new ListHolder(self.arg1.f.count); + if (listHolder_1 == nullptr || listHolder_1->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_1); + for (size_t i_1 = 0; i_1 < self.arg1.f.count; ++i_1) { + if (![self.arg1.f[i_1] isKindOfClass:[NSData class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_1 = (NSData *) self.arg1.f[i_1]; + listHolder_1->mList[i_1] = AsByteSpan(element_1); + } + encodableStruct.arg1.f = ListType_1(listHolder_1->mList, self.arg1.f.count); + } else { + encodableStruct.arg1.f = ListType_1(); + } + } + { + using ListType_1 = std::remove_reference_t; + using ListMemberType_1 = ListMemberTypeGetter::Type; + if (self.arg1.g.count != 0) { + auto * listHolder_1 = new ListHolder(self.arg1.g.count); + if (listHolder_1 == nullptr || listHolder_1->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_1); + for (size_t i_1 = 0; i_1 < self.arg1.g.count; ++i_1) { + if (![self.arg1.g[i_1] isKindOfClass:[NSNumber class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_1 = (NSNumber *) self.arg1.g[i_1]; + listHolder_1->mList[i_1] = element_1.unsignedCharValue; + } + encodableStruct.arg1.g = ListType_1(listHolder_1->mList, self.arg1.g.count); + } else { + encodableStruct.arg1.g = ListType_1(); + } + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterTestNestedStructListArgumentRequestParams @dynamic arg1; @@ -14613,6 +26229,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTest } return CHIP_NO_ERROR; } + @end @implementation MTRTestClusterClusterTestEmitTestFabricScopedEventResponseParams @@ -14651,6 +26268,179 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterTestListNestedStructListArgumentRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TestListNestedStructListArgumentRequest::Type encodableStruct; + ListFreer listFreer; + { + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (self.arg1.count != 0) { + auto * listHolder_0 = new ListHolder(self.arg1.count); + if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_0); + for (size_t i_0 = 0; i_0 < self.arg1.count; ++i_0) { + if (![self.arg1[i_0] isKindOfClass:[MTRUnitTestingClusterNestedStructList class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_0 = (MTRUnitTestingClusterNestedStructList *) self.arg1[i_0]; + listHolder_0->mList[i_0].a = element_0.a.unsignedCharValue; + listHolder_0->mList[i_0].b = element_0.b.boolValue; + listHolder_0->mList[i_0].c.a = element_0.c.a.unsignedCharValue; + listHolder_0->mList[i_0].c.b = element_0.c.b.boolValue; + listHolder_0->mList[i_0].c.c = static_castmList[i_0].c.c)>>(element_0.c.c.unsignedCharValue); + listHolder_0->mList[i_0].c.d = AsByteSpan(element_0.c.d); + listHolder_0->mList[i_0].c.e = AsCharSpan(element_0.c.e); + listHolder_0->mList[i_0].c.f = static_castmList[i_0].c.f)>>(element_0.c.f.unsignedCharValue); + listHolder_0->mList[i_0].c.g = element_0.c.g.floatValue; + listHolder_0->mList[i_0].c.h = element_0.c.h.doubleValue; + { + using ListType_2 = std::remove_reference_tmList[i_0].d)>; + using ListMemberType_2 = ListMemberTypeGetter::Type; + if (element_0.d.count != 0) { + auto * listHolder_2 = new ListHolder(element_0.d.count); + if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_2); + for (size_t i_2 = 0; i_2 < element_0.d.count; ++i_2) { + if (![element_0.d[i_2] isKindOfClass:[MTRUnitTestingClusterSimpleStruct class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_2 = (MTRUnitTestingClusterSimpleStruct *) element_0.d[i_2]; + listHolder_2->mList[i_2].a = element_2.a.unsignedCharValue; + listHolder_2->mList[i_2].b = element_2.b.boolValue; + listHolder_2->mList[i_2].c = static_castmList[i_2].c)>>(element_2.c.unsignedCharValue); + listHolder_2->mList[i_2].d = AsByteSpan(element_2.d); + listHolder_2->mList[i_2].e = AsCharSpan(element_2.e); + listHolder_2->mList[i_2].f = static_castmList[i_2].f)>>(element_2.f.unsignedCharValue); + listHolder_2->mList[i_2].g = element_2.g.floatValue; + listHolder_2->mList[i_2].h = element_2.h.doubleValue; + } + listHolder_0->mList[i_0].d = ListType_2(listHolder_2->mList, element_0.d.count); + } else { + listHolder_0->mList[i_0].d = ListType_2(); + } + } + { + using ListType_2 = std::remove_reference_tmList[i_0].e)>; + using ListMemberType_2 = ListMemberTypeGetter::Type; + if (element_0.e.count != 0) { + auto * listHolder_2 = new ListHolder(element_0.e.count); + if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_2); + for (size_t i_2 = 0; i_2 < element_0.e.count; ++i_2) { + if (![element_0.e[i_2] isKindOfClass:[NSNumber class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_2 = (NSNumber *) element_0.e[i_2]; + listHolder_2->mList[i_2] = element_2.unsignedIntValue; + } + listHolder_0->mList[i_0].e = ListType_2(listHolder_2->mList, element_0.e.count); + } else { + listHolder_0->mList[i_0].e = ListType_2(); + } + } + { + using ListType_2 = std::remove_reference_tmList[i_0].f)>; + using ListMemberType_2 = ListMemberTypeGetter::Type; + if (element_0.f.count != 0) { + auto * listHolder_2 = new ListHolder(element_0.f.count); + if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_2); + for (size_t i_2 = 0; i_2 < element_0.f.count; ++i_2) { + if (![element_0.f[i_2] isKindOfClass:[NSData class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_2 = (NSData *) element_0.f[i_2]; + listHolder_2->mList[i_2] = AsByteSpan(element_2); + } + listHolder_0->mList[i_0].f = ListType_2(listHolder_2->mList, element_0.f.count); + } else { + listHolder_0->mList[i_0].f = ListType_2(); + } + } + { + using ListType_2 = std::remove_reference_tmList[i_0].g)>; + using ListMemberType_2 = ListMemberTypeGetter::Type; + if (element_0.g.count != 0) { + auto * listHolder_2 = new ListHolder(element_0.g.count); + if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_2); + for (size_t i_2 = 0; i_2 < element_0.g.count; ++i_2) { + if (![element_0.g[i_2] isKindOfClass:[NSNumber class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_2 = (NSNumber *) element_0.g[i_2]; + listHolder_2->mList[i_2] = element_2.unsignedCharValue; + } + listHolder_0->mList[i_0].g = ListType_2(listHolder_2->mList, element_0.g.count); + } else { + listHolder_0->mList[i_0].g = ListType_2(); + } + } + } + encodableStruct.arg1 = ListType_0(listHolder_0->mList, self.arg1.count); + } else { + encodableStruct.arg1 = ListType_0(); + } + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterTestListNestedStructListArgumentRequestParams @dynamic arg1; @@ -14688,6 +26478,75 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterTestListInt8UReverseRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TestListInt8UReverseRequest::Type encodableStruct; + ListFreer listFreer; + { + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (self.arg1.count != 0) { + auto * listHolder_0 = new ListHolder(self.arg1.count); + if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_0); + for (size_t i_0 = 0; i_0 < self.arg1.count; ++i_0) { + if (![self.arg1[i_0] isKindOfClass:[NSNumber class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_0 = (NSNumber *) self.arg1[i_0]; + listHolder_0->mList[i_0] = element_0.unsignedCharValue; + } + encodableStruct.arg1 = ListType_0(listHolder_0->mList, self.arg1.count); + } else { + encodableStruct.arg1 = ListType_0(); + } + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterTestListInt8UReverseRequestParams @dynamic arg1; @@ -14728,6 +26587,57 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterTestEnumsRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TestEnumsRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.arg1 = static_cast>(self.arg1.unsignedShortValue); + } + { + encodableStruct.arg2 = static_cast>(self.arg2.unsignedCharValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterTestEnumsRequestParams @dynamic arg1; @dynamic arg2; @@ -14766,6 +26676,62 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterTestNullableOptionalRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TestNullableOptionalRequest::Type encodableStruct; + ListFreer listFreer; + { + if (self.arg1 != nil) { + auto & definedValue_0 = encodableStruct.arg1.Emplace(); + if (self.arg1 == nil) { + definedValue_0.SetNull(); + } else { + auto & nonNullValue_1 = definedValue_0.SetNonNull(); + nonNullValue_1 = self.arg1.unsignedCharValue; + } + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterTestNullableOptionalRequestParams @dynamic arg1; @@ -14791,49 +26757,278 @@ - (instancetype)init _nullableStruct = nil; - _optionalStruct = nil; + _optionalStruct = nil; + + _nullableOptionalStruct = nil; + + _nullableList = nil; + + _optionalList = nil; + + _nullableOptionalList = nil; + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRUnitTestingClusterTestComplexNullableOptionalRequestParams alloc] init]; + + other.nullableInt = self.nullableInt; + other.optionalInt = self.optionalInt; + other.nullableOptionalInt = self.nullableOptionalInt; + other.nullableString = self.nullableString; + other.optionalString = self.optionalString; + other.nullableOptionalString = self.nullableOptionalString; + other.nullableStruct = self.nullableStruct; + other.optionalStruct = self.optionalStruct; + other.nullableOptionalStruct = self.nullableOptionalStruct; + other.nullableList = self.nullableList; + other.optionalList = self.optionalList; + other.nullableOptionalList = self.nullableOptionalList; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: nullableInt:%@; optionalInt:%@; nullableOptionalInt:%@; nullableString:%@; optionalString:%@; nullableOptionalString:%@; nullableStruct:%@; optionalStruct:%@; nullableOptionalStruct:%@; nullableList:%@; optionalList:%@; nullableOptionalList:%@; >", NSStringFromClass([self class]), _nullableInt, _optionalInt, _nullableOptionalInt, _nullableString, _optionalString, _nullableOptionalString, _nullableStruct, _optionalStruct, _nullableOptionalStruct, _nullableList, _optionalList, _nullableOptionalList]; + return descriptionString; +} + +@end + +@implementation MTRUnitTestingClusterTestComplexNullableOptionalRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TestComplexNullableOptionalRequest::Type encodableStruct; + ListFreer listFreer; + { + if (self.nullableInt == nil) { + encodableStruct.nullableInt.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.nullableInt.SetNonNull(); + nonNullValue_0 = self.nullableInt.unsignedShortValue; + } + } + { + if (self.optionalInt != nil) { + auto & definedValue_0 = encodableStruct.optionalInt.Emplace(); + definedValue_0 = self.optionalInt.unsignedShortValue; + } + } + { + if (self.nullableOptionalInt != nil) { + auto & definedValue_0 = encodableStruct.nullableOptionalInt.Emplace(); + if (self.nullableOptionalInt == nil) { + definedValue_0.SetNull(); + } else { + auto & nonNullValue_1 = definedValue_0.SetNonNull(); + nonNullValue_1 = self.nullableOptionalInt.unsignedShortValue; + } + } + } + { + if (self.nullableString == nil) { + encodableStruct.nullableString.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.nullableString.SetNonNull(); + nonNullValue_0 = AsCharSpan(self.nullableString); + } + } + { + if (self.optionalString != nil) { + auto & definedValue_0 = encodableStruct.optionalString.Emplace(); + definedValue_0 = AsCharSpan(self.optionalString); + } + } + { + if (self.nullableOptionalString != nil) { + auto & definedValue_0 = encodableStruct.nullableOptionalString.Emplace(); + if (self.nullableOptionalString == nil) { + definedValue_0.SetNull(); + } else { + auto & nonNullValue_1 = definedValue_0.SetNonNull(); + nonNullValue_1 = AsCharSpan(self.nullableOptionalString); + } + } + } + { + if (self.nullableStruct == nil) { + encodableStruct.nullableStruct.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.nullableStruct.SetNonNull(); + nonNullValue_0.a = self.nullableStruct.a.unsignedCharValue; + nonNullValue_0.b = self.nullableStruct.b.boolValue; + nonNullValue_0.c = static_cast>(self.nullableStruct.c.unsignedCharValue); + nonNullValue_0.d = AsByteSpan(self.nullableStruct.d); + nonNullValue_0.e = AsCharSpan(self.nullableStruct.e); + nonNullValue_0.f = static_cast>(self.nullableStruct.f.unsignedCharValue); + nonNullValue_0.g = self.nullableStruct.g.floatValue; + nonNullValue_0.h = self.nullableStruct.h.doubleValue; + } + } + { + if (self.optionalStruct != nil) { + auto & definedValue_0 = encodableStruct.optionalStruct.Emplace(); + definedValue_0.a = self.optionalStruct.a.unsignedCharValue; + definedValue_0.b = self.optionalStruct.b.boolValue; + definedValue_0.c = static_cast>(self.optionalStruct.c.unsignedCharValue); + definedValue_0.d = AsByteSpan(self.optionalStruct.d); + definedValue_0.e = AsCharSpan(self.optionalStruct.e); + definedValue_0.f = static_cast>(self.optionalStruct.f.unsignedCharValue); + definedValue_0.g = self.optionalStruct.g.floatValue; + definedValue_0.h = self.optionalStruct.h.doubleValue; + } + } + { + if (self.nullableOptionalStruct != nil) { + auto & definedValue_0 = encodableStruct.nullableOptionalStruct.Emplace(); + if (self.nullableOptionalStruct == nil) { + definedValue_0.SetNull(); + } else { + auto & nonNullValue_1 = definedValue_0.SetNonNull(); + nonNullValue_1.a = self.nullableOptionalStruct.a.unsignedCharValue; + nonNullValue_1.b = self.nullableOptionalStruct.b.boolValue; + nonNullValue_1.c = static_cast>(self.nullableOptionalStruct.c.unsignedCharValue); + nonNullValue_1.d = AsByteSpan(self.nullableOptionalStruct.d); + nonNullValue_1.e = AsCharSpan(self.nullableOptionalStruct.e); + nonNullValue_1.f = static_cast>(self.nullableOptionalStruct.f.unsignedCharValue); + nonNullValue_1.g = self.nullableOptionalStruct.g.floatValue; + nonNullValue_1.h = self.nullableOptionalStruct.h.doubleValue; + } + } + } + { + if (self.nullableList == nil) { + encodableStruct.nullableList.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.nullableList.SetNonNull(); + { + using ListType_1 = std::remove_reference_t; + using ListMemberType_1 = ListMemberTypeGetter::Type; + if (self.nullableList.count != 0) { + auto * listHolder_1 = new ListHolder(self.nullableList.count); + if (listHolder_1 == nullptr || listHolder_1->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_1); + for (size_t i_1 = 0; i_1 < self.nullableList.count; ++i_1) { + if (![self.nullableList[i_1] isKindOfClass:[NSNumber class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_1 = (NSNumber *) self.nullableList[i_1]; + listHolder_1->mList[i_1] = static_castmList[i_1])>>(element_1.unsignedCharValue); + } + nonNullValue_0 = ListType_1(listHolder_1->mList, self.nullableList.count); + } else { + nonNullValue_0 = ListType_1(); + } + } + } + } + { + if (self.optionalList != nil) { + auto & definedValue_0 = encodableStruct.optionalList.Emplace(); + { + using ListType_1 = std::remove_reference_t; + using ListMemberType_1 = ListMemberTypeGetter::Type; + if (self.optionalList.count != 0) { + auto * listHolder_1 = new ListHolder(self.optionalList.count); + if (listHolder_1 == nullptr || listHolder_1->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_1); + for (size_t i_1 = 0; i_1 < self.optionalList.count; ++i_1) { + if (![self.optionalList[i_1] isKindOfClass:[NSNumber class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_1 = (NSNumber *) self.optionalList[i_1]; + listHolder_1->mList[i_1] = static_castmList[i_1])>>(element_1.unsignedCharValue); + } + definedValue_0 = ListType_1(listHolder_1->mList, self.optionalList.count); + } else { + definedValue_0 = ListType_1(); + } + } + } + } + { + if (self.nullableOptionalList != nil) { + auto & definedValue_0 = encodableStruct.nullableOptionalList.Emplace(); + if (self.nullableOptionalList == nil) { + definedValue_0.SetNull(); + } else { + auto & nonNullValue_1 = definedValue_0.SetNonNull(); + { + using ListType_2 = std::remove_reference_t; + using ListMemberType_2 = ListMemberTypeGetter::Type; + if (self.nullableOptionalList.count != 0) { + auto * listHolder_2 = new ListHolder(self.nullableOptionalList.count); + if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_2); + for (size_t i_2 = 0; i_2 < self.nullableOptionalList.count; ++i_2) { + if (![self.nullableOptionalList[i_2] isKindOfClass:[NSNumber class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_2 = (NSNumber *) self.nullableOptionalList[i_2]; + listHolder_2->mList[i_2] = static_castmList[i_2])>>(element_2.unsignedCharValue); + } + nonNullValue_1 = ListType_2(listHolder_2->mList, self.nullableOptionalList.count); + } else { + nonNullValue_1 = ListType_2(); + } + } + } + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } - _nullableOptionalStruct = nil; + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); - _nullableList = nil; + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); - _optionalList = nil; + ReturnErrorOnFailure(writer.Finalize(&buffer)); - _nullableOptionalList = nil; - _timedInvokeTimeoutMs = nil; - _serverSideProcessingTimeout = nil; - } - return self; + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); } -- (id)copyWithZone:(NSZone * _Nullable)zone; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error { - auto other = [[MTRUnitTestingClusterTestComplexNullableOptionalRequestParams alloc] init]; - - other.nullableInt = self.nullableInt; - other.optionalInt = self.optionalInt; - other.nullableOptionalInt = self.nullableOptionalInt; - other.nullableString = self.nullableString; - other.optionalString = self.optionalString; - other.nullableOptionalString = self.nullableOptionalString; - other.nullableStruct = self.nullableStruct; - other.optionalStruct = self.optionalStruct; - other.nullableOptionalStruct = self.nullableOptionalStruct; - other.nullableList = self.nullableList; - other.optionalList = self.optionalList; - other.nullableOptionalList = self.nullableOptionalList; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; - - return other; -} + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } -- (NSString *)description -{ - NSString * descriptionString = [NSString stringWithFormat:@"<%@: nullableInt:%@; optionalInt:%@; nullableOptionalInt:%@; nullableString:%@; optionalString:%@; nullableOptionalString:%@; nullableStruct:%@; optionalStruct:%@; nullableOptionalStruct:%@; nullableList:%@; optionalList:%@; nullableOptionalList:%@; >", NSStringFromClass([self class]), _nullableInt, _optionalInt, _nullableOptionalInt, _nullableString, _optionalString, _nullableOptionalString, _nullableStruct, _optionalStruct, _nullableOptionalStruct, _nullableList, _optionalList, _nullableOptionalList]; - return descriptionString; + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; } - @end @implementation MTRTestClusterClusterTestComplexNullableOptionalRequestParams @@ -14884,6 +27079,61 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterSimpleStructEchoRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::SimpleStructEchoRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.arg1.a = self.arg1.a.unsignedCharValue; + encodableStruct.arg1.b = self.arg1.b.boolValue; + encodableStruct.arg1.c = static_cast>(self.arg1.c.unsignedCharValue); + encodableStruct.arg1.d = AsByteSpan(self.arg1.d); + encodableStruct.arg1.e = AsCharSpan(self.arg1.e); + encodableStruct.arg1.f = static_cast>(self.arg1.f.unsignedCharValue); + encodableStruct.arg1.g = self.arg1.g.floatValue; + encodableStruct.arg1.h = self.arg1.h.doubleValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterSimpleStructEchoRequestParams @dynamic arg1; @@ -14918,6 +27168,51 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterTimedInvokeRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TimedInvokeRequest::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterTimedInvokeRequestParams @dynamic timedInvokeTimeoutMs; @@ -14954,6 +27249,57 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterTestSimpleOptionalArgumentRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TestSimpleOptionalArgumentRequest::Type encodableStruct; + ListFreer listFreer; + { + if (self.arg1 != nil) { + auto & definedValue_0 = encodableStruct.arg1.Emplace(); + definedValue_0 = self.arg1.boolValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterTestSimpleOptionalArgumentRequestParams @dynamic arg1; @@ -14997,6 +27343,60 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterTestEmitTestEventRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TestEmitTestEventRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.arg1 = self.arg1.unsignedCharValue; + } + { + encodableStruct.arg2 = static_cast>(self.arg2.unsignedCharValue); + } + { + encodableStruct.arg3 = self.arg3.boolValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterTestEmitTestEventRequestParams @dynamic arg1; @dynamic arg2; @@ -15036,6 +27436,54 @@ - (NSString *)description @end +@implementation MTRUnitTestingClusterTestEmitTestFabricScopedEventRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::TestEmitTestFabricScopedEventRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.arg1 = self.arg1.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRTestClusterClusterTestEmitTestFabricScopedEventRequestParams @dynamic arg1; @@ -15069,6 +27517,52 @@ - (NSString *)description } @end + +@implementation MTRSampleMEIClusterPingParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::SampleMei::Commands::Ping::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRSampleMEIClusterAddArgumentsResponseParams - (instancetype)init { @@ -15145,7 +27639,9 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::SampleMe } return CHIP_NO_ERROR; } + @end + @implementation MTRSampleMEIClusterAddArgumentsParams - (instancetype)init { @@ -15180,4 +27676,66 @@ - (NSString *)description @end +@implementation MTRSampleMEIClusterAddArgumentsParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::SampleMei::Commands::AddArguments::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.arg1 = self.arg1.unsignedCharValue; + } + { + encodableStruct.arg2 = self.arg2.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +// MTRBasicClusterMfgSpecificPingParams doesn't need to actually work. +@implementation MTRBasicClusterMfgSpecificPingParams (InternalMethods) +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + return nil; +} +@end + NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h index dfb04923589baa..fdecc5a05fdd24 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h @@ -25,285 +25,1365 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, strong) NSData * attestationChallenge; @end +@interface MTRIdentifyClusterIdentifyParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRIdentifyClusterTriggerEffectParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRGroupsClusterAddGroupParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRGroupsClusterAddGroupResponseParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType &)decodableStruct; +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRGroupsClusterViewGroupParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRGroupsClusterViewGroupResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRGroupsClusterGetGroupMembershipParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRGroupsClusterGetGroupMembershipResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Groups::Commands::GetGroupMembershipResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRGroupsClusterRemoveGroupParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRGroupsClusterRemoveGroupResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Groups::Commands::RemoveGroupResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRGroupsClusterRemoveAllGroupsParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRGroupsClusterAddGroupIfIdentifyingParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRScenesClusterAddSceneParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRScenesClusterAddSceneResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes::Commands::AddSceneResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRScenesClusterViewSceneParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRScenesClusterViewSceneResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes::Commands::ViewSceneResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRScenesClusterRemoveSceneParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRScenesClusterRemoveSceneResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes::Commands::RemoveSceneResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRScenesClusterRemoveAllScenesParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRScenesClusterRemoveAllScenesResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes::Commands::RemoveAllScenesResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRScenesClusterStoreSceneParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRScenesClusterStoreSceneResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes::Commands::StoreSceneResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRScenesClusterRecallSceneParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRScenesClusterGetSceneMembershipParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRScenesClusterGetSceneMembershipResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes::Commands::GetSceneMembershipResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRScenesClusterEnhancedAddSceneParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRScenesClusterEnhancedAddSceneResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes::Commands::EnhancedAddSceneResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRScenesClusterEnhancedViewSceneParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRScenesClusterEnhancedViewSceneResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes::Commands::EnhancedViewSceneResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRScenesClusterCopySceneParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRScenesClusterCopySceneResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes::Commands::CopySceneResponse::DecodableType &)decodableStruct; + +@end + +@interface MTROnOffClusterOffParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROnOffClusterOnParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROnOffClusterToggleParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROnOffClusterOffWithEffectParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROnOffClusterOnWithRecallGlobalSceneParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROnOffClusterOnWithTimedOffParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRLevelControlClusterMoveToLevelParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRLevelControlClusterMoveParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRLevelControlClusterStepParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRLevelControlClusterStopParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRLevelControlClusterMoveToLevelWithOnOffParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRLevelControlClusterMoveWithOnOffParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRLevelControlClusterStepWithOnOffParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRLevelControlClusterStopWithOnOffParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRLevelControlClusterMoveToClosestFrequencyParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRActionsClusterInstantActionParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRActionsClusterInstantActionWithTransitionParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRActionsClusterStartActionParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRActionsClusterStartActionWithDurationParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRActionsClusterStopActionParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRActionsClusterPauseActionParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRActionsClusterPauseActionWithDurationParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRActionsClusterResumeActionParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRActionsClusterEnableActionParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRActionsClusterEnableActionWithDurationParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRActionsClusterDisableActionParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRActionsClusterDisableActionWithDurationParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROTASoftwareUpdateProviderClusterQueryImageParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROTASoftwareUpdateProviderClusterQueryImageResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImageResponse::DecodableType &)decodableStruct; + +@end + +@interface MTROTASoftwareUpdateProviderClusterApplyUpdateRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROTASoftwareUpdateProviderClusterApplyUpdateResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateResponse::DecodableType &)decodableStruct; + +@end + +@interface MTROTASoftwareUpdateProviderClusterNotifyUpdateAppliedParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROTASoftwareUpdateRequestorClusterAnnounceOTAProviderParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRGeneralCommissioningClusterArmFailSafeParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRGeneralCommissioningClusterArmFailSafeResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafeResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRGeneralCommissioningClusterSetRegulatoryConfigParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRGeneralCommissioningClusterSetRegulatoryConfigResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfigResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRGeneralCommissioningClusterCommissioningCompleteParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRGeneralCommissioningClusterCommissioningCompleteResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::GeneralCommissioning::Commands::CommissioningCompleteResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRNetworkCommissioningClusterScanNetworksParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRNetworkCommissioningClusterScanNetworksResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::NetworkCommissioning::Commands::ScanNetworksResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRNetworkCommissioningClusterAddOrUpdateWiFiNetworkParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRNetworkCommissioningClusterAddOrUpdateThreadNetworkParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRNetworkCommissioningClusterRemoveNetworkParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRNetworkCommissioningClusterNetworkConfigResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::NetworkCommissioning::Commands::NetworkConfigResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRNetworkCommissioningClusterConnectNetworkParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRNetworkCommissioningClusterConnectNetworkResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::NetworkCommissioning::Commands::ConnectNetworkResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRNetworkCommissioningClusterReorderNetworkParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDiagnosticLogsClusterRetrieveLogsRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDiagnosticLogsClusterRetrieveLogsResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRGeneralDiagnosticsClusterTestEventTriggerParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRSoftwareDiagnosticsClusterResetWatermarksParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRThreadNetworkDiagnosticsClusterResetCountsParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRWiFiNetworkDiagnosticsClusterResetCountsParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTREthernetNetworkDiagnosticsClusterResetCountsParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRTimeSynchronizationClusterSetUTCTimeParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRTimeSynchronizationClusterSetTrustedTimeSourceParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRTimeSynchronizationClusterSetTimeZoneParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRTimeSynchronizationClusterSetTimeZoneResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::TimeSynchronization::Commands::SetTimeZoneResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRTimeSynchronizationClusterSetDSTOffsetParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRTimeSynchronizationClusterSetDefaultNTPParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRAdministratorCommissioningClusterOpenCommissioningWindowParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRAdministratorCommissioningClusterOpenBasicCommissioningWindowParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRAdministratorCommissioningClusterRevokeCommissioningParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROperationalCredentialsClusterAttestationRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROperationalCredentialsClusterAttestationResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::OperationalCredentials::Commands::AttestationResponse::DecodableType &)decodableStruct; + +@end + +@interface MTROperationalCredentialsClusterCertificateChainRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROperationalCredentialsClusterCertificateChainResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::OperationalCredentials::Commands::CertificateChainResponse::DecodableType &)decodableStruct; + +@end + +@interface MTROperationalCredentialsClusterCSRRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROperationalCredentialsClusterCSRResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::OperationalCredentials::Commands::CSRResponse::DecodableType &)decodableStruct; + +@end + +@interface MTROperationalCredentialsClusterAddNOCParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROperationalCredentialsClusterUpdateNOCParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROperationalCredentialsClusterNOCResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType &)decodableStruct; + +@end + +@interface MTROperationalCredentialsClusterUpdateFabricLabelParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROperationalCredentialsClusterRemoveFabricParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROperationalCredentialsClusterAddTrustedRootCertificateParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRGroupKeyManagementClusterKeySetWriteParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRGroupKeyManagementClusterKeySetReadParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRGroupKeyManagementClusterKeySetReadResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRGroupKeyManagementClusterKeySetRemoveParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRGroupKeyManagementClusterKeySetReadAllIndicesParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRGroupKeyManagementClusterKeySetReadAllIndicesResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndicesResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRICDManagementClusterRegisterClientParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRICDManagementClusterRegisterClientResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::IcdManagement::Commands::RegisterClientResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRICDManagementClusterUnregisterClientParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRICDManagementClusterStayActiveRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRModeSelectClusterChangeToModeParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRLaundryWasherModeClusterChangeToModeParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRLaundryWasherModeClusterChangeToModeResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::LaundryWasherMode::Commands::ChangeToModeResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Commands::ChangeToModeResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRRVCRunModeClusterChangeToModeParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRRVCRunModeClusterChangeToModeResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::RvcRunMode::Commands::ChangeToModeResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRRVCCleanModeClusterChangeToModeParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRRVCCleanModeClusterChangeToModeResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::RvcCleanMode::Commands::ChangeToModeResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRTemperatureControlClusterSetTemperatureParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDishwasherModeClusterChangeToModeParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDishwasherModeClusterChangeToModeResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DishwasherMode::Commands::ChangeToModeResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRSmokeCOAlarmClusterSelfTestRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDishwasherAlarmClusterResetParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDishwasherAlarmClusterModifyEnabledAlarmsParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROperationalStateClusterPauseParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROperationalStateClusterStopParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROperationalStateClusterStartParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROperationalStateClusterResumeParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTROperationalStateClusterOperationalCommandResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::OperationalState::Commands::OperationalCommandResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRRVCOperationalStateClusterPauseParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRRVCOperationalStateClusterStopParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRRVCOperationalStateClusterStartParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRRVCOperationalStateClusterResumeParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRRVCOperationalStateClusterOperationalCommandResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::RvcOperationalState::Commands::OperationalCommandResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRHEPAFilterMonitoringClusterResetConditionParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRActivatedCarbonFilterMonitoringClusterResetConditionParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDoorLockClusterLockDoorParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDoorLockClusterUnlockDoorParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDoorLockClusterUnlockWithTimeoutParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDoorLockClusterSetWeekDayScheduleParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDoorLockClusterGetWeekDayScheduleParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDoorLockClusterGetWeekDayScheduleResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRDoorLockClusterClearWeekDayScheduleParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDoorLockClusterSetYearDayScheduleParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDoorLockClusterGetYearDayScheduleParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDoorLockClusterGetYearDayScheduleResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRDoorLockClusterClearYearDayScheduleParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDoorLockClusterSetHolidayScheduleParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDoorLockClusterGetHolidayScheduleParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDoorLockClusterGetHolidayScheduleResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRDoorLockClusterClearHolidayScheduleParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDoorLockClusterSetUserParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDoorLockClusterGetUserParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDoorLockClusterGetUserResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRDoorLockClusterClearUserParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDoorLockClusterSetCredentialParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDoorLockClusterSetCredentialResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRDoorLockClusterGetCredentialStatusParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDoorLockClusterGetCredentialStatusResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRDoorLockClusterClearCredentialParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDoorLockClusterUnboltDoorParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRWindowCoveringClusterUpOrOpenParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRWindowCoveringClusterDownOrCloseParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRWindowCoveringClusterStopMotionParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRWindowCoveringClusterGoToLiftValueParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRWindowCoveringClusterGoToLiftPercentageParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRWindowCoveringClusterGoToTiltValueParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRWindowCoveringClusterGoToTiltPercentageParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRBarrierControlClusterBarrierControlGoToPercentParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRBarrierControlClusterBarrierControlStopParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRThermostatClusterSetpointRaiseLowerParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRGroupsClusterViewGroupResponseParams (InternalMethods) +@interface MTRThermostatClusterGetWeeklyScheduleResponseParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType &)decodableStruct; +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Thermostat::Commands::GetWeeklyScheduleResponse::DecodableType &)decodableStruct; @end -@interface MTRGroupsClusterGetGroupMembershipResponseParams (InternalMethods) +@interface MTRThermostatClusterSetWeeklyScheduleParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Groups::Commands::GetGroupMembershipResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRGroupsClusterRemoveGroupResponseParams (InternalMethods) +@interface MTRThermostatClusterGetWeeklyScheduleParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Groups::Commands::RemoveGroupResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRScenesClusterAddSceneResponseParams (InternalMethods) +@interface MTRThermostatClusterClearWeeklyScheduleParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes::Commands::AddSceneResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRScenesClusterViewSceneResponseParams (InternalMethods) +@interface MTRFanControlClusterStepParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes::Commands::ViewSceneResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRScenesClusterRemoveSceneResponseParams (InternalMethods) +@interface MTRColorControlClusterMoveToHueParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes::Commands::RemoveSceneResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRScenesClusterRemoveAllScenesResponseParams (InternalMethods) +@interface MTRColorControlClusterMoveHueParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes::Commands::RemoveAllScenesResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRScenesClusterStoreSceneResponseParams (InternalMethods) +@interface MTRColorControlClusterStepHueParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes::Commands::StoreSceneResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRScenesClusterGetSceneMembershipResponseParams (InternalMethods) +@interface MTRColorControlClusterMoveToSaturationParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes::Commands::GetSceneMembershipResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRScenesClusterEnhancedAddSceneResponseParams (InternalMethods) +@interface MTRColorControlClusterMoveSaturationParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes::Commands::EnhancedAddSceneResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRScenesClusterEnhancedViewSceneResponseParams (InternalMethods) +@interface MTRColorControlClusterStepSaturationParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes::Commands::EnhancedViewSceneResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRScenesClusterCopySceneResponseParams (InternalMethods) +@interface MTRColorControlClusterMoveToHueAndSaturationParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Scenes::Commands::CopySceneResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTROTASoftwareUpdateProviderClusterQueryImageResponseParams (InternalMethods) +@interface MTRColorControlClusterMoveToColorParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImageResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTROTASoftwareUpdateProviderClusterApplyUpdateResponseParams (InternalMethods) +@interface MTRColorControlClusterMoveColorParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRGeneralCommissioningClusterArmFailSafeResponseParams (InternalMethods) +@interface MTRColorControlClusterStepColorParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafeResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRGeneralCommissioningClusterSetRegulatoryConfigResponseParams (InternalMethods) +@interface MTRColorControlClusterMoveToColorTemperatureParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfigResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRGeneralCommissioningClusterCommissioningCompleteResponseParams (InternalMethods) +@interface MTRColorControlClusterEnhancedMoveToHueParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::GeneralCommissioning::Commands::CommissioningCompleteResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRNetworkCommissioningClusterScanNetworksResponseParams (InternalMethods) +@interface MTRColorControlClusterEnhancedMoveHueParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::NetworkCommissioning::Commands::ScanNetworksResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRNetworkCommissioningClusterNetworkConfigResponseParams (InternalMethods) +@interface MTRColorControlClusterEnhancedStepHueParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::NetworkCommissioning::Commands::NetworkConfigResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRNetworkCommissioningClusterConnectNetworkResponseParams (InternalMethods) +@interface MTRColorControlClusterEnhancedMoveToHueAndSaturationParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::NetworkCommissioning::Commands::ConnectNetworkResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRDiagnosticLogsClusterRetrieveLogsResponseParams (InternalMethods) +@interface MTRColorControlClusterColorLoopSetParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRTimeSynchronizationClusterSetTimeZoneResponseParams (InternalMethods) +@interface MTRColorControlClusterStopMoveStepParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::TimeSynchronization::Commands::SetTimeZoneResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTROperationalCredentialsClusterAttestationResponseParams (InternalMethods) +@interface MTRColorControlClusterMoveColorTemperatureParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::OperationalCredentials::Commands::AttestationResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTROperationalCredentialsClusterCertificateChainResponseParams (InternalMethods) +@interface MTRColorControlClusterStepColorTemperatureParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::OperationalCredentials::Commands::CertificateChainResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTROperationalCredentialsClusterCSRResponseParams (InternalMethods) +@interface MTRChannelClusterChangeChannelParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::OperationalCredentials::Commands::CSRResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTROperationalCredentialsClusterNOCResponseParams (InternalMethods) +@interface MTRChannelClusterChangeChannelResponseParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType &)decodableStruct; +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Channel::Commands::ChangeChannelResponse::DecodableType &)decodableStruct; @end -@interface MTRGroupKeyManagementClusterKeySetReadResponseParams (InternalMethods) +@interface MTRChannelClusterChangeChannelByNumberParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRGroupKeyManagementClusterKeySetReadAllIndicesResponseParams (InternalMethods) +@interface MTRChannelClusterSkipChannelParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndicesResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRICDManagementClusterRegisterClientResponseParams (InternalMethods) +@interface MTRTargetNavigatorClusterNavigateTargetParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::IcdManagement::Commands::RegisterClientResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRLaundryWasherModeClusterChangeToModeResponseParams (InternalMethods) +@interface MTRTargetNavigatorClusterNavigateTargetResponseParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::LaundryWasherMode::Commands::ChangeToModeResponse::DecodableType &)decodableStruct; +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::TargetNavigator::Commands::NavigateTargetResponse::DecodableType &)decodableStruct; @end -@interface MTRRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseParams (InternalMethods) +@interface MTRMediaPlaybackClusterPlayParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Commands::ChangeToModeResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRRVCRunModeClusterChangeToModeResponseParams (InternalMethods) +@interface MTRMediaPlaybackClusterPauseParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::RvcRunMode::Commands::ChangeToModeResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRRVCCleanModeClusterChangeToModeResponseParams (InternalMethods) +@interface MTRMediaPlaybackClusterStopParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::RvcCleanMode::Commands::ChangeToModeResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRDishwasherModeClusterChangeToModeResponseParams (InternalMethods) +@interface MTRMediaPlaybackClusterStartOverParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DishwasherMode::Commands::ChangeToModeResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTROperationalStateClusterOperationalCommandResponseParams (InternalMethods) +@interface MTRMediaPlaybackClusterPreviousParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::OperationalState::Commands::OperationalCommandResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRRVCOperationalStateClusterOperationalCommandResponseParams (InternalMethods) +@interface MTRMediaPlaybackClusterNextParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::RvcOperationalState::Commands::OperationalCommandResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRDoorLockClusterGetWeekDayScheduleResponseParams (InternalMethods) +@interface MTRMediaPlaybackClusterRewindParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRDoorLockClusterGetYearDayScheduleResponseParams (InternalMethods) +@interface MTRMediaPlaybackClusterFastForwardParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRDoorLockClusterGetHolidayScheduleResponseParams (InternalMethods) +@interface MTRMediaPlaybackClusterSkipForwardParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRDoorLockClusterGetUserResponseParams (InternalMethods) +@interface MTRMediaPlaybackClusterSkipBackwardParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRDoorLockClusterSetCredentialResponseParams (InternalMethods) +@interface MTRMediaPlaybackClusterPlaybackResponseParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType &)decodableStruct; +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType &)decodableStruct; @end -@interface MTRDoorLockClusterGetCredentialStatusResponseParams (InternalMethods) +@interface MTRMediaPlaybackClusterSeekParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRThermostatClusterGetWeeklyScheduleResponseParams (InternalMethods) +@interface MTRMediaInputClusterSelectInputParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Thermostat::Commands::GetWeeklyScheduleResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRChannelClusterChangeChannelResponseParams (InternalMethods) +@interface MTRMediaInputClusterShowInputStatusParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Channel::Commands::ChangeChannelResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRTargetNavigatorClusterNavigateTargetResponseParams (InternalMethods) +@interface MTRMediaInputClusterHideInputStatusParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::TargetNavigator::Commands::NavigateTargetResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end -@interface MTRMediaPlaybackClusterPlaybackResponseParams (InternalMethods) +@interface MTRMediaInputClusterRenameInputParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType &)decodableStruct; +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRLowPowerClusterSleepParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRKeypadInputClusterSendKeyParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @end @@ -313,112 +1393,333 @@ NS_ASSUME_NONNULL_BEGIN @end +@interface MTRContentLauncherClusterLaunchContentParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRContentLauncherClusterLaunchURLParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRContentLauncherClusterLauncherResponseParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType &)decodableStruct; @end +@interface MTRAudioOutputClusterSelectOutputParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRAudioOutputClusterRenameOutputParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRApplicationLauncherClusterLaunchAppParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRApplicationLauncherClusterStopAppParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRApplicationLauncherClusterHideAppParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRApplicationLauncherClusterLauncherResponseParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::DecodableType &)decodableStruct; @end +@interface MTRAccountLoginClusterGetSetupPINParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRAccountLoginClusterGetSetupPINResponseParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::AccountLogin::Commands::GetSetupPINResponse::DecodableType &)decodableStruct; @end +@interface MTRAccountLoginClusterLoginParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRAccountLoginClusterLogoutParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRElectricalMeasurementClusterGetProfileInfoResponseCommandParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::ElectricalMeasurement::Commands::GetProfileInfoResponseCommand::DecodableType &)decodableStruct; @end +@interface MTRElectricalMeasurementClusterGetProfileInfoCommandParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRElectricalMeasurementClusterGetMeasurementProfileResponseCommandParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::ElectricalMeasurement::Commands::GetMeasurementProfileResponseCommand::DecodableType &)decodableStruct; @end +@interface MTRElectricalMeasurementClusterGetMeasurementProfileCommandParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRUnitTestingClusterTestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRUnitTestingClusterTestSpecificResponseParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTesting::Commands::TestSpecificResponse::DecodableType &)decodableStruct; @end +@interface MTRUnitTestingClusterTestNotHandledParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRUnitTestingClusterTestAddArgumentsResponseParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTesting::Commands::TestAddArgumentsResponse::DecodableType &)decodableStruct; @end +@interface MTRUnitTestingClusterTestSpecificParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRUnitTestingClusterTestSimpleArgumentResponseParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTesting::Commands::TestSimpleArgumentResponse::DecodableType &)decodableStruct; @end +@interface MTRUnitTestingClusterTestUnknownCommandParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRUnitTestingClusterTestStructArrayArgumentResponseParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTesting::Commands::TestStructArrayArgumentResponse::DecodableType &)decodableStruct; @end +@interface MTRUnitTestingClusterTestAddArgumentsParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRUnitTestingClusterTestListInt8UReverseResponseParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTesting::Commands::TestListInt8UReverseResponse::DecodableType &)decodableStruct; @end +@interface MTRUnitTestingClusterTestSimpleArgumentRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRUnitTestingClusterTestEnumsResponseParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTesting::Commands::TestEnumsResponse::DecodableType &)decodableStruct; @end +@interface MTRUnitTestingClusterTestStructArrayArgumentRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRUnitTestingClusterTestNullableOptionalResponseParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTesting::Commands::TestNullableOptionalResponse::DecodableType &)decodableStruct; @end +@interface MTRUnitTestingClusterTestStructArgumentRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRUnitTestingClusterTestComplexNullableOptionalResponseParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTesting::Commands::TestComplexNullableOptionalResponse::DecodableType &)decodableStruct; @end +@interface MTRUnitTestingClusterTestNestedStructArgumentRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRUnitTestingClusterBooleanResponseParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTesting::Commands::BooleanResponse::DecodableType &)decodableStruct; @end +@interface MTRUnitTestingClusterTestListStructArgumentRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRUnitTestingClusterSimpleStructResponseParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTesting::Commands::SimpleStructResponse::DecodableType &)decodableStruct; @end +@interface MTRUnitTestingClusterTestListInt8UArgumentRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRUnitTestingClusterTestEmitTestEventResponseParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTesting::Commands::TestEmitTestEventResponse::DecodableType &)decodableStruct; @end +@interface MTRUnitTestingClusterTestNestedStructListArgumentRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRUnitTestingClusterTestEmitTestFabricScopedEventResponseParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTesting::Commands::TestEmitTestFabricScopedEventResponse::DecodableType &)decodableStruct; @end +@interface MTRUnitTestingClusterTestListNestedStructListArgumentRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRUnitTestingClusterTestListInt8UReverseRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRUnitTestingClusterTestEnumsRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRUnitTestingClusterTestNullableOptionalRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRUnitTestingClusterTestComplexNullableOptionalRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRUnitTestingClusterSimpleStructEchoRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRUnitTestingClusterTimedInvokeRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRUnitTestingClusterTestSimpleOptionalArgumentRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRUnitTestingClusterTestEmitTestEventRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRUnitTestingClusterTestEmitTestFabricScopedEventRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRSampleMEIClusterPingParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRSampleMEIClusterAddArgumentsResponseParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::SampleMei::Commands::AddArgumentsResponse::DecodableType &)decodableStruct; @end +@interface MTRSampleMEIClusterAddArgumentsParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +// Make sure that MTRBasicClusterMfgSpecificPingParams has _encodeAsDataValue just so it compiles. +@interface MTRBasicClusterMfgSpecificPingParams (InternalMethods) +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; +@end + NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m index 618a2f2648e571..661bde70075fee 100644 --- a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m +++ b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m @@ -1370,8 +1370,7 @@ - (void)test015_FailedSubscribeWithQueueAcrossShutdown clientQueue:queue reportHandler:^(id _Nullable values, NSError * _Nullable error) { } - subscriptionEstablished:^() { - }]; + subscriptionEstablished:^() {}]; [self waitForExpectations:@[ errorExpectation ] timeout:60]; } @@ -1424,8 +1423,7 @@ - (void)test016_FailedSubscribeWithCacheReadDuringFailure clientQueue:queue reportHandler:^(id _Nullable values, NSError * _Nullable error) { } - subscriptionEstablished:^() { - }]; + subscriptionEstablished:^() {}]; [self waitForExpectations:@[ errorExpectation ] timeout:60]; } @@ -1598,8 +1596,7 @@ - (void)test017_TestMTRDeviceBasics clientQueue:queue reportHandler:^(id _Nullable values, NSError * _Nullable error) { } - subscriptionEstablished:^() { - }]; + subscriptionEstablished:^() {}]; [self waitForExpectations:@[ subscriptionDroppedExpectation ] timeout:60]; @@ -1674,8 +1671,7 @@ - (void)test018_SubscriptionErrorWhenNotResubscribing clientQueue:queue reportHandler:^(id _Nullable values, NSError * _Nullable error) { } - subscriptionEstablished:^() { - }]; + subscriptionEstablished:^() {}]; [self waitForExpectations:@[ errorExpectation ] timeout:60]; } @@ -1688,6 +1684,30 @@ - (void)test019_MTRDeviceMultipleCommands __auto_type * onOffCluster = [[MTRClusterOnOff alloc] initWithDevice:device endpointID:@(1) queue:queue]; __auto_type * badOnOffCluster = [[MTRClusterOnOff alloc] initWithDevice:device endpointID:@(0) queue:queue]; + // Ensure our existing fabric label is not "Test". This uses a "base" + // cluster to ensure read-through to the other side. + __auto_type * baseOpCredsCluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:GetConnectedDevice() endpointID:@(0) queue:queue]; + XCTestExpectation * readFabricLabelExpectation = [self expectationWithDescription:@"Read fabric label first time"]; + [baseOpCredsCluster readAttributeFabricsWithParams:nil completion:^(NSArray * _Nullable value, NSError * _Nullable error) { + XCTAssertNil(error); + XCTAssertNotNil(value); + XCTAssertEqual(value.count, 1); + MTROperationalCredentialsClusterFabricDescriptorStruct * entry = value[0]; + XCTAssertNotEqualObjects(entry.label, @"Test"); + [readFabricLabelExpectation fulfill]; + }]; + + XCTestExpectation * readFabricIndexExpectation = [self expectationWithDescription:@"Read current fabric index"]; + __block NSNumber * currentFabricIndex; + [baseOpCredsCluster readAttributeCurrentFabricIndexWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + XCTAssertNil(error); + XCTAssertNotNil(value); + currentFabricIndex = value; + [readFabricIndexExpectation fulfill]; + }]; + + [self waitForExpectations:@[ readFabricLabelExpectation, readFabricIndexExpectation ] timeout:kTimeoutInSeconds]; + XCTestExpectation * onExpectation = [self expectationWithDescription:@"On command executed"]; [onOffCluster onWithParams:nil expectedValues:nil @@ -1718,6 +1738,7 @@ - (void)test019_MTRDeviceMultipleCommands XCTAssertNotNil(data); XCTAssertEqualObjects(data.statusCode, @(0)); XCTAssertNotNil(data.fabricIndex); + XCTAssertEqualObjects(data.fabricIndex, currentFabricIndex); [updateLabelExpectation fulfill]; }]; @@ -1757,6 +1778,19 @@ - (void)test019_MTRDeviceMultipleCommands ] timeout:60 enforceOrder:YES]; + + // Now make sure our fabric label got updated. + readFabricLabelExpectation = [self expectationWithDescription:@"Read fabric label second time"]; + [baseOpCredsCluster readAttributeFabricsWithParams:nil completion:^(NSArray * _Nullable value, NSError * _Nullable error) { + XCTAssertNil(error); + XCTAssertNotNil(value); + XCTAssertEqual(value.count, 1); + MTROperationalCredentialsClusterFabricDescriptorStruct * entry = value[0]; + XCTAssertEqualObjects(entry.label, @"Test"); + [readFabricLabelExpectation fulfill]; + }]; + + [self waitForExpectations:@[ readFabricLabelExpectation ] timeout:kTimeoutInSeconds]; } - (void)test020_ReadMultipleAttributes